Device properties are generally on the device, on the USB interface
descriptor, or the on the USB device descriptor.
---
 plugins/udevng.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/plugins/udevng.c b/plugins/udevng.c
index 1e84aa4..6b76d30 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -1317,7 +1317,7 @@ static void add_device(const char *syspath, const char 
*devname,
                        const char *driver, const char *vendor,
                        const char *model, struct udev_device *device)
 {
-       struct udev_device *intf;
+       struct udev_device *usb_interface;
        const char *devpath, *devnode, *interface, *number;
        const char *label, *sysattr, *subsystem;
        struct modem_info *modem;
@@ -1335,9 +1335,9 @@ static void add_device(const char *syspath, const char 
*devname,
                        return;
        }
 
-       intf = udev_device_get_parent_with_subsystem_devtype(device,
+       usb_interface = udev_device_get_parent_with_subsystem_devtype(device,
                                                "usb", "usb_interface");
-       if (intf == NULL)
+       if (usb_interface == NULL)
                return;
 
        modem = g_hash_table_lookup(modem_list, syspath);
@@ -1373,6 +1373,11 @@ static void add_device(const char *syspath, const char 
*devname,
        }
 
        label = udev_device_get_property_value(device, "OFONO_LABEL");
+       if (!label) {
+               label = udev_device_get_property_value(usb_interface,
+                                                       "OFONO_LABEL");
+       }
+
        subsystem = udev_device_get_subsystem(device);
 
        if (modem->sysattr != NULL)
@@ -1495,6 +1500,14 @@ static void check_usb_device(struct udev_device *device)
        model = udev_device_get_property_value(usb_device, "ID_MODEL_ID");
 
        driver = udev_device_get_property_value(usb_device, "OFONO_DRIVER");
+       if (!driver) {
+               struct udev_device *usb_interface;
+               usb_interface = udev_device_get_parent_with_subsystem_devtype(
+                                       device, "usb", "usb_interface");
+               if (usb_interface)
+                       driver = udev_device_get_property_value(
+                                       usb_interface, "OFONO_DRIVER");
+       }
        if (driver == NULL) {
                const char *drv;
                unsigned int i;
-- 
2.9.3

_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to