* iio A/D converter input to input event subsystem
@ 2014-08-02 18:14 gmane
2014-08-03 9:56 ` Alexandre Belloni
0 siblings, 1 reply; 6+ messages in thread
From: gmane @ 2014-08-02 18:14 UTC (permalink / raw)
To: linux-iio
Hi,
I would like to use a couple of resistors and keys and one Analog
input[1], read the analogue voltage from a kernel driver, figure out
which key is pressed and pass this on to the Linux input subsystem. (Am
I really the only one with this use case?)
In my specific case it's about a beagle bone black, which means that the
A/D driver is an iio adc driver[2].
How would it be possible to reuse the iio A/D converter driver code for
my driver? Maybe it would even be possible to create something more
generic so iio A/D converter channels could be used as input keys. Some
sample code which would enable me to choose an analog input and read
from it from kernel space would help me to write some basic sample
driver, I guess.
The reason I would like to write a device driver instead of a user space
application is mainly the input subsystem. From the user space
application's point of view utilizing a device driver which feeds the
input subsystem would make it easy to exchange what's underneath without
user space even noticing. (keys to Input pins, a key matrix to I/O pins,
i2c input, A/D converter,...).
Regards,
Robert
[1]
http://21stdigitalhome.blogspot.gr/2013/11/sensing-switches-on-analog-input.html
[2]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/adc/ti_am335x_adc.c?id=refs/tags/v3.16-rc7
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: iio A/D converter input to input event subsystem
2014-08-02 18:14 iio A/D converter input to input event subsystem gmane
@ 2014-08-03 9:56 ` Alexandre Belloni
2014-08-03 15:08 ` gmane
0 siblings, 1 reply; 6+ messages in thread
From: Alexandre Belloni @ 2014-08-03 9:56 UTC (permalink / raw)
To: gmane; +Cc: linux-iio
Hi Robert,
On 02/08/2014 at 13:14:30 -0500, gmane@reliableembeddedsystems.com wrote :
> Hi,
>
> I would like to use a couple of resistors and keys and one Analog
> input[1], read the analogue voltage from a kernel driver, figure out
> which key is pressed and pass this on to the Linux input subsystem.
> (Am I really the only one with this use case?)
>
> In my specific case it's about a beagle bone black, which means that
> the A/D driver is an iio adc driver[2].
>
> How would it be possible to reuse the iio A/D converter driver code
> for my driver? Maybe it would even be possible to create something
> more generic so iio A/D converter channels could be used as input
> keys. Some sample code which would enable me to choose an analog
> input and read from it from kernel space would help me to write some
> basic sample driver, I guess.
>
> The reason I would like to write a device driver instead of a user
> space application is mainly the input subsystem. From the user space
> application's point of view utilizing a device driver which feeds
> the input subsystem would make it easy to exchange what's underneath
> without user space even noticing. (keys to Input pins, a key matrix
> to I/O pins, i2c input, A/D converter,...).
>
Did you have a look at uinput? This would allow you to inject input
events after processing the ADC values in userspace.
Simple example: http://thiemonge.org/getting-started-with-uinput
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: iio A/D converter input to input event subsystem
2014-08-03 9:56 ` Alexandre Belloni
@ 2014-08-03 15:08 ` gmane
2014-08-03 15:43 ` Jonathan Cameron
0 siblings, 1 reply; 6+ messages in thread
From: gmane @ 2014-08-03 15:08 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-iio
Hi,
On 2014-08-03 04:56, Alexandre Belloni wrote:
> Hi Robert,
>
> Did you have a look at uinput? This would allow you to inject input
> events after processing the ADC values in userspace.
>
> Simple example: http://thiemonge.org/getting-started-with-uinput
Thanks this looks interesting. I had in the meantime a look at iio_hwmon
[1] which does something similar to what I want for the hwmon subsystem
instead of the input event subsystem.
Regards,
Robert
[1]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/hwmon/iio_hwmon.c?id=refs/tags/v3.16-rc7
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: iio A/D converter input to input event subsystem
2014-08-03 15:08 ` gmane
@ 2014-08-03 15:43 ` Jonathan Cameron
2014-08-03 16:39 ` gmane
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2014-08-03 15:43 UTC (permalink / raw)
To: gmane, Alexandre Belloni; +Cc: linux-iio
On 03/08/14 16:08, gmane@reliableembeddedsystems.com wrote:
> Hi,
>
> On 2014-08-03 04:56, Alexandre Belloni wrote:
>> Hi Robert,
>
>>
>> Did you have a look at uinput? This would allow you to inject input
>> events after processing the ADC values in userspace.
>>
>> Simple example: http://thiemonge.org/getting-started-with-uinput
>
> Thanks this looks interesting. I had in the meantime a look at iio_hwmon [1] which does something similar to what I want
> for the hwmon subsystem instead of the input event subsystem.
There is a rather aged iio_input driver, that uses the buffered interface (not polled)
and could probably be adapted to your usecase reasonably easily. The case is different enough
that I'd probably suggest a new driver for it though rather than trying to blugeon it into
the existing driver.
http://www.spinics.net/lists/linux-iio/msg06881.html (latest version I think).
The infrastructure for this went in back then, but the input driver never quite got the
attention it needed.
One big issue outstanding around this stuff is that no one likes the device
tree bindings. Probably doesn't matter for your project in the short term however!
Jonathan
>
> Regards,
>
> Robert
>
> [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/hwmon/iio_hwmon.c?id=refs/tags/v3.16-rc7
=
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: iio A/D converter input to input event subsystem
2014-08-03 15:43 ` Jonathan Cameron
@ 2014-08-03 16:39 ` gmane
2014-08-03 20:43 ` Jonathan Cameron
0 siblings, 1 reply; 6+ messages in thread
From: gmane @ 2014-08-03 16:39 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Alexandre Belloni, linux-iio
Hi,
On 2014-08-03 10:43, Jonathan Cameron wrote:
>
> http://www.spinics.net/lists/linux-iio/msg06881.html (latest version I
> think).
> The infrastructure for this went in back then, but the input driver
> never quite got the
> attention it needed.
Thanks!
I'll try to have some hardware prototype by end of August and will see
if I can get my stuff to work as Alexandre suggested.
Ideally I'll try to cook up something similar to your iio_input stuff.
Which mainline kernel version would you suggest?
3.14 or 3.16?
Regards,
Robert
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: iio A/D converter input to input event subsystem
2014-08-03 16:39 ` gmane
@ 2014-08-03 20:43 ` Jonathan Cameron
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2014-08-03 20:43 UTC (permalink / raw)
To: gmane; +Cc: Alexandre Belloni, linux-iio
On 03/08/14 17:39, gmane@reliableembeddedsystems.com wrote:
> Hi,
>
> On 2014-08-03 10:43, Jonathan Cameron wrote:
>>
>> http://www.spinics.net/lists/linux-iio/msg06881.html (latest version I think).
>> The infrastructure for this went in back then, but the input driver
>> never quite got the
>> attention it needed.
>
> Thanks!
>
> I'll try to have some hardware prototype by end of August and will see if I can get my stuff to work as Alexandre
> suggested.
>
> Ideally I'll try to cook up something similar to your iio_input stuff.
>
> Which mainline kernel version would you suggest?
> 3.14 or 3.16?
Always as recent as possible. Anything else makes getting support
from anyone tricky as no one can remember how it used to work :)
Jonathan
>
> Regards,
>
> Robert
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-08-03 20:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-02 18:14 iio A/D converter input to input event subsystem gmane
2014-08-03 9:56 ` Alexandre Belloni
2014-08-03 15:08 ` gmane
2014-08-03 15:43 ` Jonathan Cameron
2014-08-03 16:39 ` gmane
2014-08-03 20:43 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).