linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mario Limonciello <mario_limonciello@dell.com>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH 2/2] hid2hci: when recovering from S3 use parent devpath
Date: Mon, 27 Jul 2009 21:19:59 +0000	[thread overview]
Message-ID: <4A6E19FF.5070207@dell.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 616 bytes --]

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@dell.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: s3_again.diff --]
[-- Type: text/x-patch; name="s3_again.diff", Size: 1967 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

             reply	other threads:[~2009-07-27 21:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-27 21:19 Mario Limonciello [this message]
2009-07-27 21:35 ` [PATCH 2/2] hid2hci: when recovering from S3 use parent devpath Marcel Holtmann
2009-07-27 22:36 ` Mario Limonciello
2009-07-27 22:42 ` Marcel Holtmann
2009-07-28  0:04 ` Kay Sievers
2009-07-28 18:10 ` Mario Limonciello
2009-07-31 18:53 ` Kay Sievers
2009-07-31 19:35 ` Mario Limonciello
2009-08-05  7:47 ` Kay Sievers
2009-08-06 22:03 ` Mario Limonciello
2009-08-07  0:27 ` Kay Sievers
2009-08-07  0:44 ` Marcel Holtmann
2009-08-07  0:57 ` Kay Sievers
2009-08-07  1:28 ` Marco d'Itri
2009-08-07  1:47 ` Kay Sievers
2009-08-07  3:48 ` Marco d'Itri
2009-08-11 17:49 ` Karl O. Pinc
2009-08-11 22:22 ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A6E19FF.5070207@dell.com \
    --to=mario_limonciello@dell.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).