2010-09-08 07:47:39 GPIO input events and input query
Rob Maris (GERMANY)
Message: 93259
In my board file, some GPIO pins are assigned to the input event handler, in order to have (e.g.) key codes generated upon change of logic input leve.
However, for some purposes, the static state of the input must be queried (e.g. after power-up). GPIO sysfs interface does not allow this for inputs already assigned. How should I arrange this, if possible?
-Rob
QuoteReplyEditDelete
2010-09-08 11:31:10 Re: GPIO input events and input query
Mike Frysinger (UNITED STATES)
Message: 93266
you could not load the driver, use the gpio sysfs, then load the driver ...
QuoteReplyEditDelete
2010-09-15 12:18:58 Re: GPIO input events and input query
Rob Maris (GERMANY)
Message: 93468
To be precise: I'm using gpio-keys and collect key codes through tty raw mode. Part of the problem was that an active input during power-up or reboot was not known as such, but more troublesome: when this input was released while the app is running, the release event was not detected. This was the case with my production state linux (2.6.28.9). Current gpio-keys has solved this problem because of extra code for this in gpio_keys_probe().
Detecting initial state is now established as follows:
The C-application software opens /dev/tty0 (and sets raw mode via ioctl).
After this, application does modprobe gpio-keys.
Then, all inputs that are already '1' wil send an event. At that time the app has all initial input states mapped correctly.
General remark: gpio-keys now provides quite extensive support to modify behaviour in runtime, exactly through:
/sys/devices/platform/gpio-keys.0/
....keys
....disabled_keys etc.
Should it be possible to add extra sysfs stuff that allows query of input state, e.g.
cat /sys/devices/platform/gpio-keys.0/key5/level,
I'd consider this an effort worth doing, together with set active_low attribute (with the same list syntax as documented), since this could help reduce dependency of board-file presets.
QuoteReplyEditDelete
2010-09-15 13:12:21 Re: GPIO input events and input query
Mike Frysinger (UNITED STATES)
Message: 93469
i dont see a question here, so i guess you've figured out your troubles ?