Ever since acquiring the Mele F10 3-in-1 remote control, many users wished they could get it to work properly in. XBMC. The F10 was a first generation product with three modes which had been succeeded by the F10 Pro 5-in-1 remote control which has (obviously) a total of five modes.
These modes are:
- IR Remote Control
- Air Mouse
- Speaker/Earphone jack
As with many first generation products, there are issues, bugs, and oversights that the user must contend with in order to get the most of them. By far the largest issue with the original F10 was that, by default, only 14 of the 21 buttons on the remote side of the device were accessible as keyboard keys. The Power button was scrictly for sending a power on/off signal via IR. The Mouse Startup button was only for activating or deactivating the air mouse mode. The Back button was a right mouse button. The button in the centre of the circular pad was a left mouse button. The Menu button was a middle mouse button. The Subtitle and Audio buttons were not accessible. Furthermore, anytime one of the mouse buttons were pressed, the Mele F10 would immediately enter air mouse mode. This was a major issue when using XBMC.
Like with other remotes, there are three solutions were created by the community to correct their quirks. They are in order of lowest to highest effectiveness:
- Mapping accessible buttons via XBMC’s XML keymaps
- Mapping accessible buttons via getscancodes and udev
- Mapping accessible buttons via hid_mapper
The last solution is the one that will be explained as it is the only one that captured every single button on the Mele F10 aside from the Power button and the Mouse Startup button. This is under the assumption that you have already installed hid_mapper from here: https://github.com/Claudio-Sjo/HID_linux_xbmc_driver and that you have a terminal and text editor open.
Note: hid_mapper was originally created by coldsource who posted source tarballs in this thread in the XBMC forums. The code was then updated by forteresce who then put it up on github. Claudio-Sjo then forked that code, updated it, and put it in a new repository.
Plug in the dongle for your remote and execute this command:
Which will show you the vendor (manufacturer) and product IDs that you’ll need for the rest of the steps. You are specifically looking for this line here:
I: Bus=0003 Vendor=1915 Product=af11 Version=0111
Which will show up in the last block of lines that are shown in you terminal As you can see, the manufacturer ID is 1915 and the product ID is af11 respectively. Now run this command as root:
hid_mapper --learn --lookup-id --manufacturer '1915' --product 'af11' > mele-f10.map
and press each key that you need to map. Be sure to keep track of which keys you pressed as the key codes don’t give you much indication of what key was pressed. You will see the ID of each key in the terminal when hid_mapper reads each key when you press them but they don’t usually get piped into the file. Make sure that if you wish to use the all of the keys in the keyboard on the back, to record those as well!. Provided that you did everything correctly, you should end up with something that looks like this:
Looking for Manufacturer : 1915 Looking for Product : af11 Found HID device at /dev/hidraw2 --- Vendor = 2.4G Wireless Receiver --- manufacturer = 1915, device = af11 Found HID device at /dev/hidraw3 --- Vendor = 2.4G Wireless Receiver --- manufacturer = 1915, device = af11 Found HID device at /dev/hidraw4 --- Vendor = 2.4G Wireless Receiver --- manufacturer = 1915, device = af11 Found HID device Opened HID interface on /dev/hidraw2 Opened HID interface on /dev/hidraw3 Opened HID interface on /dev/hidraw4 00 00 1e 00 00 00 00 00 00 00 00 00 00 00 00 00
Where a line made up of numbers higher than zero with or without accompaning letters is a keypress and a line made up completely of letters is a key release. After cleaning up the file (aside from removing that honking wall of text above the key codes) and adding key definitions from
/usr/include/linux/input.h you should end up with something that looks like this:
As there is no other formatting requirements for the file, you can add comments and blanks like I did here:
# Front # Top pair 0000280000000000:KEY_ENTER 01020000000000:KEY_ESC # Circle pad 01010000000000:KEY_ENTER 0000520000000000:KEY_UP 0000510000000000:KEY_DOWN 0000500000000000:KEY_LEFT 00004f0000000000:KEY_RIGHT ...etc
I’ve modelled my keymap file after the global keyboard controls for XBMC which you can find at
/usr/share/xbmc/system/keymaps/keyboard.xml. As long as the each line that contains a key code and key description is valid, hid_mapper can map the keys of the remote. To check the file you finished, run this command as root:
hid_mapper --manufacturer '1915' --product 'af11' --map 'mele-f10.map'
and press a few buttons. If everything works, great! If not, start debugging the file.
After doing all of that, a few more steps must be taken. To prevent the Mele F10 from being picked up by X11 and having its buttons mapped, insert this text into /etc/X11/xorg.d/50-HID-Blacklist.conf and save it:
Section "InputClass" Identifier "Remote blacklist" MatchUSBID "1915:af11" Option "Ignore" "on"
Next, to have the Mele F10 buttons mapped when your HTPC boots insert this text into an executeable script:
hid_mapper --disable-repetition --manufacturer '1915' --product 'af11' --map '/hom/xbmc/mele-f10.map'
and have that script called by the system management daemon for your Linux distro (systemd for Arch Linux, Debian, etc., OpenRC for Gentoo, UpStart for Ubuntu).
Many thanks go to seo from the OpenElec forums for finding this out and presenting it in this thread: