mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-26 10:06:42 +08:00
Made udev hwdb functionality optional
This commit is contained in:
@@ -81,6 +81,9 @@ static bool SDL_UDEV_load_syms(void)
|
|||||||
if (!SDL_UDEV_load_sym(#x, (void **)(char *)&_this->syms.x)) \
|
if (!SDL_UDEV_load_sym(#x, (void **)(char *)&_this->syms.x)) \
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
#define SDL_UDEV_SYM_OPTIONAL(x) \
|
||||||
|
SDL_UDEV_load_sym(#x, (void **)(char *)&_this->syms.x);
|
||||||
|
|
||||||
SDL_UDEV_SYM(udev_device_get_action);
|
SDL_UDEV_SYM(udev_device_get_action);
|
||||||
SDL_UDEV_SYM(udev_device_get_devnode);
|
SDL_UDEV_SYM(udev_device_get_devnode);
|
||||||
SDL_UDEV_SYM(udev_device_get_driver);
|
SDL_UDEV_SYM(udev_device_get_driver);
|
||||||
@@ -98,6 +101,7 @@ static bool SDL_UDEV_load_syms(void)
|
|||||||
SDL_UDEV_SYM(udev_enumerate_scan_devices);
|
SDL_UDEV_SYM(udev_enumerate_scan_devices);
|
||||||
SDL_UDEV_SYM(udev_enumerate_unref);
|
SDL_UDEV_SYM(udev_enumerate_unref);
|
||||||
SDL_UDEV_SYM(udev_list_entry_get_name);
|
SDL_UDEV_SYM(udev_list_entry_get_name);
|
||||||
|
SDL_UDEV_SYM(udev_list_entry_get_value);
|
||||||
SDL_UDEV_SYM(udev_list_entry_get_next);
|
SDL_UDEV_SYM(udev_list_entry_get_next);
|
||||||
SDL_UDEV_SYM(udev_monitor_enable_receiving);
|
SDL_UDEV_SYM(udev_monitor_enable_receiving);
|
||||||
SDL_UDEV_SYM(udev_monitor_filter_add_match_subsystem_devtype);
|
SDL_UDEV_SYM(udev_monitor_filter_add_match_subsystem_devtype);
|
||||||
@@ -110,10 +114,9 @@ static bool SDL_UDEV_load_syms(void)
|
|||||||
SDL_UDEV_SYM(udev_device_new_from_devnum);
|
SDL_UDEV_SYM(udev_device_new_from_devnum);
|
||||||
SDL_UDEV_SYM(udev_device_get_devnum);
|
SDL_UDEV_SYM(udev_device_get_devnum);
|
||||||
|
|
||||||
SDL_UDEV_SYM(udev_hwdb_new);
|
SDL_UDEV_SYM_OPTIONAL(udev_hwdb_new);
|
||||||
SDL_UDEV_SYM(udev_hwdb_unref);
|
SDL_UDEV_SYM_OPTIONAL(udev_hwdb_unref);
|
||||||
SDL_UDEV_SYM(udev_hwdb_get_properties_list_entry);
|
SDL_UDEV_SYM_OPTIONAL(udev_hwdb_get_properties_list_entry);
|
||||||
SDL_UDEV_SYM(udev_list_entry_get_value);
|
|
||||||
|
|
||||||
#undef SDL_UDEV_SYM
|
#undef SDL_UDEV_SYM
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ typedef struct SDL_UDEV_Symbols
|
|||||||
int (*udev_enumerate_scan_devices)(struct udev_enumerate *);
|
int (*udev_enumerate_scan_devices)(struct udev_enumerate *);
|
||||||
void (*udev_enumerate_unref)(struct udev_enumerate *);
|
void (*udev_enumerate_unref)(struct udev_enumerate *);
|
||||||
const char *(*udev_list_entry_get_name)(struct udev_list_entry *);
|
const char *(*udev_list_entry_get_name)(struct udev_list_entry *);
|
||||||
|
const char *(*udev_list_entry_get_value)(struct udev_list_entry *);
|
||||||
struct udev_list_entry *(*udev_list_entry_get_next)(struct udev_list_entry *);
|
struct udev_list_entry *(*udev_list_entry_get_next)(struct udev_list_entry *);
|
||||||
int (*udev_monitor_enable_receiving)(struct udev_monitor *);
|
int (*udev_monitor_enable_receiving)(struct udev_monitor *);
|
||||||
int (*udev_monitor_filter_add_match_subsystem_devtype)(struct udev_monitor *, const char *, const char *);
|
int (*udev_monitor_filter_add_match_subsystem_devtype)(struct udev_monitor *, const char *, const char *);
|
||||||
@@ -87,7 +88,6 @@ typedef struct SDL_UDEV_Symbols
|
|||||||
struct udev_hwdb *(*udev_hwdb_new)(struct udev *udev);
|
struct udev_hwdb *(*udev_hwdb_new)(struct udev *udev);
|
||||||
struct udev_hwdb *(*udev_hwdb_unref)(struct udev_hwdb *hwdb);
|
struct udev_hwdb *(*udev_hwdb_unref)(struct udev_hwdb *hwdb);
|
||||||
struct udev_list_entry *(*udev_hwdb_get_properties_list_entry)(struct udev_hwdb *hwdb, const char *modalias, unsigned flags);
|
struct udev_list_entry *(*udev_hwdb_get_properties_list_entry)(struct udev_hwdb *hwdb, const char *modalias, unsigned flags);
|
||||||
const char *(*udev_list_entry_get_value)(struct udev_list_entry *list_entry);
|
|
||||||
|
|
||||||
} SDL_UDEV_Symbols;
|
} SDL_UDEV_Symbols;
|
||||||
|
|
||||||
|
|||||||
@@ -916,7 +916,7 @@ static struct hid_device_info * create_device_info_for_device(struct udev_device
|
|||||||
root = cur_dev;
|
root = cur_dev;
|
||||||
}
|
}
|
||||||
tmp->next = NULL;
|
tmp->next = NULL;
|
||||||
|
|
||||||
hid_free_enumeration(tmp);
|
hid_free_enumeration(tmp);
|
||||||
} else {
|
} else {
|
||||||
prev_dev = cur_dev;
|
prev_dev = cur_dev;
|
||||||
@@ -1071,7 +1071,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
|
|||||||
tmp = create_device_info_for_device(raw_dev);
|
tmp = create_device_info_for_device(raw_dev);
|
||||||
|
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
if (!tmp->manufacturer_string) {
|
if (!tmp->manufacturer_string && udev_hwdb_new) {
|
||||||
key = "ID_VENDOR_FROM_DATABASE";
|
key = "ID_VENDOR_FROM_DATABASE";
|
||||||
|
|
||||||
if ((hwdb = udev_hwdb_new(udev)) != NULL) {
|
if ((hwdb = udev_hwdb_new(udev)) != NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user