diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2012-05-26 06:46:54 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-05-26 06:46:54 +0200 |
commit | f986bcbe356728694448627b8008c8231e054afb (patch) | |
tree | d82264053939ba2d4107f6bcd5d93ebf50ebc326 /plugins | |
parent | a5897668849819b71dd069a94fadae7a09374727 (diff) | |
download | ofono-f986bcbe356728694448627b8008c8231e054afb.tar.bz2 |
udev: Add matching support for CDC WDM device nodes
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/udevng.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/plugins/udevng.c b/plugins/udevng.c index 8fda394f..73c78b25 100644 --- a/plugins/udevng.c +++ b/plugins/udevng.c @@ -996,16 +996,23 @@ static void check_usb_device(struct udev_device *device) unsigned int i; drv = udev_device_get_property_value(device, "ID_USB_DRIVER"); - if (drv == NULL) - return; + if (drv == NULL) { + drv = udev_device_get_driver(device); + if (drv == NULL) { + struct udev_device *parent; + + parent = udev_device_get_parent(device); + if (parent == NULL) + return; + + drv = udev_device_get_driver(parent); + if (drv == NULL) + return; + } + } vid = udev_device_get_property_value(device, "ID_VENDOR_ID"); - if (vid == NULL) - return; - pid = udev_device_get_property_value(device, "ID_MODEL_ID"); - if (pid == NULL) - return; DBG("%s [%s:%s]", drv, vid, pid); @@ -1020,6 +1027,9 @@ static void check_usb_device(struct udev_device *device) break; } + if (vid == NULL || pid == NULL) + continue; + if (g_str_equal(vendor_list[i].vid, vid) == TRUE) { if (vendor_list[i].pid == NULL) { if (driver == NULL) { @@ -1051,8 +1061,11 @@ static void check_device(struct udev_device *device) const char *bus; bus = udev_device_get_property_value(device, "ID_BUS"); - if (bus == NULL) - return; + if (bus == NULL) { + bus = udev_device_get_subsystem(device); + if (bus == NULL) + return; + } if (g_str_equal(bus, "usb") == TRUE) check_usb_device(device); @@ -1103,6 +1116,7 @@ static void enumerate_devices(struct udev *context) return; udev_enumerate_add_match_subsystem(enumerate, "tty"); + udev_enumerate_add_match_subsystem(enumerate, "usb"); udev_enumerate_add_match_subsystem(enumerate, "net"); udev_enumerate_scan_devices(enumerate); @@ -1224,6 +1238,7 @@ static int detect_init(void) NULL, destroy_modem); udev_monitor_filter_add_match_subsystem_devtype(udev_mon, "tty", NULL); + udev_monitor_filter_add_match_subsystem_devtype(udev_mon, "usb", NULL); udev_monitor_filter_add_match_subsystem_devtype(udev_mon, "net", NULL); udev_monitor_filter_update(udev_mon); |