From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Subject: Re: Generic battery interface Date: Thu, 27 Jul 2006 15:56:45 -0700 Message-ID: <20060727225645.GB23195@kroah.com> References: <20060727221632.GE3797@elf.ucw.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from ns2.suse.de ([195.135.220.15]:41394 "EHLO mx2.suse.de") by vger.kernel.org with ESMTP id S1751425AbWG0XBJ (ORCPT ); Thu, 27 Jul 2006 19:01:09 -0400 Content-Disposition: inline In-Reply-To: <20060727221632.GE3797@elf.ucw.cz> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Pavel Machek Cc: "Brown, Len" , Shem Multinymous , Matthew Garrett , vojtech@suse.cz, kernel list , linux-thinkpad@linux-thinkpad.org, linux-acpi@vger.kernel.org > > 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