[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)
- akr884 - 2011-02-05 19:16
Quote:If I understand your problem, the mapping works but the key repetition doesn't. Is it right? I'm not sure to understand what you would like to do.
From the hid lookup
Quote:aaron@aaron:~/Desktop/hid_mapper_beta$ ./hid_mapper --list-devices --lookup-id
This is holding the 'mouse' up arrow for a few seconds
Quote:Opened HID interface on /dev/hidraw0
No matter which code I choose as the action button among those, the key press sticks until I push another button. My guess is that the 'mouse' buttons just have a key press that isn't followed by a key release, so the button just 'sticks' and repeats until I press something else. My solution was to route the 'keyboard' through hid_mapper and let X control the 'mouse' but I can't get X.org to only ignore one of the two inputs and if I use hid_mapper, the 'mouse' is useless because all the button presses stick (hid_mapper works well for me, it would just be nice to be able to get these buttons working too)
The remote is a cheap MCE remote from amazon.co.uk
I think it's this one, but I couldn't get it to work with lirc in ubuntu 10.10; nothing would show up using irw after successfully programming the remote.
- coldsource - 2011-02-09 01:25
Hi and sorry for the late reply.
Here is the upstart script to place in /etc/init/remote_mapper.conf :
Be careful to use full paths and not relative ones as you can't know the working directory of upstart.
Also note that this is an upstart script, it will work for ubuntu only. For other distributions you can use /etc/rc.local or the standard init scripts.
I confirm that there is no key up notification or at least that hid_mapper won't detect it as it expects an all 0 code. Did you also release the key in your previous example ? Because even if the 'Key up' code was '02 00 00 e6' (the last event from your dump), it sounds strange that it is emitted multiple times.
Could you try with several key and try to guess what is the key up code ? If it is fixed I could add a command line option to specify it and all should be working well.
- akr884 - 2011-02-09 21:09
The remote emits all those numbers in sequence (not all at once) when I hold the 'mouse' up key for maybe a second-and-a-half. I can choose any one of those key codes and use it as the hook in my .map file and it works (of course, if I choose a code that's further down, there's a delay between holding the 'mouse' up and getting a button response though).
If I just tap the button, then the only output is
02 00 00 fc
A longer press gives
02 00 00 fc
02 00 00 fa
However, regardless of which button press I use as the key code in the .map file, the button 'sticks', meaning even a quick press causes continuous upward scrolling (if it's programmed as the 'up' button) until I hit another key. I think that, because they're 'mouse' presses, the remote sends key presses without indicating a key release like it does with all the other buttons (which work fine).
I think that the button sequence changes as I hold it down to create accelerated mouse scrolling, but again that's just a best guess.
- coldsource - 2011-02-09 23:05
akr884 Wrote:I think that the button sequence changes as I hold it down to create accelerated mouse scrolling, but again that's just a best guess.
I also think so. These keys must me programmed for mouse movement so of course there is no key release. I'll write a new beta version with a specific map file for mouse events. This will be used to map key codes to movements (e.g. up by 4 pixels). This way you'll be able to setup these buttons with acceleration setting, that is :
Quote:02 00 00 fa = Up 1 pixel
I think this is the only way to setup these buttons correctly.
I'll post here as soon as the new beta version is ready.
Thanks for the new informations.
upstart script - Shayan - 2011-02-10 05:38
coldsource Wrote:Hi and sorry for the late reply.
This is my first time messing around with upstart, and it doesn't seem to work for me. I placed the remote_mapper.conf file in the /etc/init directory. However, it doesn't seem to start the service at bootup. I'm not sure if there is anything extra that I need to do.
Right now once the system boots up, if I do a status remote_mapper it says the service is stopped. If I do a start remote_mapper, there is an error and the service doesn't start. However, if I do a sudo start remote_mapper, the service starts fine.
Is there something that needs to be configured for upstart to start remote_mapper at boot time?
- coldsource - 2011-02-10 11:04
You shouldn't have anything else to do as upstart read it's configuration at each boot.
You can try to check if the service is started at by the following way, after booting up try :
If it is not started, then your problem might come from the condition :
This means that remote mapper should be started once udev is started. Depending on your distribution it might not work. Could you tell me what distribution you are using ?
You could also try to get the condition of another script that runs after udev, for example gdm or kdm. Edit /etc/init/kdm.conf (for example) et copy the "start on" stanza. On ubuntu 10.10 it is :
Then replace start on started udev in your current remote_mapper.conf by the standza you juste copied.
- coldsource - 2011-02-10 14:53
I've finished the first stage of the new version and the beta is now ready. You can find it at :
You will have to create 2 distinct map files, one for the keyboard actions (you can keep your existing one) and the other for mouse actions. The format is the following :
Quote:00004f0000000000:REL_X:5This file maps 4 keys to the 4 different directions of the cursor (right, left, up and down) and the cursor will move by 5 pixels in each case.
You can affect multiple key codes to the same direction but with different movement step, e.g. :
Quote:00004f0000000000:REL_X:5This will be useful in your case to manage cursor acceleration.
Once your map file is ready, start hid_mapper with the following :
This will load both map files and it should do the trick.
Let me know if it works !
- Shayan - 2011-02-11 03:09
coldsource Wrote:Hi Shayan,
Yeah, I had checked the running processes earlier and had no such luck. Upstart was telling me it wasn't running either when I did a status on the process.
It seems as though it was the start on started udev that was the problem for me. I replaced it with the start on stanza from gdm.conf and now the process starts up great for me. Thanks for your help.
I'm running Ubuntu 10.10
'Mouse' Remote - akr884 - 2011-02-12 13:47
Quote:You can affect multiple key codes to the same direction but with different movement step
Coldsource, everything works really well including the acceleration (using 2,4,6... for the pixel movements)
However, my remote sends the presses like this
02 00 xx yy
where 02 00 defines it as a mouse press and xx is movement along the x-axis and yy is movement along the y-axis - so that there are actually 8 classes of mouse movements including diagonals.
I tried to string :REL_X:2:REL_Y:2 and got the message that the 'movement is too long'. I'm sure it's a trivial fix but it makes me wonder why not allow stringed definitions throughout the keymaps? For a keymap, it might be useful to map a button the xxxxxx:KEY_ALT:KEY_F2 for example to launch GnomeDo or something along those lines as just one example.
I could probably define
02 00 x1 y1
as a vertical movement 0200x1y1:REL_X:2
then define the same press as a horizontal movement 0200x1y1:REL_Y:2
to get a diagonal movement but that seems like an inelegant hack, so I'll wait for your response coldsource
Also in /usr/include/linux/inputid.h
there's a map for BTN_LEFT and BTN_RIGHT (Mouse Clicks), but HID_MAPPER says it doesn't recognize them - If I add keys to keys_definition.cpp in the top and bottom section - will they work? I'll try it and see
Shutdown commands - Shayan - 2011-02-12 23:38
Another question regarding the hid_mapper. Has anyone gotten the shutdown command to work with the remote? I can select shutdown from the menu in xbmc and it sends my box into hibernate. But if there was some way i could shut the box down by pressing the power button on my remote, that would be great. Is there a keyboard shortcut that maps directly to shutdown?