Access Volume Button via bash
#1
Can someone please tell how I can read the state of the volume buttons (PinePhonePro) via bash ?
Code:
read KEY_VOLUMEDOWN
read KEY_VOLUMEUP

**sidenote:**
want to create a supersimple screenshooter for Phosh, it will help a lot in writing docs...
  Reply
#2
What I found https://xnux.eu/devices/feature/volumekeys.html

On the PPP, there are following devices:

Code:
/dev/input/event0: gpio-vibrator
/dev/input/event1: adc-keys
/dev/input/event2: Goodix Capacitive TouchScreen
/dev/input/event3: gpio-key-power
/dev/input/event4: gpio-key-ri
/dev/input/event5: PinePhonePro Headphones



So I am able to read if the Volume_Key is pressed (from adc-keys) with:



Code:
libinput debug-events --device=/dev/input/event1




Which gives me some debug outputs of the pressed hardware keys without debouncing:

Code:
event1  DEVICE_ADDED            adc-keys                          seat0 default group1  cap:k
event1  KEYBOARD_KEY            +0.000s KEY_VOLUMEDOWN (114) pressed
event1  KEYBOARD_KEY            +0.208s KEY_VOLUMEDOWN (114) released
event1  KEYBOARD_KEY            +2.196s KEY_VOLUMEUP (115) pressed
event1  KEYBOARD_KEY            +2.404s KEY_VOLUMEUP (115) released




The idea is to read this keys with something simple like: read or showkey to be able to make a simple if volume up and down statement to trigger screenshooter



but I do not get input from the volume keys with this methods...
  Reply
#3
I know that SXMO are using volume keys extensively in their UIs (which are shell and dmenu based). I bet you could find something if you dig around over there a bit. If you can't find it, maybe ask in their IRC or mailing list.
Cheers,
TRS-80

What is Free Software and why is it so important for society?

Protocols, not Platforms

For the most Linux-y experience on your Linux phone, try SXMO!

I am (nominally) the Armbian Maintainer for PineBook Pro (although severely lacking in time these days).
  Reply
#4
(04-30-2022, 08:28 PM)TRS-80 Wrote: I know that SXMO are using volume keys extensively in their UIs (which are shell and dmenu based).  I bet you could find something if you dig around over there a bit.  If you can't find it, maybe ask in their IRC or mailing list.

Thanks for the hint, could not find it so far there, but I'll keep on digging...
  Reply
#5
OK, I was just chatting with guys in #sxmo and they are basically using setting dwm to call sxmo_hook_inputhandler.sh upon button press.

I don't know what window manager you are using, but setting something in there is probably the easiest way.  As opposed to what you are trying to do is a bit more low level.
Cheers,
TRS-80

What is Free Software and why is it so important for society?

Protocols, not Platforms

For the most Linux-y experience on your Linux phone, try SXMO!

I am (nominally) the Armbian Maintainer for PineBook Pro (although severely lacking in time these days).
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to access the hardware privacy switches? Pinoideae 3 2,775 02-09-2022, 10:45 PM
Last Post: bcnaz

Forum Jump:


Users browsing this thread: 3 Guest(s)