udev: Add detection support for Samsung LTE dongles
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 23 Jul 2011 22:03:57 +0000 (00:03 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 23 Jul 2011 22:03:57 +0000 (00:03 +0200)
plugins/ofono.rules
plugins/udev.c

index 9791203..990c29a 100644 (file)
@@ -494,6 +494,9 @@ ATTRS{idVendor}=="0930", ATTRS{idProduct}=="130b", ENV{OFONO_DRIVER}="mbm"
 ATTRS{idVendor}=="0930", ATTRS{idProduct}=="130c", ENV{OFONO_DRIVER}="mbm"
 ATTRS{idVendor}=="0930", ATTRS{idProduct}=="1311", ENV{OFONO_DRIVER}="mbm"
 
+# Samsung GT-B3740 (LTE)
+ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6889", ENV{OFONO_DRIVER}="samsung"
+
 # Nokia Internet Stick CS-10
 ATTRS{idVendor}=="0421", ATTRS{idProduct}=="060e", ENV{OFONO_DRIVER}="nokia"
 
index 1d9aaf2..08c767c 100644 (file)
@@ -691,6 +691,41 @@ static void add_speedup(struct ofono_modem *modem,
                ofono_modem_register(modem);
 }
 
+static void add_samsung(struct ofono_modem *modem,
+                                       struct udev_device *udev_device)
+{
+       const char *subsystem;
+
+       DBG("modem %p", modem);
+
+       subsystem = udev_device_get_subsystem(udev_device);
+       if (subsystem == NULL)
+               return;
+
+       if (g_str_equal(subsystem, "net") == TRUE) {
+               const char *interface;
+
+               interface = get_property(udev_device, "INTERFACE");
+               if (interface == NULL)
+                       return;
+
+               DBG("network %s", interface);
+
+               ofono_modem_set_string(modem, "Network", interface);
+       } else if (g_str_equal(subsystem, "tty") == TRUE) {
+               const char *devnode;
+
+               devnode = udev_device_get_devnode(udev_device);
+               if (devnode == NULL)
+                       return;
+
+               DBG("device %s", devnode);
+
+               ofono_modem_set_string(modem, "Device", devnode);
+               ofono_modem_register(modem);
+       }
+}
+
 static void add_modem(struct udev_device *udev_device)
 {
        struct ofono_modem *modem;
@@ -797,6 +832,8 @@ done:
                add_speedup(modem, udev_device);
        else if (g_strcmp0(driver, "speedupcdma") == 0)
                add_speedup(modem, udev_device);
+       else if (g_strcmp0(driver, "samsung") == 0)
+               add_samsung(modem, udev_device);
 }
 
 static gboolean devpath_remove(gpointer key, gpointer value, gpointer user_data)