mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-06 02:02:09 +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)) \
|
||||
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_devnode);
|
||||
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_unref);
|
||||
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_monitor_enable_receiving);
|
||||
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_get_devnum);
|
||||
|
||||
SDL_UDEV_SYM(udev_hwdb_new);
|
||||
SDL_UDEV_SYM(udev_hwdb_unref);
|
||||
SDL_UDEV_SYM(udev_hwdb_get_properties_list_entry);
|
||||
SDL_UDEV_SYM(udev_list_entry_get_value);
|
||||
SDL_UDEV_SYM_OPTIONAL(udev_hwdb_new);
|
||||
SDL_UDEV_SYM_OPTIONAL(udev_hwdb_unref);
|
||||
SDL_UDEV_SYM_OPTIONAL(udev_hwdb_get_properties_list_entry);
|
||||
|
||||
#undef SDL_UDEV_SYM
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ typedef struct SDL_UDEV_Symbols
|
||||
int (*udev_enumerate_scan_devices)(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_value)(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_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_unref)(struct udev_hwdb *hwdb);
|
||||
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;
|
||||
|
||||
|
||||
@@ -916,7 +916,7 @@ static struct hid_device_info * create_device_info_for_device(struct udev_device
|
||||
root = cur_dev;
|
||||
}
|
||||
tmp->next = NULL;
|
||||
|
||||
|
||||
hid_free_enumeration(tmp);
|
||||
} else {
|
||||
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);
|
||||
|
||||
if (tmp) {
|
||||
if (!tmp->manufacturer_string) {
|
||||
if (!tmp->manufacturer_string && udev_hwdb_new) {
|
||||
key = "ID_VENDOR_FROM_DATABASE";
|
||||
|
||||
if ((hwdb = udev_hwdb_new(udev)) != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user