![]() |
|
[LINUX] Generic HID Remote Driver for XBMC (Drivers for XBMC on Linux and XBMC Live) - Printable Version +- XBMC Community Forum (http://forum.xbmc.org) +-- Forum: Help and Support (/forumdisplay.php?fid=33) +--- Forum: XBMC General Help and Support (/forumdisplay.php?fid=111) +---- Forum: Linux and Live support (/forumdisplay.php?fid=52) +---- Thread: [LINUX] Generic HID Remote Driver for XBMC (Drivers for XBMC on Linux and XBMC Live) (/showthread.php?tid=88560) |
[LINUX] Generic HID Remote Driver for XBMC (Drivers for XBMC on Linux and XBMC Live) - coldsource - 2010-12-25 13:43 I have bought an ASUS motherboard which was supplied with an IR remote control. Here is a picture of the remote : ![]() 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 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"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 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 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 - 2ami - 2010-12-25 19:29 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.cpp .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 - jakeluck1 - 2010-12-25 20:02 thank you, Bob! will try it out here soon. FYI, a related discussion from our own ph77 http://forum.xbmc.org/showpost.php?p=536174&postcount=67 [url] http://ubuntuforums.org/showthread.php?t=1458300&page=2[/url] - jakeluck1 - 2010-12-25 20:04 x - coldsource - 2010-12-25 20:45 2ami : Sorry it's my fault I let object files in archive. Try using : Quote:make clean It should work. I'll upload a new archive. EDIT : Done the new archive is online. - coldsource - 2010-12-25 21:09 jakeluck1 Wrote:thank you, Bob! will try it out here soon. 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. - 2ami - 2010-12-26 16:58 coldsource Wrote:2ami : 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 Code: sudo ./hid_mapper --learn --manufacturer 'ATWF@83-W001' --product 'P-05R UIR_V2A' --map ''Code: aureal.mapone more question, is it possible to use this usb hid receiver with another remote? - coldsource - 2010-12-26 17:37 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. - 2ami - 2010-12-27 11:20 coldsource Wrote:Hi 2ami : 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. 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. ![]() i will play around with another logitech mouse/keyboard wireless hid dongle later. thanks so much - jpmayo - 2011-01-01 22:40 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. |