Re: [PATCH RFC] hid-input: add support for HID devices reporting Battery Strength

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/23/2011 08:36 AM, Chase Douglas wrote:
> On 11/23/2011 12:49 AM, Jeremy Fitzhardinge wrote:
>> Some HID devices, such as my Bluetooth mouse, report their battery
>> strength as an event.  Rather than passing it through as a strange
>> absolute input event, this patch registers it with the power_supply
>> subsystem as a battery, so that the device's Battery Strength can be
>> reported to usermode.
>>
>> The battery appears in sysfs names
>> /sys/class/power_supply/hid-<UNIQ>-battery, and it is a child of the
>> battery-containing device, so it should be clear what it's the battery of.
>>
>> Unfortunately on my current Fedora 16 system, while the battery does
>> appear in the UI, it is listed as a Laptop Battery with 0% charge (since
>> it ignores the "capacity" property of the battery and instead computes
>> it from the "energy*" fields, which we can't supply given the limited
>> information contained within the HID Report).
>>
>> Still, this patch is the first step.
>>
>> Signed-off-by: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
>>
>> diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
>> index 22a4a05..3a97f1f 100644
>> --- a/drivers/hid/Kconfig
>> +++ b/drivers/hid/Kconfig
>> @@ -31,6 +31,11 @@ config HID
>>  
>>  	  If unsure, say Y.
>>  
>> +config HID_BATTERY_STRENGTH
>> +	bool
>> +	depends on POWER_SUPPLY
>> +	default y
> This functionality will be great to have :). I'm curious why you made a
> config option for it, though. It's not a big patch, I can't think of any
> reason people wouldn't want it, and this could lead to dependency issues
> (i.e. needing to sprinkle #ifdef HID_BATTERY_STRENGTH in drivers).
>

It depends on CONFIG_POWER_SUPPLY, and I guess its possible that people
may want to unconfig it because the extra power supplies confuse
usermode (as they do Gnome 3, but non-fatally).  I'm just worried that
something might want to start hibernating my machine because the mouse
is running out :/...

However, I left it as a non-user-visible config option so that it
doesn't create any more noise on that front.

The Wacom driver's version of this also has its own user-visible config
option; I don't know if there's any reason you'd turn it off.

    J
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux