Bug 5865

Summary: Wireless mouse battery level only shows up 30 seconds after plugged in
Product: hal Reporter: Anders Kaseorg <andersk>
Component: miscAssignee: David Zeuthen (not reading bugmail) <zeuthen>
Status: NEW --- QA Contact:
Severity: normal    
Priority: high CC: bugzilla
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: /usr/sbin/hald --verbose=yes --daemon=no

Description Anders Kaseorg 2006-02-12 07:07:54 UTC
I'm using HAL 0.5.6-1ubuntu3 (on Ubuntu Dapper), and I have a Logitech MX-1000
cordless mouse that reports battery information. When I first plug it in, I see
this in hal-device-manager:

battery.charge_level.design: 7
battery.charge_level.last_full: 7
battery.command_interface: csr
battery.csr.has_res: false
battery.csr.has_sms: false
battery.csr.is_dual: false
battery.is_rechargeable: true
battery.present: true
battery.type: mouse

However, only 30 seconds later do I actually get the current level:

battery.charge_level.current: 5
battery.charge_level.percentage: 71

This is confusing gnome-power-manager into thinking that its level is always 0%
unless I start g-p-m at least 30 seconds after plugging in the mouse. (Before
<http://bugzilla.gnome.org/show_bug.cgi?id=330156> was fixed, this made g-p-m
shut down my computer because of the "critical" battery level!)
Comment 1 Anders Kaseorg 2006-02-12 07:18:40 UTC
I also filed a bug for g-p-m <http://bugzilla.gnome.org/show_bug.cgi?id=330822>,
but I don't see why HAL can't begin reporting the battery level immediately.
Comment 2 Richard Hughes 2006-02-12 07:34:08 UTC
Can you attach the output of:

killall hald
/usr/sbin/hald --retain-privileges --verbose=yes --daemon=no

Many thanks, Richard.
Comment 3 Anders Kaseorg 2006-02-12 11:49:32 UTC
Created attachment 4599 [details]
/usr/sbin/hald --verbose=yes --daemon=no

I've attached the output of /usr/sbin/hald --verbose=yes --daemon=no. (It
doesn't recognize --retain-privileges or any similar option.) Here are the
parts that look relevant:

19:44:14.281 [I] physdev.c:1457: phys_add: subsys=pci
sysfs_path=/sys/devices/pci0000:00/0000:00:1d.1, parent=0x00000000
19:44:14.295 [I] physdev.c:1382: Add callouts completed
udi=/org/freedesktop/Hal/devices/pci_8086_24c4
19:44:14.295 [I] hald.c:82: Added device to GDL;
udi=/org/freedesktop/Hal/devices/pci_8086_24c4
19:44:14.295 [I] classdev.c:1373: class_add: subsys=usb_host
sysfs_path=/sys/class/usb_host/usb_host2 dev= physdev=0x080c0708
19:44:14.296 [I] physdev.c:1457: phys_add: subsys=usb
sysfs_path=/sys/devices/pci0000:00/0000:00:1d.1/usb2, parent=0x080c0708
19:44:14.307 [I] physdev.c:1382: Add callouts completed
udi=/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_1d_1
19:44:14.307 [I] hald.c:82: Added device to GDL;
udi=/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_1d_1
19:44:14.307 [I] classdev.c:1373: class_add: subsys=usb_device
sysfs_path=/sys/class/usb_device/usbdev2.1 dev=/dev/bus/usb/002/001
physdev=0x080c0720
19:44:14.316 [I] classdev.c:1236: Add callouts completed
udi=/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_1d_1_usbraw
19:44:14.316 [I] hald.c:82: Added device to GDL;
udi=/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_1d_1_usbraw
19:44:14.316 [I] physdev.c:1457: phys_add: subsys=usb
sysfs_path=/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1, parent=0x080c0720
19:44:14.317 [E] util.c:463: Cannot open
'/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/serial'
19:44:14.317 [E] util.c:463: Cannot open
'/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/serial'
19:44:14.323 [I] device_info.c:1429: *** Matched file
/usr/share/hal/fdi/information/10freedesktop/10-wireless-mice.fdi
19:44:14.326 [I] physdev.c:1382: Add callouts completed
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
19:44:14.326 [I] hald.c:82: Added device to GDL;
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
28991: 19:44:14.331: addon-usb-csr.c:269:
device:[/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial]
19:44:14.332 [I] hald.c:95: Started addon hald-addon-usb-csr for udi
/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
19:44:14.332 [I] classdev.c:1373: class_add: subsys=usb_device
sysfs_path=/sys/class/usb_device/usbdev2.22 dev=/dev/bus/usb/002/022
physdev=0x080c0750
19:44:14.342 [I] classdev.c:1236: Add callouts completed
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial_usbraw
19:44:14.342 [I] hald.c:82: Added device to GDL;
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial_usbraw
19:44:14.343 [I] physdev.c:1457: phys_add: subsys=usb
sysfs_path=/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0,
parent=0x080c0750
19:44:14.352 [I] physdev.c:1382: Add callouts completed
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial_if0
19:44:14.352 [I] hald.c:82: Added device to GDL;
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial_if0
19:44:14.352 [I] classdev.c:1373: class_add: subsys=input
sysfs_path=/sys/class/input/input23/ts1 dev=/dev/input/ts1 physdev=0x080c0780
28992: 19:44:14.356: probe-input.c:169: Doing probe-input for /dev/input/ts1
(udi=/org/freedesktop/Hal/devices/temp/58)
28992: 19:44:14.356: probe-input.c:181: Error: EVIOCGID failed: Invalid
argument

