From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Fitzhardinge Subject: Re: [GIT PULL RFC] directly poll battery strength when reading power_supply Date: Tue, 06 Dec 2011 09:10:18 -0800 Message-ID: <4EDE4C7A.1010802@goop.org> References: <4EC75224.7070207@goop.org> <4EC820F8.4070900@goop.org> <4ECA7E7D.80207@goop.org> <4ECAE019.4000409@goop.org> <4ECCB38A.8000503@goop.org> <4ED90E6D.8090402@goop.org> <4ED9BDF8.3010600@goop.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: Received: from claw.goop.org ([74.207.240.146]:54214 "EHLO claw.goop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751797Ab1LFRZw (ORCPT ); Tue, 6 Dec 2011 12:25:52 -0500 In-Reply-To: Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Richard Hughes Cc: Daniel Nicoletti , linux-input@vger.kernel.org, Jiri Kosina , vojtech@ucw.cz, Przemo Firszt , Richard Hughes , Anton Vorontsov , David Woodhouse On 12/06/2011 01:56 AM, Richard Hughes wrote: > On 3 December 2011 06:13, Jeremy Fitzhardinge wrote: >> The only functional change I made from Daniel's patch is keeping the power_supply type as BATTERY rather >> than USB. > How is upower supposed to know that the device is: > > a) a mouse > b) not powering the computer > > Any ideas welcome. I suppose we could look at the hid device, but this > seems like a hack. Thanks. (CC power_supply maintainers: the discussion is how to represent power_supplies for self-powered HID devices like wireless mice.) I've been thinking about this. I think the obvious fix is that the power_supply should have a link to the root of the device tree it powers. So the system battery and line power should point to the root, whereas a battery powered device would point to itself. Something like HID UPS would appear to be in the middle of the USB devices, but actually powers the whole machine (or more). In other words, the power_supply device is the management interface for the power supply, and it appears in the device tree wherever it was detected, but that location only has a vague and implicit relationship with the hardware it actually powers; it needs another attribute to explicitly denote that information. And if the device being pointed to is a mouse, then upower knows its powering a mouse. I'll look at putting together a patch to see if my suggestion makes any sense in practice. Thanks, J