Page 1 of 1

reading multimedia keys WITHOUT X11

Posted: Sun May 27, 2012 4:59 pm
by mithodin
Hey guys, finally got my hands on a raspi and of course I immediately set up mpd and cron to wake me using nice music.
there is the problem, however, of using the multimedia keys (or the MCE remote I will receive next week) to control mpd if I'm not in an X-Session (and what do I need X for if I'm only going to play music?).

So has anyone managed to find a way to react to multimedia keys on the virtual terminal? Any hints would be appreciated (even if it turns out I have to write my own daemon to listen).

Re: reading multimedia keys WITHOUT X11

Posted: Sun May 27, 2012 5:07 pm
by ukscone
you'll need to remap the keys so run the command

Code: Select all

showkeys -s
and press the keys and see what scancode they return then use

Code: Select all

setkeycodes
to remap the scan code to a keycode

then create/edit your keymap file so that the mapped keycode does what you want.

[there are other methods/programs to do the same thing but that is the method i use]

Re: reading multimedia keys WITHOUT X11

Posted: Sun May 27, 2012 5:41 pm
by spurious
You'll also need to

Code: Select all

apt-get install console-tools
first to get the showkey command. ;)

Re: reading multimedia keys WITHOUT X11

Posted: Sun May 27, 2012 5:42 pm
by ukscone
ah yes i always forget that others don't automatically install busybox or console-tools as about the 1st thing on a new install :)

Re: reading multimedia keys WITHOUT X11

Posted: Mon May 28, 2012 7:30 am
by mithodin
Hey, thanks for the advice! I installed console-tools and I can assign keycodes.
I could not figure out how to let pressing a key run (for example) a shell script, though.

Re: reading multimedia keys WITHOUT X11

Posted: Mon May 28, 2012 4:09 pm
by ukscone
it's not specifically for the raspberry pi and there are other ways (progs) to do it but you might find ebindkeys useful.

https://github.com/mozzwald/ebindkeys-zipit