How is gpio_keys.ko supposed to work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have a userland application on Raspberry Pi which uses select to read
input from a button connected to gpio like this:

GPIO --+---- BUTTON ----- GND
       |
       +--- RESISTOR 2k -- VCC (3.3V)

The sysfs "file" I use select at is /sys/class/gpio/gpioX/value with the
method found in Documentation/gpio.txt.

However, this same file also states the following:
Note that standard kernel drivers exist for common "LEDs and Buttons"
GPIO tasks:  "leds-gpio" and "gpio_keys", respectively.  Use those
instead of talking directly to the GPIOs; they integrate with kernel
frameworks better than your userspace code could.

So how can I make this "standard kernel drivers" work?

I would like to get rid of using /sys/class/gpio/gpioX/value and use
/dev/input/eventX instead, because the first method will require debouncing
in userland and is not portable to other keyboard types.

I tried to compile a kernel with CONFIG_KEYBOARD_GPIO enabled and load
gpio_keys.ko. However this did neither create a new device in /dev/input/
nor /sys/devices/platform/gpio-keys.

Kconfig states the following:
...
Your board-specific setup logic must also provide a platform device,
with configuration data saying which GPIOs are used.
...

So looks like my "board-specific setup logic" (whatever this might be) does
not "provide a platform device with configuration data saying which GPIOs
are used".

So my question is twofold:
1. Where can I find the "board-specific setup logic" (for Rapberry Pi in my
case
2. How would this "board-specific setup logic" (if unavailable) look like to
make gpio_keys.ko work?

Sven

P.S.: The kernel in use is the one from
git://github.com/raspberrypi/linux.git which is basically a vanilla 3.6.11
with Raspberry Pi specific patches.

-- 
Threading is a performance hack.
(The Art of Unix Programming by Eric S. Raymond)

/me is giggls@ircnet, http://sven.gegg.us/ on the Web

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux