mithodin
Posts: 4
Joined: Sun May 13, 2012 8:18 am
Contact: ICQ Website

reading multimedia keys WITHOUT X11

Sun May 27, 2012 4:59 pm

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).

User avatar
ukscone
Forum Moderator
Forum Moderator
Posts: 4156
Joined: Fri Jul 29, 2011 2:51 pm
Contact: Website

Re: reading multimedia keys WITHOUT X11

Sun May 27, 2012 5:07 pm

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]

spurious
Posts: 343
Joined: Mon Nov 21, 2011 9:29 pm

Re: reading multimedia keys WITHOUT X11

Sun May 27, 2012 5:41 pm

You'll also need to

Code: Select all

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

User avatar
ukscone
Forum Moderator
Forum Moderator
Posts: 4156
Joined: Fri Jul 29, 2011 2:51 pm
Contact: Website

Re: reading multimedia keys WITHOUT X11

Sun May 27, 2012 5:42 pm

ah yes i always forget that others don't automatically install busybox or console-tools as about the 1st thing on a new install :)

mithodin
Posts: 4
Joined: Sun May 13, 2012 8:18 am
Contact: ICQ Website

Re: reading multimedia keys WITHOUT X11

Mon May 28, 2012 7:30 am

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.

User avatar
ukscone
Forum Moderator
Forum Moderator
Posts: 4156
Joined: Fri Jul 29, 2011 2:51 pm
Contact: Website

Re: reading multimedia keys WITHOUT X11

Mon May 28, 2012 4:09 pm

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

Return to “Media centres”