manager: make Bluetooth rfcomm ports work again
At some point rfcomm serial ports stopped having parents in sysfs, so checks to get the physical device fail because the rfcomm port is /sys/devices/virtual/rfcommX and has no parents. So we have to fall back on checking the interface name.
This commit is contained in:
@@ -232,6 +232,7 @@ const gchar *
|
||||
mm_device_utils_get_port_driver (GUdevDevice *udev_port)
|
||||
{
|
||||
const gchar *driver, *subsys;
|
||||
const char *name = g_udev_device_get_name (udev_port);
|
||||
|
||||
driver = g_udev_device_get_driver (udev_port);
|
||||
if (!driver) {
|
||||
@@ -254,6 +255,12 @@ mm_device_utils_get_port_driver (GUdevDevice *udev_port)
|
||||
g_object_unref (parent);
|
||||
}
|
||||
|
||||
/* Newer kernels don't set up the rfcomm port parent in sysfs,
|
||||
* so we must infer it from the device name.
|
||||
*/
|
||||
if (!driver && strncmp (name, "rfcomm", 6) == 0)
|
||||
driver = "bluetooth";
|
||||
|
||||
return driver;
|
||||
}
|
||||
|
||||
|
@@ -170,13 +170,20 @@ find_physical_device (GUdevDevice *child)
|
||||
{
|
||||
GUdevDevice *iter, *old = NULL;
|
||||
GUdevDevice *physdev = NULL;
|
||||
const char *subsys, *type;
|
||||
const char *subsys, *type, *name;
|
||||
guint32 i = 0;
|
||||
gboolean is_usb = FALSE, is_pci = FALSE, is_pcmcia = FALSE, is_platform = FALSE;
|
||||
gboolean is_pnp = FALSE;
|
||||
|
||||
g_return_val_if_fail (child != NULL, NULL);
|
||||
|
||||
/* Bluetooth rfcomm devices are "virtual" and don't necessarily have
|
||||
* parents at all.
|
||||
*/
|
||||
name = g_udev_device_get_name (child);
|
||||
if (name && strncmp (name, "rfcomm", 6) == 0)
|
||||
return g_object_ref (child);
|
||||
|
||||
iter = g_object_ref (child);
|
||||
while (iter && i++ < 8) {
|
||||
subsys = g_udev_device_get_subsystem (iter);
|
||||
|
Reference in New Issue
Block a user