openDsh / dash

Join us on Slack! https://join.slack.com/t/opendsh/shared_invite/zt-la398uly-a6eMH5ttEQhbtE6asVKx4Q
GNU General Public License v3.0
259 stars 80 forks source link

[solved] Setting up ShortCut via GPIO #32

Closed modemlamer closed 3 years ago

modemlamer commented 3 years ago

hi,

can anybody explain how to configure/setup shortcuts (e.a. openMediaPlayer) via GPIO ?!

setting shortcut via Keyboard works fine.

thanks,

robert5974 commented 3 years ago

You have to first have GPIO pins setup via any method. Python is very responsive and systemd services also work. Once you have something in place then, within Dash will it recognize the GPIO is being triggered.

For example, I have a python script run at boot that sets up two buttons for volume (up,down). Within Dash, I can press the shortcut then press the button for volume and it will assign that shortcut to work within the Dash UI.

Make sense? What were you trying to set?

modemlamer commented 3 years ago

thanks, where can i find such a script? i think in the crankshaft project there is some GPIO stuff, maybe there? My settings will be toggeling the menus, vol+, vol- maybe "cam active in reversegear"

robert5974 commented 3 years ago

You can use google to search for them. That is what I did. I think I found my volume script on the raspberry pi forums. The same logic can be applied to any common GPIO pin.

I don't know how much you will get from Crankshaft because it was developed with a lot of Systemd services and customization. You would need several files for each GPIO pin you want monitored.

Also, the subreddit for Crankshaft might be helpful. I found things in there before. If anything some very useful info.

ZeroErrors commented 3 years ago

Crankshaft uses this https://github.com/opencardev/gpio2kbd which is based off of Adafruit-Retrogame to handle mapping GPIO to virtual keyboard. May be nice to link to this from some documentation or setup guide to help people that want to use this kind of setup since its useful for cases where you run applications other than dash.

If we want dash to support GPIO directly then we would probably need to look at something like libgpiod but I'm unsure how much effort that would be to integrate.

modemlamer commented 3 years ago

i finally used the method from this guy: https://blog.gc2.at/post/gpio-tasten/

its very easy and straight forward, no extra software, no extra kernel hacking and so on, just put a line for each key into the /boot/config.txt like this:

dtoverlay=gpio-key,gpio=21,keycode=108,label="KEY_DOWN",gpio_pull=2