[LINUX] Generic HID Remote Driver for XBMC (Drivers for XBMC on Linux and XBMC Live)

  Thread Rating:
  • 7 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
coldsource Offline
Junior Member
Posts: 41
Joined: Dec 2010
Reputation: 0
Thumbs Up  [LINUX] Generic HID Remote Driver for XBMC (Drivers for XBMC on Linux and XBMC Live) Post: #1
I have bought an ASUS motherboard which was supplied with an IR remote control.
Here is a picture of the remote :
[Image: Asus-Bravo220-remote.jpg]

The receptor is an HID receptor that is not supported by LIRC, nor fully supported by evdev so only half of the keys are working.

I have developped a generic HID mapper which can convert any HID signal to a key event that can easly be used in XBMC.

Here is the driver :
hid_mapper.tar.gz

And a step by step guide for how to use it :
First we have to build the hid_mapper. Untar the archive and CD to hid_mapper. Then type 'make' to build the driver.

Type ./hid_mapper --list-devices to see if your device if recognized here. For example I have :
Quote:Found HID device at /dev/hidraw0
Manufacturer : PHILIPS
Product name : MCE USB IR Receiver- Spinel plusf0r ASUS

It is then necessary to blacklist the device in Xorg so it does not conflict with the mapper. Create a new file in /usr/share/X11/xorg.conf.d/. I have named it 50-remote.conf and it contains :
Quote:Section "InputClass"
Identifier "Remote blacklist"
MatchProduct "PHILIPS MCE USB IR Receiver- Spinel plusf0r ASUS"
Option "Ignore" "on"
EndSection
Match id done on the manufacturer and the product name. Restart Xorg and you're done. At this point the remote is not recognized anymore.

Next you have to use hid_mapper in learn mode to capture HID events :
./hid_mapper --learn --manufacturer 'PHILIPS' --product 'MCE USB IR Receiver- Spinel plusf0r ASUS' --map ''
If i press "OK" key of the remote I get
Quote:Found HID device at /dev/hidraw0
01 00 00 28 00 00 00 00 00
01 00 00 00 00 00 00 00 00

The first event is the "key down" event, containing the key code. This is what we need. Capture all the events you need to write a map file. This my map file for the asus remote :
Quote:010000520000000000:KEY_UP
010000510000000000:KEY_DOWN
010000500000000000:KEY_LEFT
0100004f0000000000:KEY_RIGHT
010000280000000000:KEY_ENTER
030000000000020000:KEY_KP1
030000000000040000:KEY_KP2
030000000020000000:KEY_C
030000000000008000:KEY_TAB
030010000000000000:KEY_KP3
02004000:KEY_ESC
02040000:KEY_KPMINUS
02020000:KEY_KPPLUS
02000002:KEY_PLAY
02000800:KEY_STOP
02000100:KEY_R
02800000:KEY_F
02010000:KEY_MUTE
02400000:KEY_PREVIOUSSONG
02200000:KEY_NEXTSONG

The list of the keys can be found in /usr/include/linux/input.h.

Last step is to run the mapper :
Quote:./hid_mapper --manufacturer 'PHILIPS' --product 'MCE USB IR Receiver- Spinel plusf0r ASUS' --map 'asus-spinel.map'

At this point the remote should work and emit the keys specified in the map file.

Since the hidraw driver is generic, this mapper should work with any HID receiver, even if it is not a remote. HID is used for keyboard, mouses, joysticks...

I hope this can help someone.

Bob
(This post was last modified: 2010-12-25 13:46 by coldsource.)
find quote
2ami Offline
Junior Member
Posts: 7
Joined: Jul 2009
Reputation: 0
Post: #2
hi Bob, first of all i would llike to thank you for writing this driver, i believe so many waiting for this solution on hid based receiver, as i also have 2 cheap MCE clone remote

but after i type "make" (before i got g++ command not found then i sudo apt-get update g++)

g++ main.o uinput_device.o hid.o signals.o keys_definition.o EventMapping.o Keys.o Exception.o MapReader.o -o hid_mapper
/usr/bin/ld: i386:x86-64 architecture of input file `main.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `uinput_device.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `hid.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `signals.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `keys_definition.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `EventMapping.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `Keys.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `Exception.o' is incompatible with i386 output....
...MapReader.cppSad.text+0x8e): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: final link failed: Invalid operation
collect2: ld returned 1 exit status
make: *** [all] Error 1


i'm a complete newbie in linux, is it because of my machine running i386 version of linux?
or do i miss something

uname -a
amiami@amiami-Aspire-4710 ~/Downloads/hid_mapper $ uname -a
Linux amiami-Aspire-4710 2.6.35-22-generic #33-Ubuntu SMP Sun Sep 19 20:34:50 UTC 2010 i686 GNU/Linux

regard
find quote
jakeluck1 Offline
Junior Member
Posts: 34
Joined: Aug 2004
Reputation: 0
Post: #3
thank you, Bob! will try it out here soon.

FYI, a related discussion from our own ph77

http://forum.xbmc.org/showpost.php?p=536...stcount=67

