Amazing – HAL actually useful for something

The battery in my laptop (Dell XPS M1530) died a week or so ago, and yesterday I finally organised to get a new one, which arrived this morning. Yay ebay and AusPost or something.

Since the laptop lives downstairs, I figured it would be nice to see if I could check on the status from upstairs, as needed. In the distant past Casper had some ACPI-related utils which worked quite nicely on AMD systems, but they’ve been deprecated for quite some time now. A quick q into an internal channel put me onto the /usr/sbin/lshal utility, which lets me run this command:

/usr/sbin/lshal -l -u '/org/freedesktop/Hal/devices/pseudo/acpi_drv_0_battery0_0'

And produces output like this:

udi = ‘/org/freedesktop/Hal/devices/pseudo/acpi_drv_0_battery0_0′
  battery.reporting_last_full = 5943  (0×1737)  (int)
  battery.remaining_time = 0  (0×0)  (int)
  battery.charge_level.percentage = 100  (0×64)  (int)
  battery.charge_level.current = 65967  (0x101af)  (int)
  battery.charge_level.last_full = 65967  (0x101af)  (int)
  battery.charge_level.rate = 0  (0×0)  (int)
  battery.voltage.present = 12543  (0x30ff)  (int)
  battery.reporting.rate = 355  (0×163)  (int)
  battery.reporting.current = 6600  (0x19c8)  (int)
  battery.rechargeable.is_discharging = false  (bool)
  battery.rechargeable.is_charging = false  (bool)
  battery.is_rechargeable = true  (bool)
  battery.charge_level.granularity_2 = 732  (0x2dc)  (int)
  battery.charge_level.granularity_1 = 732  (0x2dc)  (int)
  battery.charge_level.low = 2220  (0x8ac)  (int)
  battery.charge_level.warning = 7326  (0x1c9e)  (int)
  battery.charge_level.design = 73260  (0x11e2c)  (int)
  battery.charge_level.unit = ‘mWh’  (string)
  battery.voltage.design = 11100  (0x2b5c)  (int)
  battery.reporting.granularity_2 = 66  (0×42)  (int)
  battery.reporting.granularity_1 = 66  (0×42)  (int)
  battery.reporting.low = 200  (0xc8)  (int)
  battery.reporting.warning = 660  (0×294)  (int)
  battery.reporting.design = 6600  (0x19c8)  (int)
  battery.reporting.last_full = 5943  (0×1737)  (int)
  battery.reporting.unit = ‘mAh’  (string)
  battery.model = ‘DELL 00′  (string)
  battery.serial = ’3213′  (string)
  battery.technology = ‘lithium-ion’  (string)
  battery.reporting.technology = ‘LION’  (string)
  battery.vendor = ”  (string)
  info.capabilities = {‘battery’} (string list)
  battery.type = ‘primary’  (string)
  battery.present = true  (bool)
  info.category = ‘battery’  (string)
  info.solaris.driver = ‘acpi_drv’  (string)
  solaris.devfs_path = ‘/pseudo/acpi_drv@0:battery0′  (string)
  info.product = ‘Battery Bay’  (string)
  info.udi = ‘/org/freedesktop/Hal/devices/pseudo/acpi_drv_0_battery0_0′  (string)
  info.parent = ‘/org/freedesktop/Hal/devices/pseudo/acpi_drv_0_0′  (string)

Finally – a non-annoying thing to do with HAL!