Re: Generic battery interface

From: Greg KH
Date: Thu Jul 27 2006 - 18:59:03 EST


> > sysfs is great for demos from a shell prompt,
> > but isn't such a great programming interface, either
> > from inside the kernel or from user-space.

I would tend to dispute this point :)

> Anyone volunteers write battery layer? If so, I'd go with /dev/XXX,
> otherwise I'd go with /sys/XXX, because it is simpler to code, and I
> believe it is also good enough...

Please go with /sys/battery/batteryN/XXXX, not an ioctl filled /dev/
interface that can not easily be scripted.

That way it is extensable (if the specific battery type just doesn't
provide a specific functionality, that sysfs file will not be present),
it allows for polling if needed, and would unify all the different types
of batteries.

Look at the kind of documentation the hwmon and i2c people have
created[1] for how to specify sysfs interfaces for different types of
sensor devices. It should not be that hard to create the same for
something as "simple" as a battery :)

thanks,

greg k-h

[1] Documentation/hwmon/sysfs-interface
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/