Bluetooth keyboard battery interpreted as laptop battery

Bug #1086746 reported by Øyvind Stegard
140
This bug affects 30 people
Affects Status Importance Assigned to Milestone
upower (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

My Logitech DiNovo Edge keyboard's internal battery status is available in:
/sys/class/power_supply/hid-00:07:61:76:C9:F1-battery

for the first time ever in Ubuntu 12.10. This would seem like a good thing, except that upower indicator reports it as a regular laptop/system battery, and even proposing to power off my desktop system if the keyboard battery happens to drain completely. That is unacceptable behaviour. I rectified it by manually editing settings-daemon power settings with dconf-editor, so the critical action was set to "nothing". (The regular power system settings GUI would NOT let me select this value, which is pretty strange.)

Here's what upower says:
$ upower -d
Device: /org/freedesktop/UPower/devices/battery_hid_00o07o61o76oC9oF1_battery
  native-path: /sys/devices/pci0000:00/0000:00:1d.2/usb8/8-1/8-1.1/8-1.1:1.0/bluetooth/hci0/hci0:11/0005:046D:B309.0002/power_supply/hid-00:07:61:76:C9:F1-battery
  model: Logitech diNovo Edge
  power supply: no
  updated: Wed Dec 5 12:15:38 2012 (27 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: discharging
    energy: 0 Wh
    energy-empty: 0 Wh
    energy-full: 0 Wh
    energy-full-design: 0 Wh
    energy-rate: 0 W
    percentage: 35%
    capacity: 100%

Daemon:
  daemon-version: 0.9.17
  can-suspend: yes
  can-hibernate no
  on-battery: no
  on-low-battery: no
  lid-is-closed: no
  lid-is-present: no
  is-docked: no

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: upower 0.9.17-1build1
ProcVersionSignature: Ubuntu 3.5.0-19.30-generic 3.5.7
Uname: Linux 3.5.0-19-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.6.1-0ubuntu8
Architecture: amd64
Date: Wed Dec 5 11:55:30 2012
InstallationDate: Installed on 2012-06-02 (185 days ago)
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
MarkForUpload: True
SourcePackage: upower
UpgradeStatus: Upgraded to quantal on 2012-12-04 (0 days ago)

Revision history for this message
Øyvind Stegard (oyvindstegard) wrote :
Revision history for this message
Øyvind Stegard (oyvindstegard) wrote :
Download full text (11.6 KiB)

While having apport collection info about upower, it made the kernel crash with nullpointer deref in kernel proc khidpd. Reboot failed, kernel was semi-hung afterwords. I suspect the crash might be triggered by reading/probing stuff about bluetooth or whatever. I have no time at the moment to report this as a separate bug, sorry. Traces appended below.

[ 1053.449584] ------------[ cut here ]------------
[ 1053.449593] WARNING: at /build/buildd/linux-3.5.0/fs/sysfs/dir.c:529 sysfs_add_one+0xca/0x100()
[ 1053.449595] Hardware name: P5E WS Pro
[ 1053.449596] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:1d.2/usb8/8-1/8-1.1/8-1.1:1.0/bluetooth/hci0/hci0:11'
[ 1053.449598] Modules linked in: joydev hidp parport_pc ppdev rfcomm bnep dm_crypt snd_hda_codec_hdmi kvm_intel kvm gpio_ich btusb microcode bluetooth nvidia(PO) snd_hda_codec_realtek snd_seq_midi serio_raw snd_rawmidi mceusb rc_core lpc_ich snd_seq_midi_event snd_seq asus_atk0110 snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq_device snd_timer mac_hid shpchp snd coretemp soundcore snd_page_alloc x38_edac edac_core lp parport hid_generic firewire_ohci firewire_core usbhid crc_itu_t hid pata_marvell sky2 usb_storage
[ 1053.449640] Pid: 62, comm: kworker/u:5 Tainted: P O 3.5.0-19-generic #30-Ubuntu
[ 1053.449642] Call Trace:
[ 1053.449648] [<ffffffff81051c1f>] warn_slowpath_common+0x7f/0xc0
[ 1053.449651] [<ffffffff81051d16>] warn_slowpath_fmt+0x46/0x50
[ 1053.449655] [<ffffffff811f2baa>] sysfs_add_one+0xca/0x100
[ 1053.449658] [<ffffffff811f2dd8>] create_dir+0x78/0xd0
[ 1053.449661] [<ffffffff811f3166>] sysfs_create_dir+0x86/0xe0
[ 1053.449665] [<ffffffff8132b14c>] kobject_add_internal+0x9c/0x220
[ 1053.449668] [<ffffffff813342c1>] ? vsnprintf+0x461/0x600
[ 1053.449672] [<ffffffff8108e116>] ? update_group_power+0x26/0x1c0
[ 1053.449675] [<ffffffff8132b607>] kobject_add+0x67/0xc0
[ 1053.449680] [<ffffffff8141cc66>] device_add+0x106/0x6c0
[ 1053.449683] [<ffffffff8141b4b1>] ? dev_set_name+0x41/0x50
[ 1053.449694] [<ffffffffa0bb4465>] hci_conn_add_sysfs+0x45/0x80 [bluetooth]
[ 1053.449702] [<ffffffffa0ba7550>] hci_conn_complete_evt.isra.47+0xd0/0x390 [bluetooth]
[ 1053.449709] [<ffffffffa0baa1e0>] hci_event_packet+0x1720/0x2580 [bluetooth]
[ 1053.449713] [<ffffffff8103fa39>] ? default_spin_lock_flags+0x9/0x10
[ 1053.449719] [<ffffffffa0b9e84b>] hci_rx_work+0x1bb/0x310 [bluetooth]
[ 1053.449724] [<ffffffff816830ae>] ? _raw_spin_lock+0xe/0x20
[ 1053.449727] [<ffffffff8107086a>] process_one_work+0x12a/0x420
[ 1053.449733] [<ffffffffa0b9e690>] ? hci_send_frame+0x90/0x90 [bluetooth]
[ 1053.449736] [<ffffffff8107140e>] worker_thread+0x12e/0x2f0
[ 1053.449739] [<ffffffff810712e0>] ? manage_workers.isra.26+0x200/0x200
[ 1053.449742] [<ffffffff81075f03>] kthread+0x93/0xa0
[ 1053.449746] [<ffffffff8168c624>] kernel_thread_helper+0x4/0x10
[ 1053.449749] [<ffffffff81075e70>] ? kthread_freezable_should_stop+0x70/0x70
[ 1053.449752] [<ffffffff8168c620>] ? gs_change+0x13/0x13
[ 1053.449754] ---[ end trace 9e712b7e826b5280 ]---
[ 1053.449756] ------------[ cut here ]------------
[ 1053.449760] WARNING: at /build/buildd/linux-3.5.0/lib/kobject.c:19...

Revision history for this message
Øyvind Stegard (oyvindstegard) wrote :

Looks like the kernel crash I reported above is actually bug 888828.

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

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

Changed in upower (Ubuntu):
status: New → Confirmed
Revision history for this message
Arnaud Thevenet (aeromousse) wrote :

Hello there,

I have this issue too.
Notice that with the Bluetooth USB dongle shipped with the keyboard, the "wrong" battery disappear and the keyboard is working fine.
So I am keeping the USB dongle plugged in, as Ubuntu do not work well with the laptop bluetooth device connected to the DiNovo Edge. With the dongle, I can let the bluetooth-wifi hard switch on, anyway. At least it does not interfere.

Revision history for this message
Marcos Sánchez (arkanus) wrote :

Please note problem also exists with other devices; i have a cheap bt mouse from DX and a Genius mouse/presenter both show the same behaviour descibed here.

Revision history for this message
David Morris (dmorris68) wrote :

Same problem with my Razer Pro|Click BT mouse on my Sony VAIO's built-in BT radio. This looks like a bug in the Unity battery applet, not in upowerd, but I could be wrong. upower-d displays the mouse battery with the proper device name and "no" to power supply (the laptop battery reports "yes" to power supply). But when I open the battery info app from Unity, it shows the mouse as a laptop battery. Not only that, but the "default" battery meter displayed in the Unity menu bar is for the mouse and NOT the laptop battery. So I have to click it to see the laptop's battery level.

Revision history for this message
Ralph Meijer (ralphmeijer) wrote :

I played around with several udev rules and inspected the upower source code. It appears that the kernel (in my case 3.7.0-7-generic) reports the device with the subsystem 'power_supply' with type 'Battery':

Dec 31 12:39:33 krijg kernel: [117903.350857] power_supply hid-00:07:61:F7:60:01-battery: driver failed to report `capacity' property: -5
Dec 31 12:39:38 krijg kernel: [117908.343434] power_supply hid-00:07:61:F7:60:01-battery: driver failed to report `capacity' property: -5
Dec 31 12:39:38 krijg kernel: [117908.364035] hid-generic 0005:046D:B309.0015: unknown main item tag 0x0
Dec 31 12:39:38 krijg kernel: [117908.404078] input: Logitech diNovo Edge as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/bluetooth/hci0/hci0:35/input32
Dec 31 12:39:38 krijg kernel: [117908.404346] hid-generic 0005:046D:B309.0015: input,hidraw0: BLUETOOTH HID v1.1b Mouse [Logitech diNovo Edge] on C4:85:08:47:23:C6

Reading the source code for ./linux/up-device-supply.c, it seems that upower doesn't expect CSR devices to be in the kernel, and therefore setting the kind as UP_DEVICE_KIND_BATTERY.

A udev rule like the following doesn't convince upower otherwise:

KERNEL=="hid-00:07:61:F7:60:01-battery", SUBSYSTEM=="power_supply", ENV{UPOWER_VENDOR}="Logitech, Inc.", ENV{UPOWER_PRODUCT}="diNovo Edge", ENV{UPOWER_BATTERY_TYPE}="keyboard"

Keng-Yu Lin (lexical)
tags: added: blocks-hwcert-enablement
Revision history for this message
Christer (christer-madsen) wrote :

For me, it affects me with the Lenovo Bluetooth Laser Mouse connected. There's no dongle, only connected to the internal bluetooth of my ThinkPad (it's a broadcom chip, but I don't think it's important). And sometimes, Ubuntu thinks that the battery is going dead, and shuts off!!! It's REALLY frustrating and unneccesary, because the laptop battery actually has 4-5 hours left of charge.... Also it displays the bluetooth mouse battery in the statusbar instead of the main battery, which is really strange and annoying.. I want Ubuntu to notify when BT mouse battery is getting low, but not turn off the computer by mistake :/ You know?

Revision history for this message
Christer (christer-madsen) wrote :

I'm having the EXACT same problem as David Morris three comments above!

Revision history for this message
Ralph Meijer (ralphmeijer) wrote :

@PnG: while this is marked as a duplicate of #1066208, I very much doubt it is, given its fix and my comments above (#8). The Logitech diNovo Edge is recognised as neither a keyboard nor a mouse in Raring's daily (12.10.6daily13.01.25-0ubuntu1) but as a laptop battery that is not a 'supply'. This device is primarily a keyboard with a small touch pad.

Besides that, upowerd doesn't seem to get the actual values right either. Fully charged it barely reaches 20%.

Revision history for this message
Gregoire Gentil (gregoire-gentil) wrote :

Here is an ugly patch that works for me (Logitech K810):

--- a/src/linux/up-device-supply.c 2013-06-08 15:07:46.161694077 -0700
+++ b/src/linux/up-device-supply.c 2013-06-08 15:07:05.665695138 -0700
@@ -867,6 +867,8 @@
   } else if (g_ascii_strcasecmp (device_type, "battery") == 0) {
    type = UP_DEVICE_KIND_BATTERY;
    supply->priv->is_power_supply = TRUE;
+gchar *device_name = up_device_supply_get_string (native_path, "model_name");
+if (device_name && ! g_ascii_strcasecmp (device_name, "Logitech K810")) goto out;
   } else if (g_ascii_strcasecmp (device_type, "USB") == 0) {

    /* use a heuristic to find the device type */

Revision history for this message
Olivier Bilodeau (plaxx) wrote :

Since this report is identified as a dupe of #1066208 and this issue is marked as fix released, I opened a new issue only regarding the keyboard battery being marked as a laptop battery: #1195840

Revision history for this message
Olivier Bilodeau (plaxx) wrote :

And of course I meant lp:1195840

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.