2014-08-29, 01:31
(2014-08-15, 22:55)jamesbe Wrote: Could you please post more details on this? I'm trying to get mythtv to work with my PS3 remote and it currently only works with the D-pad and the number keys. XBMC seems to work a little better, play / stop work as well and the PS button but not much else.
I would really like to just remap all the keys to normal keyboard buttons and then I'll do a remap with my harmony remote so it makes sense to the family when using the remote. I just installed 14.04 and this is yet another stumbling block it seems. I've had nothing but problems with the IR remotes ARGH.
You need to do (approximately) the following..
Install the necessary packages to checkout, build etc..
Code:
sudo apt-get install git automake autoconf pkg-config xcb-proto xutils-dev libtool xserver-xorg-dev libudev-dev evtest
Clone the xf86-input-evdev repo and pull in the changes
Code:
git clone git://www.thenautilus.net/xf86-input-evdev
cd xf86-input-evdev
git pull git://www.thenautilus.net/xf86-input-evdev code-remap-2.8.2
Compile the evdev driver
Code:
./autogen.sh
make
Move the old file out of the way and copy the new one in
Code:
sudo mv /usr/lib/xorg/modules/input/evdev_drv.so /usr/lib/xorg/modules/input/evdev_drv.so.orig
sudo cp ./src/.libs/evdev_drv.so /usr/lib/xorg/modules/input/evdev_drv.so
Then create a config file to use the new option - /usr/share/X11/xorg.conf.d/99-evdev.conf containing
Code:
Section “InputClass"
Identifier "evdev keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*”
MatchProduct "PS3 Remote Controller"
Driver "evdev"
# Remap list
# R1/2/3 (311/313/318) to F8/F9/F10 => vol up/down/mute
# Option (353) to c => context
# Clear (355) to w => toggle watched
# Display/Info (358) to i => info
# Start (315) to s => shutdown menu
Option "event_key_remap" "311=76 313=75 318=74 353=23 357=54 353=23 355=77 358=31 315=39"
EndSection
You can find which codes to map FROM (i.e. what the PS3 remote generates) by looking for it in the output of 'cat /proc/bus/input/devices'
eg..
Code:
I: Bus=0005 Vendor=054c Product=0306 Version=0000
N: Name="PS3 Remote Controller"
P: Phys=
S: Sysfs=/devices/virtual/input/input71
U: Uniq=
H: Handlers=kbd event22
B: PROP=0
B: EV=3
B: KEY=8000000000000000 7000001083c100 8c00ea00000000 6bc0000000000001 8000 1102c0000801 80168000000000 10000ffe
Now run 'sudo evtest /dev/input/event22' and press a button on the remote and you will see something like..
Code:
Event: time 1409268216.091763, type 1 (EV_KEY), code 315 (BTN_START), value 1
Event: time 1409268216.091763, -------------- SYN_REPORT ------------
Event: time 1409268216.439260, type 1 (EV_KEY), code 315 (BTN_START), value 0
Event: time 1409268216.439260, -------------- SYN_REPORT ------------
So the code for the 'start' button is 315 (which is above 255 so X11 won't grok it)
You can look up the X11 codes in /usr/share/X11/xkb/keycodes/evdev or just run 'rev' and move the mouse over the xev window and press a key. You will see output like so..
Code:
KeyRelease event, serial 32, synthetic NO, window 0xc00001,
root 0x273, subw 0xc00002, time 88910611, (43,45), root:(43,84),
state 0x0, keycode 39 (keysym 0x73, s), same_screen YES,
XLookupString gives 1 bytes: (73) "s"
XFilterEvent returns: False
So the key code for 's' is 39, hence we have '315=39' in the X config.
You need to restart X to test changes and so far as I know there is no dynamic way to adjust the table so I suggest working out a list of mappings, generating all the numbers, and editing the file in one big hit.