[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
Mindzai Offline
Fan
Posts: 333
Joined: Aug 2010
Reputation: 0
Post: #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.
find quote
ximon Offline
Member
Posts: 50
Joined: Jan 2009
Reputation: 0
Location: Nantes, France
Post: #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
find quote
ximon Offline
Member
Posts: 50
Joined: Jan 2009
Reputation: 0
Location: Nantes, France
Post: #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!
(This post was last modified: 2011-02-19 17:14 by ximon.)
find quote
UsagiYojimbo Offline
Member
Posts: 83
Joined: Feb 2010
Reputation: 1
Location: Debrecen, Hungary
Post: #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...
find quote
ximon Offline
Member
Posts: 50
Joined: Jan 2009
Reputation: 0
Location: Nantes, France
Post: #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…
find quote
Psycho_Dad Offline
Junior Member
Posts: 6
Joined: Feb 2011
Reputation: 0
Post: #76
The blacklisting is only needed to block the key presses from your remote to the X server. If you have working buttons and you are satisfied with them you don't need to block it. And it won't be a problem if you have two devices which for example can send an 'F1' key press to the X server. You won't be using the two at the same time (I assume), so the X server will only know that the key press was an 'F1', it doesn't care about whom send it.

At least this is how I see, and I couldn't even map my HID device with hid_mapper yet. : ) However, blacklisting is a must for me, because my remote switches to tty2-4 with some key presses, and sends combinations like 'CTRL+ALT+SHIFT+F+F1+DEL+:D' and stuff to the X server.
(This post was last modified: 2011-02-19 19:25 by Psycho_Dad.)
find quote
ximon Offline
Member
Posts: 50
Joined: Jan 2009
Reputation: 0
Location: Nantes, France
Post: #77
UsagiYojimbo Wrote: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...

Also, my remote only produces stupid key presses (control shift ?) and is a PITA to set up in keymap.xml.

It would be much easier for me to be able to assign 'normal' keyboard keys to each button on the remote and use the default xbmc keymap - for example backspace for back, esc for home, c for contextual menu…

But to do this I need to get the blacklist to work…

Getting a fully working remote is the bane of my xbmc life - I would just buy a MCE2 remote, but it is impossible to find one where I live (France). If anyone has any ideas, please share!

Thanks!
find quote
coldsource Offline
Junior Member
Posts: 41
Joined: Dec 2010
Reputation: 0
Post: #78
Hi ximon,

Which distribution are you using ? MatchUSBID is refered in xorg.conf manual so it should work.

Anyway have you tried :
Quote:MatchVendor "HOLTEK"

I think it could work.
find quote
ximon Offline
Member
Posts: 50
Joined: Jan 2009
Reputation: 0
Location: Nantes, France
Big Grin    Post: #79
coldsource Wrote:Hi ximon,

Which distribution are you using ? MatchUSBID is refered in xorg.conf manual so it should work.

Anyway have you tried :


I think it could work.

I'm using XBMCLive Dharma. Tried "MatchVendor "HOLTEK"" and success!

Thanks so much for your help, and of course for the HID Mapper. Laugh
find quote
Mindzai Offline
Fan
Posts: 333
Joined: Aug 2010
Reputation: 0
Post: #80
Mindzai Wrote: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

I'm still having no luck with this. I tried a different remote and that does the same. I notice that hid_mapper is exiting saying "Segmentation fault". It can't be an issue with the hardware because the second remote worked fine when I tested it at work (Ubuntu 10.10), but on my Live machine it breaks. Is there anything I can do to debug this?

Here is the output from the command:

Code:
karl@mediacenter:~/hid_mapper_beta$ sudo ./hid_mapper --lookup-id --manufacturer '046e' --product '5577' --map emprex.map
Loaded map file emprex.map
Found HID device
Opened HID interface on /dev/hidraw0
Opened HID interface on /dev/hidraw1
Generic USB mapper driver setup
Segmentation fault
(This post was last modified: 2011-02-23 13:59 by Mindzai.)
find quote
Post Reply