Wireless mouse battery level patch

Kay Sievers kay.sievers at vrfy.org
Fri Sep 15 13:45:13 PDT 2006


On Fri, 2006-09-15 at 13:34 -0400, Matthew Williams wrote:
> I've put together a patch that fixes a problem with hal being unable to read
> the battery level of wireless mice.
> 
> The root problem is that libusb used to populate its internal data
> structures by looking at the /proc/bus/usb directory structure, which uses
> zero-padded 3 digit hex numbers to identify USB buses and devices.  I.e. the
> third device on bus two would be known as '002/003'W.
> 
> Libusb now either populates itself using /dev/bus/usb or /proc/bus/usb with
> the former being preferred.  /dev/bus/usb doesn't zero-pad and it uses
> decimal numbers, not hex.  The code in addon-usb-csr.c assumed the old
> behaviour and used string comparisons to try to find the right device.  This
> would obviously fail as the new way of describing the above device is '2/3'
> which != '002/003'.

Your udev rule seems broken. What distro is it? You want something like:
  SUBSYSTEM=="usb_device", ACTION="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c"

Kay



More information about the hal mailing list