• 1
  • 3
  • 4
  • 5(current)
  • 6
  • 7
  • 13
[LINUX] Generic HID Remote Driver for XBMC (Drivers for XBMC on Linux and XBMC Live)
#61
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
Reply
#62
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.
Reply
#63
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
Reply
#64
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!
Reply
#65
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
Reply
#66
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...
Reply
#67
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.
Reply
#68
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!
Reply
#69
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
Reply
#70
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?
Reply
#71
ximon Wrote: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?

Xorg starts for me even if I blacklist the only input device.
Reply
#72
Code:
Parse error on line 3 of section InputClass in file /usr/lib/X11/xorg.conf.d/50-remote.conf
    "MatchUSBID" is not a valid keyword in this section.

OK, I found the reason why X won't start, 'MatchUSBID' doesn't seem to be allowed.

Is there another way I can blacklist this remote from Xorg?

Code:
xbmc@XBMCLive:~$ lsusb
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 1241:e000 Belkin
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The remote is a Speedlink SL-6399, it shows as 'Belkin' in lsusb (for reasons beyond my comprehension), and 'HOLTEK USB to PS2 Devic' elsewhere.

Code:
xbmc@XBMCLive:~$ udevadm info --attribute-walk --name=/dev/hidraw0

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2:1.0/0003:1241:E000.0001/hidraw/hidraw0':
    KERNEL=="hidraw0"
    SUBSYSTEM=="hidraw"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2:1.0/0003:1241:E000.0001':
    KERNELS=="0003:1241:E000.0001"
    SUBSYSTEMS=="hid"
    DRIVERS=="generic-usb"

  looking at parent device '/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2:1.0':
    KERNELS=="3-2:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="usbhid"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{bInterfaceClass}=="03"
    ATTRS{bInterfaceSubClass}=="01"
    ATTRS{bInterfaceProtocol}=="01"
    ATTRS{modalias}=="usb:v1241pE000d235Adc00dsc00dp00ic03isc01ip01"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1d.1/usb3/3-2':
    KERNELS=="3-2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 2"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="a0"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{urbnum}=="16"
    ATTRS{idVendor}=="1241"
    ATTRS{idProduct}=="e000"
    ATTRS{bcdDevice}=="235a"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="8"
    ATTRS{speed}=="1.5"
    ATTRS{busnum}=="3"
    ATTRS{devnum}=="2"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="HOLTEK"
    ATTRS{product}=="USB To PS2 Devic"

  looking at parent device '/devices/pci0000:00/0000:00:1d.1/usb3':
    KERNELS=="usb3"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{urbnum}=="32"
    ATTRS{idVendor}=="1d6b"
    ATTRS{idProduct}=="0001"
    ATTRS{bcdDevice}=="0206"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="12"
    ATTRS{busnum}=="3"
    ATTRS{devnum}=="1"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="2"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Linux 2.6.32-25-generic uhci_hcd"
    ATTRS{product}=="UHCI Host Controller"
    ATTRS{serial}=="0000:00:1d.1"
    ATTRS{authorized_default}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1d.1':
    KERNELS=="0000:00:1d.1"
    SUBSYSTEMS=="pci"
    DRIVERS=="uhci_hcd"
    ATTRS{vendor}=="0x8086"
    ATTRS{device}=="0x27c9"
    ATTRS{subsystem_vendor}=="0x1297"
    ATTRS{subsystem_device}=="0x2005"
    ATTRS{class}=="0x0c0300"
    ATTRS{irq}=="19"
    ATTRS{local_cpus}=="ff"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{modalias}=="pci:v00008086d000027C9sv00001297sd00002005bc0Csc03i00"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

Code:
xbmc@XBMCLive:~/hid_mapper_beta$ cat /proc/bus/input/devices

*snip*

I: Bus=0003 Vendor=1241 Product=e000 Version=0110
N: Name="HOLTEK USB To PS2 Devic"
P: Phys=usb-0000:00:1d.1-2/input0
S: Sysfs=/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2:1.0/input/input5
U: Uniq=
H: Handlers=kbd event5
B: EV=120013
B: KEY=10000 7 ff800000 7ff febeffdf ffefffff ffffffff fffffffe
B: MSC=10
B: LED=1f

I: Bus=0003 Vendor=1241 Product=e000 Version=0110
N: Name="HOLTEK USB To PS2 Devic"
P: Phys=usb-0000:00:1d.1-2/input1
S: Sysfs=/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2:1.1/input/input6
U: Uniq=
H: Handlers=kbd mouse1 event6
B: EV=1f
B: KEY=837fff 2c3027 bf004444 0 0 1f001f c04 a27c000 267bfa d941dfed 9e0000 0 0 0
B: REL=143
B: ABS=7f01 0
B: MSC=10

*snip*

Any help is greatly appreciated!

Cheers guys.




Edit: hid_mapper's device list in case it helps:

Code:
xbmc@XBMCLive:~/hid_mapper_beta$ ./hid_mapper --list-devices
Found HID device at /dev/hidraw0
  Manufacturer : HOLTEK
  Product name : USB To PS2 Devic

Found HID device at /dev/hidraw1
  Manufacturer : HOLTEK
  Product name : USB To PS2 Devic
Reply
#73
Quote:I seem to have accidentally found a solution, or at least a workaround…

Code:
Section "InputClass"
Identifier "SL-6399 Blacklist"
# MatchUSBID "1241:e000"
# MatchVendor "Belkin"
Option "Ignore" "on"
EndSection

I temporarily commented out the Match lines in /usr/lib/X11/xorg.conf.d/50-remote.conf while I try to find a solution, and, after a reboot, my remote control is not working! Yay!

Xorg.0.log has a bunch of lines confirming that input from the remote is being ignored:
Code:
(**) HOLTEK USB To PS2 Devic: Ignoring device from InputClass "SL-6399 Blacklist"
(II) config/udev: Adding input device HOLTEK USB To PS2 Devic (/dev/input/event6)

I can only assume that commenting out the Match lines is making Xorg ignore all input from any device, but you can't argue with the results.

If anyone has a 'cleaner' way of blacklisting my remote I'm all ears (eyes?), but at least in the meantime I can carry on setting up the HID mapper.

EDIT: Nope, not working. It seems that my 50-remote.conf is making Xorg ignore all input, including that of hid_mapper.

So, I still need a way of blacklisting my remote if anyone can help…

Thanks!
Reply
#74
ximon Wrote:(II) config/udev: Adding input device HOLTEK USB To PS2 Devic (/dev/input/event6)
I do not really understand why do you need hid_mapper, again?
If your HID device produces an event device (as mentioned above) X already uses it. You should be able to configure button-presses to key (or mouse) events in Xkbd...
Or you could use LiRC with driver devinput,too...
Reply
#75
UsagiYojimbo Wrote:I do not really understand why do you need hid_mapper, again?

Because only a handful of keys on my cheapo (not MCE) remote are recognized at the moment and I am trying to get as many buttons working as possible for optimal control of xbmc.

In theory though, could I skip the blacklist in xorg and only configure hid_mapper for the keys that aren't working? Maybe that would be the simplest solution…
Reply
  • 1
  • 3
  • 4
  • 5(current)
  • 6
  • 7
  • 13

Logout Mark Read Team Forum Stats Members Help
[LINUX] Generic HID Remote Driver for XBMC (Drivers for XBMC on Linux and XBMC Live)7