[PATCH v2] Re: Battery class driver.

David Zeuthen davidz at redhat.com
Sat Oct 28 10:55:37 EDT 2006


On Sat, 2006-10-28 at 15:36 +0100, David Woodhouse wrote:
> On Sat, 2006-10-28 at 16:34 +0200, Shem Multinymous wrote:
> > * Thou shalt not export any attributes in sysfs except these, and
> >     with these units: */
> > 
> > Drivers *will* want to violate this. For example, the "inhibit
> > charging for N minutes" command on ThinkPads seems too arcane to be
> > worthy of generalization. I would add a more sensible boolean
> > "charging_inhibit" attribute to battery.h, and let the ThinkPad driver
> > implement it as well as it can. The driver will then expose a
> > non-stadard "charging_inhibit_minutes" attribute to reveal the finer
> > level of access to those who care.
> 
> If it makes enough sense that it's worth exporting it to userspace at
> all, then it can go into battery.h.

If it's non-standard please make sure to prefix the name with something
unique e.g.

 x_thinkpad_charging_inhibit [1]

to avoid collisions, e.g. two drivers using the same name but the
semantics are different. Over time the battery class can standardize on
this (if a feature becomes sufficiently common) and drivers can move
over if they want to.

    David

[1] : The x_ bit is inspired by how non standard email headers are
handled e.g. X-Mailer and whatever. It's a very useful hint to user
space people (and users in general) that some sysfs attribute is
non-standard. I was going to suggest to user a full reverse DNS style
naming scheme but I guess something that is unique enough will do.





More information about the Devel mailing list