Hi Jonas,

On 03/25/2017 11:58 AM, Jonas Bonn wrote:
Device properties are generally on the device, on the USB interface
descriptor, or the on the USB device descriptor.
---
 plugins/udevng.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/plugins/udevng.c b/plugins/udevng.c
index 8721447..98b4f98 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -1365,6 +1365,9 @@ 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(intf, "OFONO_LABEL");
+       }

Okay, but not really our style.  See doc/coding-style.txt item M1

        subsystem = udev_device_get_subsystem(device);

        if (modem->sysattr != NULL)
@@ -1464,6 +1467,7 @@ static struct {
 static void check_usb_device(struct udev_device *device)
 {
        struct udev_device *usb_device;
+       struct udev_device *intf;

This is better declared inside the if statement below. Also intf is a horrible name. Just name it usb_device or usb_parent or something.

        const char *syspath, *devname, *driver;
        const char *vendor = NULL, *model = NULL;

@@ -1484,6 +1488,13 @@ 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) {
+               intf = udev_device_get_parent_with_subsystem_devtype(device,
+                                               "usb", "usb_interface");
+               if (intf)
+                       driver = udev_device_get_property_value(
+                                                       intf, "OFONO_DRIVER");
+       }

doc/coding-style.txt item M1

        if (driver == NULL) {
                const char *drv;
                unsigned int i;


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

Reply via email to