Re: [patch/rfc 2.6.25-git] gpio: sysfs interface

From: Ben Nizette
Date: Wed Apr 30 2008 - 06:34:03 EST



On Tue, 2008-04-29 at 20:13 -0700, Trent Piepho wrote:
> On Wed, 30 Apr 2008, Ben Nizette wrote:
> >
> > So you're suggesting that the gpio-N links and control file live inside
> > the gpiochip-X folder along with info about the chip to which they're
> > attached? I don't mind this, sounds good. Certainly feels most
> > sysfsish.
> >
> > Scripting would be pretty simple assuming there's one control file per
> > chip and the gpio number written to said control file is relative to
> > that chip's base. i.e. finding pcf9557:5 (assuming only one such
> > device) would just be
> >
> > - find the gpiochip-X folder whose /label == pcf9557
> > - echo "export 5" > <that_folder>/control
> > - read/write <that_folder>/gpio-5/{value,direction}
>
> I don't suppose you could actually write the code to do this?
>
> I already wrote the code, and am using it, for the way I have it work.
>
> cat /sys/class/gpio/pcf9557-0:5
>
> But I guess this is too easy. "We can't have any of that!! The Earth will
> turn in its grave! And Slashdot will be decorated in Pink! Teh End Daze
> arrive! :)"
>

I'm sure I could but I'd prefer to have us all come (as close as
possible) to an agreed theoretical interface first :-)

What you've got working there is nice but it still downsides (unless you
can set me straight). First, we still have the problem of either 100s
of unused files or an index to use in a request. Also, if you've got
many pcf9557s in a system you'll have a bunch of pcf9557-n; how do you
know which is which?

I think with the above solution we're coming very close to a sexy
system. We don't need an index file, we have all the information we
need to find which device is which, there's no need to calculate any
full gpio number, there's no files which aren't going to be used, it's
safe, extensible, scriptable, sysfsish.. Am I missing anything?

--Ben
--
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/