Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4867

Device Tree • Basic guidance needed to inform Linux kernel of hardware connected to GPIO

$
0
0
For example: how would you configure Linux so a button connected to a generic Raspberry Pi GPIO would send an input event code?

I hope to use the Raspberry Pi to better understand customizing the Linux kernel, but find myself lost on how to get started. I have written userspace code with libgpiod, RPI.GPIO, bcm2835, etc., but I want to inform Linux of the hardware attached to the Raspberry Pi's header. For example, connecting a button to GPIO 25 so volume increases when it's pressed.

I think I can do this just by modifying the device tree, but I'm not sure. There is a subsystem called "gpio-keys" and a KEY_VOLUMEUP input event code. I haven't found example code for gpio-keys but have found some *.dts examples defining nodes for it. But the Linux documentation makes me think I have to make a dedicated input device to send event codes. Can you suggest resources/documentation to help someone experienced with the Pi, but new to Linux configuration?

Statistics: Posted by rapwiyeko — Tue May 07, 2024 4:09 am



Viewing all articles
Browse latest Browse all 4867

Trending Articles