[Bug 1332164] [NEW] Battery powered keyboard gives invalid laptop detection
Rafaël Carré
1332164 at bugs.launchpad.net
Thu Jun 19 16:30:20 UTC 2014
Public bug reported:
laptop-mode will assume the system is a laptop if any battery is found.
I am running a desktop PC with a bluetooth battery powered Logitech K810
keyboard.
$ cat /sys/class/bluetooth/hci0:64/address
00:1f:20:91:df:35
$ ls /sys/class/power_supply
hid-00:1f:20:91:df:35-battery
$ cat /sys/class/power_supply/hid-00:1f:20:91:df:35-battery/type
Battery
$ cat /sys/class/power_supply/hid-00:1f:20:91:df:35-battery/scope
Device
The following laptop-detect code will assume the keyboard battery is an
ACPI battery:
# check for any ACPI batteries
/sbin/modprobe battery 2> /dev/null || true
if [ -d /sys/class/power_supply ]; then
for i in "`ls /sys/class/power_supply/*/ 2>/dev/null | grep -v hid`"; do
if grep -q Battery $i/type 2>/dev/null; then
$PRINTIT "We're a laptop (ACPI batteries found)" >&2
exit 0
fi
done
fi
Suggestion: filtering out /sys/class/power_supply/hid* before checking
battery type, or filter out scope = Device
** Affects: laptop-detect (Ubuntu)
Importance: Undecided
Status: New
** Tags: battery laptop
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to laptop-detect in Ubuntu.
https://bugs.launchpad.net/bugs/1332164
Title:
Battery powered keyboard gives invalid laptop detection
Status in “laptop-detect” package in Ubuntu:
New
Bug description:
laptop-mode will assume the system is a laptop if any battery is
found.
I am running a desktop PC with a bluetooth battery powered Logitech
K810 keyboard.
$ cat /sys/class/bluetooth/hci0:64/address
00:1f:20:91:df:35
$ ls /sys/class/power_supply
hid-00:1f:20:91:df:35-battery
$ cat /sys/class/power_supply/hid-00:1f:20:91:df:35-battery/type
Battery
$ cat /sys/class/power_supply/hid-00:1f:20:91:df:35-battery/scope
Device
The following laptop-detect code will assume the keyboard battery is
an ACPI battery:
# check for any ACPI batteries
/sbin/modprobe battery 2> /dev/null || true
if [ -d /sys/class/power_supply ]; then
for i in "`ls /sys/class/power_supply/*/ 2>/dev/null | grep -v hid`"; do
if grep -q Battery $i/type 2>/dev/null; then
$PRINTIT "We're a laptop (ACPI batteries found)" >&2
exit 0
fi
done
fi
Suggestion: filtering out /sys/class/power_supply/hid* before checking
battery type, or filter out scope = Device
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/laptop-detect/+bug/1332164/+subscriptions
More information about the foundations-bugs
mailing list