XBMC Community Forum
[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)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18


- coldsource - 2011-02-17 11:06

Hi UsagiYojimbo and thanks for your remarks.

In fact the loop line 210 tries to find an event with all 0 codes except the first one, as standard keyboard send this event to notify of a key up event. As you said your remote doesn't send this event but sends 43415400FF77 instead which was not detected.

I've tested your patch and in fact it also works with other remotes since the first event following the key press will be deteced as a key up which I belive is correct. I'll integrate it in the next release.

Could you tell me if the key repetitions are working with this or do you still need a special event to repeat the last key ? I don't think this patch should make key repetition work but who knows Wink


- coldsource - 2011-02-17 11:13

ximon Wrote:Hello, I wonder if anyone can help me, I seem to be stuck fairly early on in the process - I can't seem to blacklist my remote (on xbmclive).

Hi ximon, could you try :
Code:
Section "InputClass"
Identifier "Remote blacklist"
MatchUSBID  "1241:e000"
Option "Ignore" "on"
EndSection

I think it should work in your case.


- UsagiYojimbo - 2011-02-17 21:49

coldsource Wrote:Could you tell me if the key repetitions are working with this or do you still need a special event to repeat the last key ? I don't think this patch should make key repetition work but who knows Wink
It is not working, nor should it.
As the remote uses select, press, press... events for repetition, and the keyboard uses down, down..., up events.
For this to work, I think something like this could be programmed:Nerd
  • read from hid device, and identify the input event
  • if it is a select event, output a key up and a key down event
  • if it is a press event, count it
  • if counter is more than 1, output a key down event again
I believe, this should work with other remotes, too.
By the way, I mapped the buttons on the case as well.Cool


- ximon - 2011-02-18 12:57

coldsource Wrote:Hi ximon, could you try :

*snip*

I think it should work in your case.

Thanks very much, I will try this tonight. I have already prepared and tested my mapping, just needed to be able to blacklist the remote from Xorg…

Thanks again!


Mouse Map - akr884 - 2011-02-18 14:43

coldsource Wrote:You can now affect multiple events to the same code and use wildcards in event definition.

Just tried it out and it works well.

Thanks Coldsource


- UsagiYojimbo - 2011-02-18 15:44

Shayan Wrote:Is there a keyboard shortcut that maps directly to shutdown?
Tried to map to KEY_POWER?

Edit:
akr884 Wrote: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
I believe removing that first condition would stop akr88's mouse pad from repeating until another key is pressed, as these contain non-first zero bytes, too...


- coldsource - 2011-02-18 16:18

UsagiYojimbo Wrote:I believe removing that first condition would stop akr88's mouse pad from repeating until another key is pressed, as these contain non-first zero bytes, too...

Keys 02 00 xx yy for akr884 are relative mouse movement events (e.g. move up by 4 pixels) so there is only one event. This bloc was already disabled for mouse movement events. Mouse and keyboard events are treated separately with different mappings (--map and --map-mouse) as their management is not the same on uinput.


- Psycho_Dad - 2011-02-18 22:13

Hi coldsource, thank you for last reply (few pages before :).

First of all I should mention that building hid_mapper on Debian Squeeze failed with the following message.

Code:
~$ cd hid_mapper_beta/
~$ make
~$ g++ -c -Iinclude main.cpp
~$ gcc -c -Iinclude uinput_device.c
~$ gcc -c -Iinclude hid.c
~$ gcc -c -Iinclude signals.c
~$ g++ -c -Iinclude keys_definition.cpp
~$ keys_definition.cpp:458: error: ‘KEY_CAMERA_FOCUS’ was not declared in this scope
~$ keys_definition.cpp:705: error: ‘KEY_RFKILL’ was not declared in this scope
~$ keys_definition.cpp:777: error: ‘KEY_WPS_BUTTON’ was not declared in this scope
~$ make: *** [keys_definition.o] Error 1

I've checked that my /usr/include/linux/input.h doesn't contain these definitions. Commenting out the corresponding three rows (in the integer array) in keys_definition.cpp solved the problem.

Code:
~$ uname -a
~$ Linux debian 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64 GNU/Linux

After building hid_mapper I wrote down some key codes for my remote control and made a mapping file, but the following command failed.
Code:
~$ sudo ./hid_mapper --lookup-id --manufacturer <hex> --product <hex> --map <file>
~$ Loaded map file ~/<file>
~$ Found HID device
~$ Opened HID interface on /dev/hidraw1
~$ Unable to setup event device

I've read through the thread and Diego2002 had the same problem. It seems he managed to solve it with. I've tried the same thing.

Code:
~$ ls -l /dev/uinput
~$ # Returned some error that it does not exist or something.
~$ sudo modprobe uinput
~$ # Utter silence.
~$ ls -l /dev/uinput
~$ crw------- 1 root root 10, 223 Feb 18 20:46 /dev/uinput
~$ # After running hid_mapper as shown in the previous code fragment I get that same output.

Any idea? :) Thanks!


- Mindzai - 2011-02-19 02:39

