Created
September 12, 2012 23:41
-
-
Save andrenam/3710805 to your computer and use it in GitHub Desktop.
Setup Hama MCE Remote with udev-rule and inputlirc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
apt-get -y install inputlirc | |
update-rc.d -f lirc remove | |
touch /etc/udev/rules.d/10-irremotes.rules | |
( | |
cat <<'EOF' | |
# HAMA Device 1 Vendor=05a4 Product=9881 E: MAJOR=13 E: MINOR=64 | |
SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ATTR{dev}=="13:64",SYMLINK="input/irremote1" | |
# HAMA Device 2 Vendor=05a4 Product=9881 E: MAJOR=13 E: MINOR=65 | |
SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ATTR{dev}=="13:65",SYMLINK="input/irremote2" | |
EOF | |
) | tee /etc/udev/rules.d/10-irremotes.rules | |
touch /etc/default/inputlirc | |
( | |
cat <<'EOF' | |
# Options to be passed to inputlirc. | |
EVENTS="/dev/input/irremote1 /dev/input/irremote2" | |
OPTIONS="-g -m 0 -c" | |
EOF | |
) | tee /etc/default/inputlirc | |
touch /root/.xbmc/userdata/Lircmap.xml | |
( | |
cat <<'EOF' | |
<lircmap> | |
<remote device="/dev/input/irremote2"> | |
<power>KEY_SLEEP</power> | |
<skipplus>KEY_NEXTSONG</skipplus> | |
<skipminus>KEY_PREVIOUSSONG</skipminus> | |
<pause>KEY_PLAYPAUSE</pause> | |
<stop>KEY_STOPCD</stop> | |
<info>BTN_RIGHT</info> | |
<title>BTN_LEFT</title> | |
<volumeplus>KEY_VOLUMEUP</volumeplus> | |
<volumeminus>KEY_VOLUMEDOWN</volumeminus> | |
<mute>KEY_MUTE</mute> | |
<title>BTN_MOUSE</title> | |
</remote> | |
<remote device="/dev/input/irremote1"> | |
<start>ALT_META_KEY_ENTER</start> | |
<yellow>CTRL_SHIFT_KEY_T</yellow> | |
<blue>CTRL_KEY_M</blue> | |
<green>CTRL_KEY_I</green> | |
<red>CTRL_KEY_E</red> | |
<!-- | |
<myTV>CTRL_SHIFT_KEY_T</myTV> | |
<mymusic>CTRL_KEY_M</mymusic> | |
<mypictures>CTRL_KEY_I</mypictures> | |
<myvideo>CTRL_KEY_E</myvideo> | |
--> | |
<reverse>CTRL_SHIFT_KEY_B</reverse> | |
<forward>CTRL_SHIFT_KEY_F</forward> | |
<menu>CTRL_SHIFT_KEY_M</menu> | |
<record>CTRL_KEY_R</record> | |
<back>KEY_BACKSPACE</back> | |
<left>KEY_LEFT</left> | |
<right>KEY_RIGHT</right> | |
<up>KEY_UP</up> | |
<down>KEY_DOWN</down> | |
<select>KEY_ENTER</select> | |
<pageplus>KEY_PAGEUP</pageplus> | |
<pageminus>KEY_PAGEDOWN</pageminus> | |
<one>KEY_KP1</one> | |
<two>KEY_KP2</two> | |
<three>KEY_KP3</three> | |
<four>KEY_KP4</four> | |
<five>KEY_KP5</five> | |
<six>KEY_KP6</six> | |
<seven>KEY_KP7</seven> | |
<eight>KEY_KP8</eight> | |
<nine>KEY_KP9</nine> | |
<zero>KEY_KP0</zero> | |
<display>KEY_KPASTERISK</display> | |
<clear>KEY_ESC</clear> | |
<eject>ALT_META_KEY_ENTER</eject> | |
</remote> | |
</lircmap> | |
EOF | |
) | tee /root/.xbmc/userdata/Lircmap.xml | |
touch /root/.xbmc/userdata/keymaps/remote.xml | |
( | |
cat <<'EOF' | |
<!-- This file contains the mapping of keys (gamepad, remote, and keyboard) to actions within XBMC --> | |
<!-- The <global> section is a fall through - they will only be used if the button is not --> | |
<!-- used in the current window's section. Note that there is only handling --> | |
<!-- for a single action per button at this stage. --> | |
<!-- For joystick/gamepad configuration under linux/win32, see below as it differs from xbox --> | |
<!-- gamepads. --> | |
<!-- The format is: --> | |
<!-- <device> --> | |
<!-- <button>action</button> --> | |
<!-- </device> --> | |
<!-- To map keys from other remotes using the RCA protocol, you may add <universalremote> blocks --> | |
<!-- In this case, the tags used are <obc#> where # is the original button code (OBC) of the key --> | |
<!-- You set it up by adding a <universalremote> block to the window or <global> section: --> | |
<!-- <universalremote> --> | |
<!-- <obc45>Stop</obc45> --> | |
<!-- </universalremote> --> | |
<!-- Note that the action can be a built-in function. --> | |
<!-- eg <B>XBMC.ActivateWindow(MyMusic)</B> --> | |
<!-- would automatically go to My Music on the press of the B button. --> | |
<!-- Joysticks / Gamepads: --> | |
<!-- See the sample PS3 controller configuration below for the format. --> | |
<!-- --> | |
<!-- Joystick Name: --> | |
<!-- Do 'cat /proc/bus/input/devices' or see your xbmc log file to find the names of --> | |
<!-- detected joysticks. The name used in the configuration should match the detected name. --> | |
<!-- --> | |
<!-- Button Ids: --> | |
<!-- 'id' is the button ID used by SDL. Joystick button ids of connected joysticks appear --> | |
<!-- in xbmc.log when they are pressed. Use your log to map custom buttons to actions. --> | |
<!-- --> | |
<!-- Axis Ids / Analog Controls --> | |
<!-- Coming soon. --> | |
<keymap> | |
<global> | |
<remote> | |
<play>Play</play> | |
<pause>Pause</pause> | |
<stop>Stop</stop> | |
<forward>FastForward</forward> | |
<reverse>Rewind</reverse> | |
<left>Left</left> | |
<right>Right</right> | |
<up>Up</up> | |
<down>Down</down> | |
<select>Select</select> | |
<enter>FullScreen</enter> | |
<pageplus>PageUp</pageplus> | |
<pageminus>PageDown</pageminus> | |
<back>Back</back> | |
<menu>PreviousMenu</menu> | |
<title>ContextMenu</title> | |
<info>Info</info> | |
<skipplus>SkipNext</skipplus> | |
<skipminus>SkipPrevious</skipminus> | |
<display>FullScreen</display> | |
<start>PreviousMenu</start> | |
<record>Screenshot</record> | |
<volumeplus>VolumeUp</volumeplus> | |
<volumeminus>VolumeDown</volumeminus> | |
<mute>Mute</mute> | |
<power>XBMC.ShutDown()</power> | |
<myvideo>XBMC.ActivateWindow(MyVideos)</myvideo> | |
<mymusic>XBMC.ActivateWindow(MyMusic)</mymusic> | |
<mypictures>XBMC.ActivateWindow(MyPictures)</mypictures> | |
<mytv>XBMC.ActivateWindow(VideoLibrary,TvShows)</mytv> | |
<red>XBMC.ActivateWindow(Home)</red> | |
<green>XBMC.ActivateWindow(MyVideos)</green> | |
<yellow>XBMC.ActivateWindow(MyMusic)</yellow> | |
<blue>XBMC.ActivateWindow(MyPictures)</blue> | |
<zero>Number0</zero> | |
<one>Number1</one> | |
<two>JumpSMS2</two> | |
<three>JumpSMS3</three> | |
<four>JumpSMS4</four> | |
<five>JumpSMS5</five> | |
<six>JumpSMS6</six> | |
<seven>JumpSMS7</seven> | |
<eight>JumpSMS8</eight> | |
<nine>JumpSMS9</nine> | |
</remote> | |
</global> | |
<Home> | |
<remote> | |
<info>XBMC.ActivateWindow(SystemInfo)</info> | |
<clear>XBMC.ActivateWindow(Weather)</clear> | |
<hash>XBMC.ActivateWindow(Settings)</hash> | |
</remote> | |
</Home> | |
<MyFiles> | |
<remote> | |
<clear>Delete</clear> | |
<zero>Highlight</zero> | |
<star>Move</star> | |
<hash>Rename</hash> | |
</remote> | |
</MyFiles> | |
<MyMusicPlaylist> | |
<remote> | |
<clear>Delete</clear> | |
<zero>Delete</zero> | |
</remote> | |
</MyMusicPlaylist> | |
<MyMusicPlaylistEditor> | |
<remote> | |
<zero>Queue</zero> | |
</remote> | |
</MyMusicPlaylistEditor> | |
<MyMusicFiles> | |
<remote> | |
<zero>Queue</zero> | |
<star>Queue</star> | |
</remote> | |
</MyMusicFiles> | |
<MyMusicLibrary> | |
<remote> | |
<zero>Queue</zero> | |
<star>Queue</star> | |
</remote> | |
</MyMusicLibrary> | |
<FullscreenVideo> | |
<remote> | |
<zero>Number0</zero> | |
<one>Number1</one> | |
<two>Number2</two> | |
<three>Number3</three> | |
<four>Number4</four> | |
<five>Number5</five> | |
<six>Number6</six> | |
<seven>Number7</seven> | |
<eight>Number8</eight> | |
<nine>Number9</nine> | |
<left>StepBack</left> | |
<right>StepForward</right> | |
<up>BigStepForward</up> | |
<down>BigStepBack</down> | |
<back>SmallStepBack</back> | |
<menu>OSD</menu> | |
<start>OSD</start> | |
<select>AspectRatio</select> | |
<title>CodecInfo</title> | |
<info>Info</info> | |
<teletext>XBMC.ActivateWindow(Teletext)</teletext> | |
<subtitle>NextSubtitle</subtitle> | |
<star>NextSubtitle</star> | |
<language>AudioNextLanguage</language> | |
<hash>AudioNextLanguage</hash> | |
<green>NextSubtitle</green> | |
<red>AudioNextLanguage</red> | |
</remote> | |
</FullscreenVideo> | |
<VideoTimeSeek> | |
<remote> | |
<select>Select</select> | |
<enter>Select</enter> | |
</remote> | |
</VideoTimeSeek> | |
<FullscreenInfo> | |
<remote> | |
<title>CodecInfo</title> | |
<info>Back</info> | |
<menu>OSD</menu> | |
</remote> | |
</FullscreenInfo> | |
<PlayerControls> | |
<remote> | |
<menu>Back</menu> | |
</remote> | |
</PlayerControls> | |
<Visualisation> | |
<remote> | |
<left>PreviousPreset</left> | |
<right>NextPreset</right> | |
<up>IncreaseRating</up> | |
<down>DecreaseRating</down> | |
<back>LockPreset</back> | |
<title>CodecInfo</title> | |
<select>XBMC.ActivateWindow(VisualisationPresetList)</select> | |
<menu>XBMC.ActivateWindow(MusicOSD)</menu> | |
<start>XBMC.ActivateWindow(MusicOSD)</start> | |
<info>Info</info> | |
</remote> | |
</Visualisation> | |
<MusicOSD> | |
<remote> | |
<menu>Back</menu> | |
<title>Info</title> | |
<info>CodecInfo</info> | |
</remote> | |
</MusicOSD> | |
<VisualisationSettings> | |
<remote> | |
<menu>Back</menu> | |
</remote> | |
</VisualisationSettings> | |
<VisualisationPresetList> | |
<remote> | |
<menu>Back</menu> | |
</remote> | |
</VisualisationPresetList> | |
<SlideShow> | |
<remote> | |
<zero>ZoomNormal</zero> | |
<one>ZoomLevel1</one> | |
<two>ZoomLevel2</two> | |
<three>ZoomLevel3</three> | |
<four>ZoomLevel4</four> | |
<five>ZoomLevel5</five> | |
<six>ZoomLevel6</six> | |
<seven>ZoomLevel7</seven> | |
<eight>ZoomLevel8</eight> | |
<nine>ZoomLevel9</nine> | |
<info>CodecInfo</info> | |
<skipplus>NextPicture</skipplus> | |
<skipminus>PreviousPicture</skipminus> | |
<title>Info</title> | |
<select>Rotate</select> | |
</remote> | |
</SlideShow> | |
<ScreenCalibration> | |
<remote> | |
<select>NextCalibration</select> | |
<zero>ResetCalibration</zero> | |
<display>NextResolution</display> | |
<xbox>NextResolution</xbox> | |
</remote> | |
</ScreenCalibration> | |
<GUICalibration> | |
<remote> | |
<select>NextCalibration</select> | |
<zero>ResetCalibration</zero> | |
</remote> | |
</GUICalibration> | |
<VideoOSD> | |
<remote> | |
<menu>Back</menu> | |
<start>Back</start> | |
</remote> | |
</VideoOSD> | |
<VideoMenu> | |
<remote> | |
<menu>OSD</menu> | |
<info>Info</info> | |
<title>CodecInfo</title> | |
<zero>Number0</zero> | |
<one>Number1</one> | |
<two>Number2</two> | |
<three>Number3</three> | |
<four>Number4</four> | |
<five>Number5</five> | |
<six>Number6</six> | |
<seven>Number7</seven> | |
<eight>Number8</eight> | |
<nine>Number9</nine> | |
<play>Select</play> | |
</remote> | |
</VideoMenu> | |
<OSDVideoSettings> | |
<remote> | |
<menu>Back</menu> | |
<start>Back</start> | |
</remote> | |
</OSDVideoSettings> | |
<OSDAudioSettings> | |
<remote> | |
<menu>Back</menu> | |
<start>Back</start> | |
</remote> | |
</OSDAudioSettings> | |
<VideoBookmarks> | |
<remote> | |
<menu>Back</menu> | |
<start>Back</start> | |
<zero>Delete</zero> | |
</remote> | |
</VideoBookmarks> | |
<MyVideoLibrary> | |
<remote> | |
<zero>Queue</zero> | |
<clear>Delete</clear> | |
</remote> | |
</MyVideoLibrary> | |
<MyVideoFiles> | |
<remote> | |
<zero>Queue</zero> | |
<star>Queue</star> | |
</remote> | |
</MyVideoFiles> | |
<MyVideoPlaylist> | |
<remote> | |
<clear>Delete</clear> | |
<zero>Delete</zero> | |
</remote> | |
</MyVideoPlaylist> | |
<VirtualKeyboard> | |
<remote> | |
<back>BackSpace</back> | |
<star>Shift</star> | |
<hash>Symbols</hash> | |
<zero>Number0</zero> | |
<one>Number1</one> | |
<two>Number2</two> | |
<three>Number3</three> | |
<four>Number4</four> | |
<five>Number5</five> | |
<six>Number6</six> | |
<seven>Number7</seven> | |
<eight>Number8</eight> | |
<nine>Number9</nine> | |
<enter>Enter</enter> | |
<pageminus>CursorLeft</pageminus> | |
<pageplus>CursorRight</pageplus> | |
</remote> | |
</VirtualKeyboard> | |
<ContextMenu> | |
<remote> | |
<title>Back</title> | |
</remote> | |
</ContextMenu> | |
<Scripts> | |
<remote> | |
<info>info</info> | |
</remote> | |
</Scripts> | |
<NumericInput> | |
<remote> | |
<zero>Number0</zero> | |
<one>Number1</one> | |
<two>Number2</two> | |
<three>Number3</three> | |
<four>Number4</four> | |
<five>Number5</five> | |
<six>Number6</six> | |
<seven>Number7</seven> | |
<eight>Number8</eight> | |
<nine>Number9</nine> | |
<enter>Enter</enter> | |
<back>BackSpace</back> | |
</remote> | |
</NumericInput> | |
<MusicInformation> | |
<remote> | |
<info>Back</info> | |
</remote> | |
</MusicInformation> | |
<MovieInformation> | |
<remote> | |
<info>Back</info> | |
</remote> | |
</MovieInformation> | |
<LockSettings> | |
<remote> | |
<menu>Back</menu> | |
</remote> | |
</LockSettings> | |
<ProfileSettings> | |
<remote> | |
<menu>Back</menu> | |
</remote> | |
</ProfileSettings> | |
<PictureInfo> | |
<remote> | |
<skipplus>NextPicture</skipplus> | |
<skipminus>PreviousPicture</skipminus> | |
<info>Back</info> | |
</remote> | |
</PictureInfo> | |
<Teletext> | |
<remote> | |
<zero>number0</zero> | |
<one>number1</one> | |
<two>number2</two> | |
<three>number3</three> | |
<four>number4</four> | |
<five>number5</five> | |
<six>number6</six> | |
<seven>number7</seven> | |
<eight>number8</eight> | |
<nine>number9</nine> | |
<red>Red</red> | |
<green>Green</green> | |
<yellow>Yellow</yellow> | |
<blue>Blue</blue> | |
<info>Info</info> | |
<menu>Back</menu> | |
<start>Back</start> | |
<teletext>Back</teletext> | |
</remote> | |
</Teletext> | |
<AddonSettings> | |
<remote> | |
<clear>Delete</clear> | |
</remote> | |
</AddonSettings> | |
</keymap> | |
EOF | |
) | tee /root/.xbmc/userdata/keymaps/remote.xml | |
echo "Now reboot please :)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment