Battery powered keyboard gives invalid laptop detection

Bug #1332164 reported by Rafaël Carré
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
laptop-detect (Ubuntu)
Confirmed
Undecided
Unassigned

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

Tags: battery laptop
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in laptop-detect (Ubuntu):
status: New → Confirmed
Revision history for this message
David Piggott (dhpiggott) wrote :

I have the same issue but on a laptop (XPS 13). So for me it doesn't cause the problem of making the system be detected as a laptop (it really is one), but it does result in the system tray's power icon seemingly undeterministically changing between reporting the actual laptop battery's state, and the keyboard battery's state as the overall system power state. I would expect/prefer it to only report the real laptop battery state.

I'm about to attach three screenshots that show the power state dialog's view of my keyboard (which incorrectly shows as an additional laptop battery), my mouse (which correctly shows as a mouse, with power state), and the actual laptop battery.

Revision history for this message
David Piggott (dhpiggott) wrote :

Logitech K810 showing as a laptop battery.

Revision history for this message
David Piggott (dhpiggott) wrote :

Real laptop battery showing as laptop battery.

Revision history for this message
David Piggott (dhpiggott) wrote :

Logitech M570 showing as mouse battery.

Revision history for this message
David Piggott (dhpiggott) wrote :

Subsequent to my previous comments I note two new pieces of information:

1. After upgrading from 14.10 to 15.04, my Logitech M570 has disappeared from the power indicator (and the output of upower --dump) entirely, while the K810 remains (and still problematically shows as the primary battery).

2. I found #1153488 (I hadn't seen it before). I think this issue may be a duplicate of it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.