Help with matching a HID device (udev rules troubles)

Martin Pitt martin.pitt at ubuntu.com
Thu Jul 2 03:00:04 PDT 2009


Hello Richard,

Richard Hughes [2009-07-02  9:14 +0100]:
> I'm trying to fix UPS support in DeviceKit-power. It's basically all
> down to incorrect udev rules. The device I'm trying to match is the
> last one in the chain, i.e. the one with DEVNAME=/dev/usb/hiddev0 :
> It's easy to match all devices with something like SUBSYSTEM=="usb",
> ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", but then this
> matches all devices, and I only want the hiddev0 device, not the
> hidraw1 device. Ideas welcome. Thanks.

Could you please send the output of 

  udevadm info --attribute-walk --name=/dev/usb/hiddev0

? This would allow us to look for a better match, and is easier for
constructing rules than a DB dump.

With the available data my guess is:

---------------- 8< ----------------
ACTION!="add", GOTO="ups_end" # drop this if you need change events, too
SUBSYSTEM!="usb", GOTO="ups_end"
KERNEL!="hiddev*", GOTO="ups_end"

ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", [... your action here ... ]
[... similar idVendor/idProduct rules ...]

LABEL="ups_end"

---------------- 8< ----------------

If the SUBSYSTEM!="usb" doesn't work (i. e. the hiddev device itself
doesn't have SUBSYSTEM, just one of the parents), replace it with

SUBSYSTEMS=="usb", GOTO="ups_start"
GOTO="ups_end"
LABEL="ups_start"

HTH,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/devkit-devel/attachments/20090702/3b56e01c/attachment.pgp 


More information about the devkit-devel mailing list