[url] http://ubuntuforums.org/showthread.php?t=1458300&page=2[/url]
(This post was last modified: 2010-12-25 20:19 by jakeluck1.)
find quote
jakeluck1 Offline
Junior Member
Posts: 34
Joined: Aug 2004
Reputation: 0
Post: #4
x
(This post was last modified: 2010-12-25 20:10 by jakeluck1.)
find quote
coldsource Offline
Junior Member
Posts: 41
Joined: Dec 2010
Reputation: 0
Post: #5
2ami :
Sorry it's my fault I let object files in archive.

Try using :
Quote:make clean
make

It should work. I'll upload a new archive.

EDIT : Done the new archive is online.
(This post was last modified: 2010-12-25 21:12 by coldsource.)
find quote
coldsource Offline
Junior Member
Posts: 41
Joined: Dec 2010
Reputation: 0
Post: #6
jakeluck1 Wrote:thank you, Bob! will try it out here soon.

FYI, a related discussion from our own ph77

http://forum.xbmc.org/showpost.php?p=536...stcount=67

[url] http://ubuntuforums.org/showthread.php?t=1458300&page=2[/url]

Thank you for posting these links. However the approach is not the same. My driver works in userland so there is no need to compile kernel modules. Furthermore the HID mapper is generic, so it can be used with any HID remote, not only ASUS remotes. I only posted ASUS remote as an example since it is the remote I use.

If you have any suggestions or improvement ideas on the driver I'll we glad to develop it.
find quote
2ami Offline
Junior Member
Posts: 7
Joined: Jul 2009
Reputation: 0
Post: #7
coldsource Wrote:2ami :
Sorry it's my fault I let object files in archive.

Try using :


It should work. I'll upload a new archive.

EDIT : Done the new archive is online.

Thanks again bob... it's working now and created map file for my own, but wonder some key such as volume up/down only show 0000000000000 when pressed, but i confirm its working under win 7

.
Quote:/hid_mapper --list-devices
Found HID device at /dev/hidraw0
Manufacturer : ATWF@83-W001
Product name : P-05R UIR_V2A

Code:
sudo ./hid_mapper --learn --manufacturer 'ATWF@83-W001' --product 'P-05R UIR_V2A' --map ''

sudo ./hid_mapper --manufacturer 'ATWF@83-W001' --product 'P-05R UIR_V2A' --map 'aureal.map'

Code:
aureal.map
0000520000000000:KEY_UP
0000510000000000:KEY_DOWN
0000500000000000:KEY_LEFT
00004f0000000000:KEY_RIGHT
0100080000000000:KEY_VIDEO
0100040000000000:KEY_RADIO
01000c0000000000:KEY_1
0100100000000000:KEY_2
0100170000000000:KEY_TV
04003d0000000000:KEY_CLOSE
00004b0000000000:KEY_VOLUMEDOWN
00004e0000000000:KEY_VOLUMEUP
00004e0000000000:KEY_MUTE
04002b0000000000:KEY_PLAYPAUSE
8000070000000000:KEY_NEXTSONG
0300050000000000:KEY_PREVIOUSSONG
0c00280000000000:KEY_FASTFORWARD
0000280000000000:KEY_ENTER
00002a0000000000:KEY_ENTER
0000290000000000:KEY_ESC
0000650000000000:KEY_BACKSPACE

one more question, is it possible to use this usb hid receiver with another remote?
find quote
coldsource Offline
Junior Member
Posts: 41
Joined: Dec 2010
Reputation: 0
Post: #8
Hi 2ami :

HID receivers can generally only be used with the original remote. However as far as I know some universal remotes can work with it

Concerning volume up/down keys I don't know why it doesn't work. The code you get is a key up code, that is when you release the key. It can happen when pressing multiple keys at the same time when learning codes.

Edit : 2ami I sent you a PM I may know what is wrong with these buttons of your remote.
(This post was last modified: 2010-12-27 11:09 by coldsource.)
find quote
2ami Offline
Junior Member
Posts: 7
Joined: Jul 2009
Reputation: 0
Post: #9
coldsource Wrote:Hi 2ami :

HID receivers can generally only be used with the original remote. However as far as I know some universal remotes can work with it

Concerning volume up/down keys I don't know why it doesn't work. The code you get is a key up code, that is when you release the key. It can happen when pressing multiple keys at the same time when learning codes.


Thanks again bob, i have tried several method to use this remote on linux especially on xbmc, I think your driver and method is the most suitable for my remote and it's hid receiver, because somehow the button up, down, left, right navigation can not work on linux. now its working with your driver. Laugh This should be sticky so we have alternative way to manipulate remote based hid receiver.

i dont have - nor plan to buy - universal remote, i though we can use your driver to manage this hid receiver so it can act like lirc. Blush

i will play around with another logitech mouse/keyboard wireless hid dongle later. thanks so much
find quote
jpmayo Offline
Junior Member
Posts: 2
Joined: Jan 2011
Reputation: 0
Post: #10
I was actually trying to set up xbmc as an add on to Fedora 14 with a very generic HID remote and this works! Thank you!

However, when I do a reboot of the computer, I have to reapply the keymap for the remote to work.

I tried adding a script that ran on startup, but it needs superuser priviledge to apply the keymap.

Is there a way to apply the keymap without supperuser priviledge or get it to work on startup?

This is probably more of a Fedora than an xbmc question, but you obviously know what you are talking about with the remote, so I figured I might as well ask.
find quote
Post Reply