Making The Mele F10 Usable In XBMC (Linux)

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
  • Keyboard
  • Microphone
  • 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:

  1. Mapping accessible buttons via XBMC’s XML keymaps
  2. Mapping accessible buttons via getscancodes and udev
  3. 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:

cat /proc/bus/input/devices

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:

00001e0000000000:KEY_1

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"

EndSection

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:
http://openelec.tv/forum/104-bluetooth-remotes/66542-help-configuring-keyboard-mapping-starting-3-1-6?start=15

11 comments

  1. Hi, thanks for the extensive explanation. I am the original creator of the thread you mentioned, and for OpenELEC I shall mention that there is an easier way using the systemd mapping abilities as for the new udev version.

    Essentially you are creating a single file in /storage/.config/hwdb.d named 99-mele_F10.hwdb (or any other name you like) that looks like (for the original Mele F10, others may look a little bit different):

    ###########################################################
    # MELE
    ###########################################################

    # F10 Remote
    keyboard:usb:v1915pAF11*
    KEYBOARD_KEY_090001=enter # Left Mouse Button: Center in Pad
    KEYBOARD_KEY_090002=back # Right Mouse Button: Back
    KEYBOARD_KEY_090003=f11 # Menu Button (inverted U with 2 horizontal lines)
    KEYBOARD_KEY_0c0089=f12 # TV Info Button (square with arrow pointing outward)

    And that’s it.
    For more information you may refer to the original thread.

    Regards

    Gaudi

    1. Thank you very much for your input Gaudi. I did actually try that method first but it did bring up the arrow when I used the mouse buttons. I’ll have to test with the latest version of KODI and see what the result is.

      1. Please consider that for it not to show the mouse pointer you will need to disable the mouse support for Kodi.
        I do not see any problems with it as controlling it with an air mouse is inconvenient, and the remote pretty much covers all the requirements.

        Thanks for taking time to reply.

        Regards

    1. Sorry about the late reply.

      # Front
      # Top pair
      0000280000000000:KEY_ENTER
      01020000000000:KEY_BACKSPACE

      # Circle pad
      01010000000000:KEY_ENTER
      0000520000000000:KEY_UP
      0000510000000000:KEY_DOWN
      0000500000000000:KEY_LEFT
      00004f0000000000:KEY_RIGHT

      # Volume keys
      02ea00:KEY_MINUS
      02e900:KEY_EQUAL
      02e200:KEY_MUTE

      # Shutdown
      028900:KEY_S

      # Menus
      01040000000000:KEY_C
      024103:KEY_I

      # Favourites
      024203:KEY_BOOKMARKS

      # Playback controls
      00003a0000000000:KEY_TAB
      00003b0000000000:KEY_X
      00003c0000000000:KEY_SPACE
      00003d0000000000:KEY_M

      # Back
      # QWERTY Layout
      # QL 1
      0000290000000000:KEY_ESC
      0000140000000000:KEY_Q
      00001a0000000000:KEY_W
      0000080000000000:KEY_E
      0000150000000000:KEY_R
      0000170000000000:KEY_T
      00001c0000000000:KEY_Y
      0000180000000000:KEY_U
      00000c0000000000:KEY_I
      0000120000000000:KEY_O
      0000130000000000:KEY_P
      00002a0000000000:KEY_BACKSPACE

      # QL 2
      0200000000000000:KEY_LEFTSHIFT
      0000040000000000:KEY_A
      0000160000000000:KEY_S
      0000070000000000:KEY_D
      0000090000000000:KEY_F
      00000a0000000000:KEY_G
      00000b0000000000:KEY_H
      00000d0000000000:KEY_J
      00000e0000000000:KEY_K
      00000f0000000000:KEY_L
      0000330000000000:KEY_SEMICOLON

      # QL 3
      00001d0000000000:KEY_Z
      00001b0000000000:KEY_X
      0000060000000000:KEY_C
      0000190000000000:KEY_V
      0000050000000000:KEY_B
      0000110000000000:KEY_N
      0000100000000000:KEY_M
      0000360000000000:KEY_COMMA
      0000370000000000:KEY_DOT

      # QL 4
      00002f0000000000:KEY_LEFTBRACE
      0000300000000000:KEY_RIGHTBRACE
      0000350000000000:KEY_GRAVE
      00002c0000000000:KEY_SPACE
      0000380000000000:KEY_SLASH
      0000340000000000:KEY_APOSTROPHE

      # Function Layer
      # FL 1
      00001e0000000000:KEY_1
      00001f0000000000:KEY_2
      0000200000000000:KEY_3
      0000210000000000:KEY_4
      0000220000000000:KEY_5
      0000230000000000:KEY_6
      0000240000000000:KEY_7
      0000250000000000:KEY_8
      0000260000000000:KEY_9
      0000270000000000:KEY_0

      # FL 2
      #02001e0000000000:
      #02001f0000000000:
      #0200200000000000:
      #0200210000000000:
      #0200220000000000:
      #0200240000000000:
      #0200240000000000:
      0200250000000000:KEY_KPASTERISK
      #0200260000000000:
      #0200270000000000:

      # FL 3
      0200330000000000:KEY_KPPLUS
      #02002e0000000000:
      00002d0000000000:KEY_KPMINUS
      #02002d0000000000:
      #00002e0000000000:
      #0200230000000000:
      #0200310000000000:
      0000310000000000:KEY_BACKSLASH
      #0200360000000000:
      #0200370000000000:

      # FL 4
      #02002f0000000000:
      #0200300000000000:
      #0200350000000000:
      #0200380000000000:
      #0200340000000000:

      # Special keys
      022e02:KEY_PAGEUP
      022d02:KEY_PAGEDOWN
      02bd01:KEY_I
      024003:KEY_TAB
      00004a0000000000:KEY_HOMEPAGE
      022102:KEY_BOOKMARKS

      I hope this map file works for you. I am currently researching the use of udev and IR to make full use of all of the Mele F10’s functionality.

  2. I’m new to Kodi, but I had previously purchased some cheapo android stick. At that time, I also bought the Mele F10 and just dug it out of a box somewhere. I’m probably going to get a new Raspberry Pi 2 and OpenElec to set up my Kodi. Will the F10 work well or should I get something else?

    1. I would recommend the Mele F10 Pro. Similar design but easier to work with as you have the final choice in what mode it is in.

  3. Hi, I have followed all of this using OSMC, but I get double key press with every button on my remote now, very frustrating. Is there anyway to disable that (OSMC doesn’t come with X11, so cannot blacklist it)

    1. Unfortunately, I do not use OSMC so I cannot offer much of a solution. The way that the remote is setup requires very quick presses of the buttons. Hold a button down any longer than it takes to register a button press and you will end up with the double pressing issue.

      1. Thanks, I haven’t been able to fix it despite a lot of Googling, so looks like I am in the market for a new remote. Great guide though, in theory it worked, just think the Mele is overly sensitive to touch, and has a lot of double (or even triple) presses.

      2. Unfortunately, it is. If anything, there are other RF remotes such as the Minix Neos A2 (which you can find a page on in the Kodi Wiki). There is also the PlayStation 3 Blu-ray Disc Remote (which I will be posting about over the next two weeks, hopefully).

Leave a reply to Gaudi Cancel reply