Bug 10772 - [appleir] Should use power_supply class to tell battery level
Summary: [appleir] Should use power_supply class to tell battery level
Status: CLOSED INVALID
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_input-devices
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-22 02:59 UTC by Bastien Nocera
Modified: 2010-01-19 17:51 UTC (History)
2 users (show)

See Also:
Kernel Version: Not yet merged
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Bastien Nocera 2008-05-22 02:59:18 UTC
The appleir driver was posted here:
http://thread.gmane.org/gmane.linux.kernel.input/4898

The patch shows that it only prints out a warning when the battery is running flat:
+	dev_err(&appleir->input_dev->dev, "possible flat battery?\n");

Instead, it should use power_supply class, so that the device's battery status can be propagated to user-space, and allow programs like gnome-power-manager to warn the user about the low-battery.
Comment 1 Dmitry Torokhov 2008-09-24 10:26:12 UTC
Is the userspace smart enough to distinguish between the main power source and somewhat uninteresting power supplys like this one and not try to shut down the box when power is low?
Comment 2 Bastien Nocera 2008-09-24 11:00:43 UTC
Of course it is. Otherwise we'd have been broken for a lot of other devices.
Comment 3 Richard Hughes 2010-01-19 17:42:57 UTC
(In reply to comment #2)
> Of course it is. Otherwise we'd have been broken for a lot of other devices.

DeviceKit-power supports lots of device types, and only does the shutdown logic on system devices like UPS and internal laptop battery.

I think it would be very simple to implement the power_supply class in this case.
Comment 4 Bastien Nocera 2010-01-19 17:51:56 UTC
FWIW, I reposted the appleir driver, and it wouldn't be possible to use the power_supply class, because the data is about the remote, not the receiver, and you can use whichever remote you fancy.

So you'd get data from one remote, and have no idea the other remote's battery was not dead. I'll use a kobject_uevent instead.

Note You need to log in before you can comment on or make changes to this bug.