Hi. I have been trying to make a Python script to control mpg123 with Button Shim. If you start mpg123 with the -C option you can use the “s” key for play/pause, “f” to skip to the next track, “d” to skip to the previous track and the +/- keys on the numeric pad to control volume levels. I would like to assign these to the five buttons on the Button Shim. Using the evdev library the corresponding keycodes for these keys are as follows. Their respectiv keycode numbers are in straight brackets.
KEY_S #play/pause 
KEY_F #next track 
KEY_D #prev track 
KEY_KPMINUS #volume down 
KEY_KPPLUS #volume up 
Could you point me in the direction of acomplishing this? Thank you in advance.
I am sorry, this was an error on my side (I have two different button shims). This button-shim is connected to I2C, so they are not connected to GPIOs.
So you have two options: use the evdev library to synthesize key-events. Or use the option -R option of mpg123. This allows to control mpg123 via sysin (writing commands) instead of keys. Personally, I would try the first alternative first, it should be a bit simpler.