Hi coldsource

I'm having an issue with (I think) key up codes not being recognised for my remote. Learn mode worked fine and I made a map, I can start the driver but as soon as I press a button not much else works, it's as if the remote locks up.

I see that my remote is not sending 0 for a key up code in some cases, is this the issue? If so is there anything that can be done to correct it?

The remote seems to consist of 2 HID devices if that makes any difference.

Here is my key map, the commented code is the key up code for the associated key down code:

Code:
# Home
00040100:KEY_HOME
# 00 04 00 00

# Power
000202:KEY_POWER
# 00 02 00

# Red
00048000:KEY_RED
# 00 04 00 00

# Green
00040800:KEY_GREEN
# 00 04 00 00

# Yellow
00041000:KEY_YELLOW
# 00 04 00 00

# Blue
00042000:KEY_BLUE
# 00 04 00 00

# Live TV
00040200:KEY_TV
# 00 04 00 00

# Record
0003800000:KEY_RECORD
# 00 03 00 00 00

# Radio
0003040000:KEY_RADIO
# 00 03 00 00 00

# SAP
00040010:KEY_FAVORITES
# 00 04 00 00

# Teletext
00040020:KEY_TEXT
# 00 04 00 00

# Last Channel
00040040:KEY_LAST
# 00 04 00 00

# Subtitle
00040008:KEY_SUBTITLE
# 00 04 00 00

# Language
00040002:KEY_LANGUAGE
# 00 04 00 00

# Angle
00040002:KEY_ANGLE
# 00 04 00 00

# Back
0003000400:KEY_BACKSPACE
# 00 03 00 00 00

# Info
0003000002:KEY_INFO
# 00 03 00 00 00

# DVD Menu
00040004:KEY_MENU
# 00 04 00 00

# Volume Up
0003200000:KEY_VOLUMEUP
# 00 03 00 00 00

# Voulume Down
0003400000:KEY_VOLUMEDOWN
# 00 03 00 00 00

# Mute
0003100000:KEY_MUTE
# 00 03 00 00 00

# Channel/Page Up
0003000100:KEY_CHANNELUP
# 00 03 00 00 00

# Channel/Page Down
0003000200:KEY_CHANNELDOWN
# 00 03 00 00 00

# Up
0000520000000000:KEY_UP
# 00 00 00 00 00 00 00 00

# Down
0000510000000000:KEY_DOWN
# 00 00 00 00 00 00 00 00

# Left
0000500000000000:KEY_LEFT
# 00 00 00 00 00 00 00 00

# Right
00004f0000000000:KEY_RIGHT
# 00 00 00 00 00 00 00 00

# OK
0000280000000000:KEY_OK
# 00 00 00 00 00 00 00 00

# Play
0003000040:KEY_PLAY
# 00 03 00 00 00

# Pause
0003000080:KEY_PAUSE
# 00 03 00 00 00

# Reverse
0003000040:KEY_REWIND
# 00 03 00 00 00

# Forward
0003000008:KEY_FASTFORWARD
# 00 03 00 00 00

# Skip Backwards
0003020000:KEY_PREVIOUSSONG
# 00 03 00 00 00

# Skip Forward
0003010000:KEY_NEXTSONG
# 00 03 00 00 00

# Stop
0003001000:KEY_STOP
# 00 03 00 00 00

# 1
00001e0000000000:KEY_NUMERIC_1
# 00 00 00 00 00 00 00 00

# 2
00001f0000000000:KEY_NUMERIC_2
# 00 00 00 00 00 00 00 00

# 3
0000200000000000:KEY_NUMERIC_3
# 00 00 00 00 00 00 00 00

# 4
0000210000000000:KEY_NUMERIC_4
# 00 00 00 00 00 00 00 00

# 5
0000220000000000:KEY_NUMERIC_5
# 00 00 00 00 00 00 00 00

# 6
0000230000000000:KEY_NUMERIC_6
# 00 00 00 00 00 00 00 00

# 7
0000240000000000:KEY_NUMERIC_7
# 00 00 00 00 00 00 00 00

# 8
0000250000000000:KEY_NUMERIC_8
# 00 00 00 00 00 00 00 00

# 9
0000260000000000:KEY_NUMERIC_9
# 00 00 00 00 00 00 00 00

# 0
0000270000000000:KEY_NUMERIC_0
# 00 00 00 00 00 00 00 00

# Clear
00004c0000000000:KEY_CLEAR
# 00 00 00 00 00 00 00 00

# Enter
0000280000000000:KEY_ENTER
# 00 00 00 00 00 00 00 00



- ximon - 2011-02-19 13:49

coldsource Wrote:Hi ximon, could you try :
Code:
Section "InputClass"
Identifier "Remote blacklist"
MatchUSBID  "1241:e000"
Option "Ignore" "on"
EndSection

I think it should work in your case.

Hmm, no luck - Xorg won't load, boots to the console. Any ideas?

Thanks again for your help!

Edit: The remote is the only input device connected to the system, is it possible that Xorg requires at least one input device in order to start?