> Whoever comes up with a cleaner sysfs or a clean device interface
> will win the argument and lock the path for the other approach.
> It's like a forking path with no going back or something.

Can't we just do it a bit like v4l2 does it?
E.g. an open /dev/gpio and then an ioctl which queries all chips with
io-pins, then after you select such a chip (e.g. the cubieboard has
chip a-f iirc), an ioctl which lists the number of pins and then one
that retrieves the number of parameters and then for each parameter
another ioctl that 
well:

- open /dev/gpio
- ioctl to obtain the number of gpio chips
- ioctl to iterate the chips
  - this could return a symbol name, e.g. "A"-"F" or e.g. "north",
    whatever
  - description
  - if it supports hardware interrupts(!)
  - get number of parameters for the chip
  - iterate parameters of the chip
    - get
    - set
  - get maximum number of pins that can be high (?)
- ioctl to select a chip
- ioctl to retrieve number of pins per chip
- ioctl to iterate the pins of a chip
- ioctl to select a pin
- ioctl to get the number of knobs on a pin
- ioctl to iterate the parameters
  they could be
        - set direction
        - set value
        - set trigger
        - has hardware interrupt
        - enable pps (!), preferably with a name override because
          /dev/ppsX is not helpful

Now after you've selected a pin and selected a trigger you could do a
select()/poll() that waits until the trigger is triggered with
auto-reset of that trigger (or maybe make that selectable as well).
POLLIN then says; we had a trigger, POLLERR the chip was removed (or
POLLHUP?).

Oh and please as low latency for the select()/poll() as possible :-)


Folkert van Heusden

-- 
You've probably gotten really fed up with never winning in the Mega-
Millions lottery. Well, weep no longer: www.smartwinning.info tells
you everything that might help you deciding what numbers to choose.
With nice graphs and pretty animations!
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to