19:44:14.357 [I] hald_dbus.c:2988: 28983: Got a connection
19:44:14.357 [I] hald_dbus.c:2989: dbus_connection_get_is_connected = 1
19:44:14.357 [I] hald_dbus.c:2988: 28983: Got a connection
19:44:14.357 [I] hald_dbus.c:2989: dbus_connection_get_is_connected = 1
19:44:14.358 [I] classdev.c:1293: entering; exit_type=0, return_code=1
19:44:14.358 [I] classdev.c:1373: class_add: subsys=input
sysfs_path=/sys/class/input/input23/event2 dev=/dev/input/event2
physdev=0x080c0780
28993: 19:44:14.362: probe-input.c:169: Doing probe-input for /dev/input/event2
(udi=/org/freedesktop/Hal/devices/temp/59)
19:44:14.363 [I] hald_dbus.c:2988: 28983: Got a connection
19:44:14.363 [I] hald_dbus.c:2989: dbus_connection_get_is_connected = 1
19:44:14.363 [I] hald_dbus.c:2988: 28983: Got a connection
19:44:14.363 [I] hald_dbus.c:2989: dbus_connection_get_is_connected = 1
19:44:14.364 [I] hald_dbus.c:2950: local_server_message_handler:
destination=(null) obj_path=/org/freedesktop/DBus/Local
interface=org.freedesktop.DBus.Local method=Disconnected
19:44:14.364 [I] hald_dbus.c:2966: Client to local_server was disconnected
19:44:14.364 [I] hald_dbus.c:2976: unregistered
19:44:14.364 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=SetPropertyBoolean
19:44:14.364 [D] hald_dbus.c:1192:
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial,
key=battery.present
19:44:14.365 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=PropertyExists
19:44:14.365 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=SetPropertyInteger
19:44:14.366 [D] hald_dbus.c:1192:
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial,
key=battery.charge_level.design
19:44:14.366 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=SetPropertyInteger
19:44:14.366 [D] hald_dbus.c:1192:
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial,
key=battery.charge_level.last_full
19:44:14.367 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=SetPropertyString
19:44:14.367 [D] hald_dbus.c:1192:
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial,
key=info.category
19:44:14.367 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=SetPropertyString
19:44:14.367 [D] hald_dbus.c:1192:
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial,
key=battery.command_interface
19:44:14.368 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=PropertyExists
19:44:14.368 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=GetPropertyInteger
19:44:14.369 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=PropertyExists
19:44:14.369 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=GetPropertyInteger
19:44:14.370 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=PropertyExists
19:44:14.370 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=GetPropertyBoolean
19:44:14.371 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=PropertyExists
28991: 19:44:14.371: addon-usb-csr.c:303: ** Initial fillup done
28991: 19:44:14.371: addon-usb-csr.c:206: ** Check batteries
28991: 19:44:14.372: addon-usb-csr.c:123: CSR device:
[/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial]
28991: 19:44:14.372: addon-usb-csr.c:127: Is dual: 0
28991: 19:44:14.372: addon-usb-csr.c:180: Looking for: [002][022]
28991: 19:44:14.372: addon-usb-csr.c:196: Matched device: [002][022][046D:C50E]

19:44:14.372 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal obj_path=/org/freedesktop/Hal/devices/temp/59
interface=org.freedesktop.Hal.Device method=SetPropertyString
19:44:14.372 [D] hald_dbus.c:1192: udi=/org/freedesktop/Hal/devices/temp/59,
key=info.product
19:44:14.373 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal obj_path=/org/freedesktop/Hal/devices/temp/59
interface=org.freedesktop.Hal.Device method=SetPropertyString
19:44:14.373 [D] hald_dbus.c:1192: udi=/org/freedesktop/Hal/devices/temp/59,
key=input.product
missing x or y absolute axes
19:44:14.373 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal obj_path=/org/freedesktop/Hal/devices/temp/59
interface=org.freedesktop.Hal.Device method=AddCapability
19:44:14.374 [I] classdev.c:1293: entering; exit_type=0, return_code=0
28991: 19:44:14.375: addon-usb-csr.c:149: Charge level: 0->5
19:44:14.384 [I] classdev.c:1236: Add callouts completed
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial_if0_logicaldev_input

19:44:14.384 [I] hald.c:82: Added device to GDL;
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial_if0_logicaldev_input

