From e5441115a2dda5d81de2e9a336fc34e23d20b309 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 2 Oct 2009 22:31:16 -0700 Subject: bluetooth: recognize rfcomm devices Two hacks here: 1) rfcomm ports don't have an easily accessible driver name, so we just match the parent's subsystem to 'bluetooth' and use that 2) libgudev doesn't seem be be able to get the rfcomm device's device file, which would normally be /dev/rfcommX. Oh well, we don't use the device file yet anyway --- src/mm-plugin-base.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index 7adbe2a2..92694f50 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -664,7 +664,7 @@ static char * get_driver_name (GUdevDevice *device) { GUdevDevice *parent = NULL; - const char *driver; + const char *driver, *subsys; char *ret = NULL; driver = g_udev_device_get_driver (device); @@ -672,6 +672,15 @@ get_driver_name (GUdevDevice *device) parent = g_udev_device_get_parent (device); if (parent) driver = g_udev_device_get_driver (parent); + + /* Check for bluetooth; it's driver is a bunch of levels up so we + * just check for the subsystem of the parent being bluetooth. + */ + if (!driver && parent) { + subsys = g_udev_device_get_subsystem (parent); + if (subsys && !strcmp (subsys, "bluetooth")) + driver = "bluetooth"; + } } if (driver) -- cgit v1.2.3-70-g09d2 From ed059286c5361bf4dfa849088ee16c04cd075e51 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 2 Oct 2009 23:32:57 -0700 Subject: bluetooth: physical device is a bit higher up the tree --- src/mm-plugin-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index 92694f50..7455046f 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -703,7 +703,7 @@ real_find_physical_device (MMPluginBase *plugin, GUdevDevice *child) g_return_val_if_fail (child != NULL, NULL); iter = g_object_ref (child); - while (iter && i++ < 5) { + while (iter && i++ < 8) { subsys = g_udev_device_get_subsystem (iter); if (subsys) { if (is_usb || !strcmp (subsys, "usb")) { -- cgit v1.2.3-70-g09d2 From aa78b5f5e5319e04f5b57f928bfab69dd4b93d88 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 2 Oct 2009 23:33:18 -0700 Subject: bluetooth: handle rfcomm device moves rfcomm devices seem to be created as 'virtual' devices first, without any parents, then moved to the right place in the device tree. So handle moves too; if the modem was already found in the 'add' phase it'll be ignored in the move phase. --- src/mm-manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mm-manager.c b/src/mm-manager.c index a812c792..73189146 100644 --- a/src/mm-manager.c +++ b/src/mm-manager.c @@ -612,7 +612,7 @@ handle_uevent (GUdevClient *client, /* We only care about tty/net devices when adding modem ports, * but for remove, also handle usb parent device remove events */ - if (!strcmp (action, "add") && strcmp (subsys, "usb") !=0 ) + if ((!strcmp (action, "add") || !strcmp (action, "move")) && strcmp (subsys, "usb") !=0 ) device_added (self, device); else if (!strcmp (action, "remove")) device_removed (self, device); -- cgit v1.2.3-70-g09d2