[PATCH] Check if the battery comes from bluetooth keyboard or mouse.

Peter Wu lekensteyn at gmail.com
Wed Aug 28 05:09:48 PDT 2013


On Wednesday 28 August 2013 10:48:13 Shih-Yuan Lee wrote:
> Thank you for your review.
> 
> For https://bugs.launchpad.net/ubuntu/+source/upower/+bug/1153488.
> The code base is a little old, so I made two patches for it.
> One is
> https://launchpadlibrarian.net/146285357/02-try-to-work-out-if-the-device-i
> s-powering-the-system.patch to fix the power-supply as you mentioned.
> The other is
> https://bugs.launchpad.net/ubuntu/+source/upower/+bug/1153488/+attachment/3
> 755785/+files/03-detect-bluetooth-keyboard-mouse.patch to fix the type of
> battery.
> 
> For this patch, it is only to fix the type of battery.

Right, Ubuntu ships with an older version of UPower. As for your patch, have 
you considered using some udev functions[1] instead? The bluetooth strstr 
function can probably be replaced by 
udev_device_get_parent_with_subsystem_devtype and similar for the 
sysfs_resolve_link?

As an alternative for checking for the bluetooth subsystem, what about testing 
for the HID subsystem in the parents of a power_supply ("battery") device?

Can you add output from "upowerd -v" (using the latest upstream upower 
version)? I want to see which paths are hit.

Regards,
Peter

 [1]: http://www.freedesktop.org/software/systemd/libudev/libudev-udev-device.html


More information about the devkit-devel mailing list