19:44:14.385 [I] classdev.c:1373: class_add: subsys=input
sysfs_path=/sys/class/input/input23/mouse1 dev=/dev/input/mouse1
physdev=0x080c0780
28994: 19:44:14.390: probe-input.c:169: Doing probe-input for /dev/input/mouse1
(udi=/org/freedesktop/Hal/devices/temp/60)
28994: 19:44:14.390: probe-input.c:181: Error: EVIOCGID failed: Inappropriate
ioctl for device

19:44:14.390 [I] hald_dbus.c:2950: local_server_message_handler:
destination=(null) obj_path=/org/freedesktop/DBus/Local
interface=org.freedesktop.DBus.Local method=Disconnected
19:44:14.390 [I] hald_dbus.c:2966: Client to local_server was disconnected
19:44:14.390 [I] hald_dbus.c:2976: unregistered
19:44:14.391 [I] hald_dbus.c:2988: 28983: Got a connection
19:44:14.391 [I] hald_dbus.c:2989: dbus_connection_get_is_connected = 1
19:44:14.391 [I] classdev.c:1293: entering; exit_type=0, return_code=1
19:44:14.391 [I] classdev.c:1373: class_add: subsys=input
sysfs_path=/sys/class/input/input23 dev= physdev=0x080c0780
19:44:14.393 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=SetPropertyInteger
19:44:14.393 [D] hald_dbus.c:1192:
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial,
key=battery.charge_level.current
19:44:14.394 [I] hald_dbus.c:2950: local_server_message_handler:
destination=(null) obj_path=/org/freedesktop/DBus/Local
interface=org.freedesktop.DBus.Local method=Disconnected
19:44:14.394 [I] hald_dbus.c:2966: Client to local_server was disconnected
19:44:14.394 [I] hald_dbus.c:2976: unregistered
19:44:14.394 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=SetPropertyInteger
19:44:14.394 [D] hald_dbus.c:1192:
udi=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial,
key=battery.charge_level.percentage
19:44:14.394 [I] hald_dbus.c:2950: local_server_message_handler:
destination=org.freedesktop.Hal
obj_path=/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial
interface=org.freedesktop.Hal.Device method=AddCapability
28995: 19:44:14.397: probe-input.c:169: Doing probe-input for 
(udi=/org/freedesktop/Hal/devices/temp/61)
28995: 19:44:14.398: probe-input.c:173: Cannot open : No such file or directory

19:44:14.398 [I] hald_dbus.c:2988: 28983: Got a connection
19:44:14.398 [I] hald_dbus.c:2989: dbus_connection_get_is_connected = 1
19:44:14.398 [I] classdev.c:1293: entering; exit_type=0, return_code=1
19:44:14.399 [I] physdev.c:1457: phys_add: subsys=usb
sysfs_path=/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0, parent=0x080c0720

19:44:14.408 [I] physdev.c:1382: Add callouts completed
udi=/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_1d_1_if0
19:44:14.408 [I] hald.c:82: Added device to GDL;
udi=/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_1d_1_if0
[...]
28991: 19:44:44.395: addon-usb-csr.c:206: ** Check batteries
28991: 19:44:44.396: addon-usb-csr.c:123: CSR device:
[/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial]
28991: 19:44:44.396: addon-usb-csr.c:127: Is dual: 0
28991: 19:44:44.396: addon-usb-csr.c:180: Looking for: [002][022]
28991: 19:44:44.396: addon-usb-csr.c:196: Matched device: [002][022][046D:C50E]

28991: 19:44:44.400: addon-usb-csr.c:149: Charge level: 5->5
[...]
28991: 19:45:14.396: addon-usb-csr.c:206: ** Check batteries
28991: 19:45:14.397: addon-usb-csr.c:123: CSR device:
[/org/freedesktop/Hal/devices/usb_device_46d_c50e_noserial]
28991: 19:45:14.397: addon-usb-csr.c:127: Is dual: 0
28991: 19:45:14.397: addon-usb-csr.c:180: Looking for: [002][022]
28991: 19:45:14.397: addon-usb-csr.c:196: Matched device: [002][022][046D:C50E]

28991: 19:45:14.401: addon-usb-csr.c:149: Charge level: 5->5
[...]
Comment 4 Bastien Nocera 2006-03-26 10:53:00 UTC
I think that the battery level reporting is broken on the HAL side. In lmctl:
                printf ("\tBattery status: %d ", P5 & 0x07);
                switch (P5 & 0x07) {
                case 0: printf ("(unavailable)\n"); break;
                case 1:
                case 2: printf ("(critical)\n"); break;
                case 3:
                case 4: printf ("(low)\n"); break;
                case 5:
                case 6: printf ("(good)\n"); break;
                case 7: printf ("(full)\n"); break;
in the csr addon:
                                if (current_charge != 0)
                                        percentage = (100.0 / 7.0) * current_charge;

0 means unavailable, not empty (well, it might be unavailable because it's
empty, but that would only be useful if the previous level was non-zero). Makes
sense Richard?
Comment 5 chemtech 2013-03-15 13:58:42 UTC
Anders Kaseorg 
Do you still experience this issue with newer drivers ?
Please check the status of your issue.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.