[PATCH 2/2] hid2hci: when recovering from S3 use parent devpath

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi:

After the previous cleanup submitted to hid2hci, the code for finding
the sibling device changed significantly.  Although this works perfectly
fine when all the devices are on the bus, it doesn't for the recovery
from S3 situation.  The device is already off the bus by the time
hid2hci is called so the devpath is not found in the udev database.  The
easiest way to solve this is to use the parent's devpath instead, but
this does introduce a dependency on importing the env variable DEVPATH
from the parent.

Regards
-- 
Mario Limonciello
*Dell | Linux Engineering*
mario_limonciello@xxxxxxxx
Since the BT device is off the bus, trying to query it from the udev
database fails.  We need to send the parent's DEVPATH (unfortunately
by pulling in from the $env) and then go from there.

=== modified file 'extras/hid2hci/70-hid2hci.rules'
--- extras/hid2hci/70-hid2hci.rules	2009-07-24 16:06:22 +0000
+++ extras/hid2hci/70-hid2hci.rules	2009-07-27 21:03:40 +0000
@@ -20,8 +20,8 @@
 # Unfortunately the only event seen is the BT device disappearing, so the mouse
 # device needs to be chased down on the USB bus.
 ATTR{bDeviceClass}=="e0", ATTR{bDeviceSubClass}=="01", ATTR{bDeviceProtocol}=="01", \
-  ATTR{idVendor}=="413c", ATTR{bmAttributes}=="e0", \
-  ENV{REMOVE_CMD}="hid2hci --method=dell --devpath=%p --find-sibling-intf=03:01:02"
+  ATTR{idVendor}=="413c", ATTR{bmAttributes}=="e0", IMPORT{parent}="DEVPATH", \
+  ENV{REMOVE_CMD}="hid2hci --method=dell --devpath=$env{DEVPATH} --find-sibling-intf=03:01:02"
 
 # CSR devices
 ATTR{idVendor}=="0a12|0458|05ac", ATTR{idProduct}=="1000", RUN+="hid2hci --method=csr --devpath=%p"

=== modified file 'extras/hid2hci/hid2hci.c'
--- extras/hid2hci/hid2hci.c	2009-07-27 20:45:34 +0000
+++ extras/hid2hci/hid2hci.c	2009-07-27 21:03:40 +0000
@@ -210,11 +210,6 @@
 		return usb_open(dev);
 	}
 
-	/* find matching sibling of the current usb_device, they share the same hub */
-	udev_parent = udev_device_get_parent_with_subsystem_devtype(udev_dev, "usb", "usb_device");
-	if (udev_parent == NULL)
-		return NULL;
-
 	enumerate = udev_enumerate_new(udev);
 	if (enumerate == NULL)
 		return NULL;
@@ -222,7 +217,7 @@
 	udev_enumerate_add_match_subsystem(enumerate, "usb");
 
 	/* match all childs of the parent */
-	util_strscpyl(str, sizeof(str), udev_device_get_sysname(udev_parent), "*", NULL);
+	util_strscpyl(str, sizeof(str), udev_device_get_sysname(udev_dev), "*", NULL);
 	udev_enumerate_add_match_sysname(enumerate, str);
 
 	/* match the specified interface */

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux