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: Kodi 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


- coldsource - 2011-01-23 14:15

Hello Cucurbitace,

Could you try this :
Quote:uname -a
udevadm info --attribute-walk --name=/dev/hidraw3 | grep manufacturer
udevadm info --attribute-walk --name=/dev/hidraw3 | grep product

And post the results here please.

Also could you tell me which distribution you use ?

Thanks


- Cucurbitace - 2011-01-23 21:44

Hi, thanks for trying to help. Smile I'm using Ubuntu 10.10 (32 bits)

Here are the results of the commands:

uname -a
Code:
Linux ubuntu 2.6.35-24-generic #42-Ubuntu SMP Thu Dec 2 01:41:57 UTC 2010 i686 GNU/Linux

udevadm info --attribute-walk --name=/dev/hidraw3 | grep manufacturer
Code:
ATTRS{[color=#990000]manufacturer[/color]}=="Linux 2.6.35-24-generic uhci_hcd"

udevadm info --attribute-walk --name=/dev/hidraw3 | grep product
Code:
ATTRS{[color=#990000]product[/color]}=="UHCI Host Controller"

I hope you can get something out of this. Big Grin


- coldsource - 2011-01-23 23:26

Ok, it seems the problem is that your device is UHCI and not OHCI (had only tested on OHCI) and so does not report proper informations.

Could you try :
Quote:lsusb

And a full attribute walk :
Quote:udevadm info --attribute-walk --name=/dev/hidraw3

Not sure but I think even so it will report a proper Vendor ID and Product ID. If it is the case I'll write a patch so you can select the proper device by specifying ID instead of names and it should work.


- Cucurbitace - 2011-01-23 23:52

Here goes lsusb:
Code:
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 002: ID 045e:0084 Microsoft Corp. Basic Optical Mouse
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 003: ID 0603:00f2 Novatek Microelectronics Corp.
Bus 004 Device 002: ID 1131:1004 Integrated System Solution Corp. Bluetooth Device
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 13ec:0006 Zydacron HID Remote Control
Bus 003 Device 002: ID 04a9:2206 Canon, Inc. CanoScan N650U/N656U
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 009: ID 152e:2507 LG (HLDS)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I suppose we can tell it is Zydacron HID Remote Control we're talking about.

And here is the full attribute one:
Code:
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:1a.0/usb3/3-2/3-2:1.0/0003:13EC:0006.0001/hidraw/hidraw3':
    KERNEL=="hidraw3"
    SUBSYSTEM=="hidraw"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2:1.0/0003:13EC:0006.0001':
    KERNELS=="0003:13EC:0006.0001"
    SUBSYSTEMS=="hid"
    DRIVERS=="zydacron"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/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}=="00"
    ATTRS{bInterfaceProtocol}=="00"
    ATTRS{modalias}=="usb:v13ECp0006d0100dc00dsc00dp00ic03isc00ip00"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb3/3-2':
    KERNELS=="3-2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="a0"
    ATTRS{bMaxPower}=="120mA"
    ATTRS{urbnum}=="10282"
    ATTRS{idVendor}=="13ec"
    ATTRS{idProduct}=="0006"
    ATTRS{bcdDevice}=="0100"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="8"
    ATTRS{speed}=="1.5"
    ATTRS{busnum}=="3"
    ATTRS{devnum}=="3"
    ATTRS{devpath}=="2"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{authorized}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb3':
    KERNELS=="usb3"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{urbnum}=="50"
    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{devpath}=="0"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="2"
    ATTRS{quirks}=="0x0"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Linux 2.6.35-24-generic uhci_hcd"
    ATTRS{product}=="UHCI Host Controller"
    ATTRS{serial}=="0000:00:1a.0"
    ATTRS{authorized_default}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0':
    KERNELS=="0000:00:1a.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="uhci_hcd"
    ATTRS{vendor}=="0x8086"
    ATTRS{device}=="0x2937"
    ATTRS{subsystem_vendor}=="0x1043"
    ATTRS{subsystem_device}=="0x8277"
    ATTRS{class}=="0x0c0300"
    ATTRS{irq}=="16"
    ATTRS{local_cpus}=="ff"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{modalias}=="pci:v00008086d00002937sv00001043sd00008277bc0Csc03i00"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""

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

Thanks.


- coldsource - 2011-01-24 00:59

Thanks for the informations Cucurbitace,

It is working as I suspected, that is it reports only numeric vendor and product name. I have written a patch that you can download here :

hid_mapper_beta.tar.gz

Using this patch you can now use numeric IDs :
Quote:./hid_mapper --list-devices --lookup-id

Based on lsusb I think it should work with something like this :
Quote:./hid_mapper --learn --lookup-id --manufacturer '13ec' --product '0006'

Hope it will work !


- Cucurbitace - 2011-01-24 21:12

Thanks for the work. I'm going to give it a try right now!


- Diego2002 - 2011-01-25 23:43

Hi Bob/coldsource! Smile

I'm using the next Ubuntu distribution:
Distributor ID: Ubuntu
Description: Ubuntu 10.04.1 LTS - XBMCLive Dharma
Release: 10.04
Codename: lucid

I compiled the code successfully now (after deleting the three keys from keys_definition.cpp). After that - I had the same problem as Cucurbitace, I needed to use the beta version. Everything worked, I created a map file, only to test, with this content:
00033002000104280004012000030000:KEY_F

I tried to load this map, but I received this error:
Loaded map file test.map
Found HID device
Opened HID interface on /dev/hidraw0
Unable to setup event device

I have to admit, I skipped a step: to blacklist the device in Xorg, becasuse I thought it's not necessary with this distro.

Could be this the problem?

Should I make a try?

Thx
Diego


- coldsource - 2011-01-26 00:57

Diego,

Could you confirm me that learn mode is working ?
Also check that you are runing hid_mapper as root, uinput won't be able to create device as non-root.

You can also check the properties on uinput file :
Quote:ls -l /dev/uinput

It is possible that your kernel doesn't have built-in uinput support, as root try
Quote:modprobe uinput
And then relaunch hid_mapper.

If none of these work, could you post the result of :
Quote:ls -l /dev/uinput
dmesg | tail
uname -a

Concerning Xorg blacklist, I don't think it could cause the error. It is just used to avoid double keys inputs (from Xorg and from the HID mapper).

Bob


- Cucurbitace - 2011-01-26 08:17

Hi Coldsource,

sorry for the late reply, I could not get full access to the computer before, it's the media server of the flat and I had to wait for no one to use it. Wink

Anyway, it didn't work. Sad

Here is the result of the command:

./hid_mapper --learn --lookup-id --manufacturer '13ec' --product '0006'

Code:
Found HID device
Unable to open HID device

At first I thought that is might be because I didn't blacklisted the remote from X11. So I did create a 50-remote.conf in /usr/share/X11/xorg.conf.d like you explained at the beginning of this thread. Here it is:

Code:
Section "InputClass"
Identifier "Remote blacklist"
MatchProduct "0006"
Option "Ignore" "on"
EndSection

And it works, my computer doesn't get input from the remote anymore. But the command still gives the same error.


- coldsource - 2011-01-26 10:41

Hi Cucurbitace,

Are you sure you are running hid_mapper as root ? Detection can be done as non-root but not mapping.

Try running it with a sudo it should work.


- Cucurbitace - 2011-01-26 16:43

Yup, my bad, I used the command as a normal user. Blush Thanks. I'll give a try again as soon as I have full access to the media center.


- Diego2002 - 2011-01-26 22:12

Hi Coldsource/Bob!

Yes, I can confirm, that learn mode is working, because when I press a button, a lot of numbers appear.

I logged in as root also.

Quote:ls -l /dev/uinput
Quote:ls: cannot access /dev/uinput: No such file or directory

Quote:modprobe uinput
Quote:Returns nothing (no output, not errors)

So the next try:
Quote:ls -l /dev/uinput
Quote:crw-r----- 1 root root 10, 223 2011-01-26 20:52 /dev/uinput

Quote:dmesg | tail
Quote:[ 1080.652048] usb 3-4: new low speed USB device using ohci_hcd and address 2
[ 1080.868282] usb 3-4: configuration #1 chosen from 1 choice
[ 1080.878639] input: LITEON Technology USB Multimedia Keyboard as /devices/pci0000:00/0000:00:04.0/usb3/3-4/3-4:1.0/input/input8
[ 1080.878938] generic-usb 0003:046D:C313.0002: input,hidraw1: USB HID v1.10 Keyboard [LITEON Technology USB Multimedia Keyboard] on usb-0000:00:04.0-4/input0
[ 1080.891323] input: LITEON Technology USB Multimedia Keyboard as /devices/pci0000:00/0000:00:04.0/usb3/3-4/3-4:1.1/input/input9
[ 1080.891672] generic-usb 0003:046D:C313.0003: input,hidraw2: USB HID v1.10 Device [LITEON Technology USB Multimedia Keyboard] on usb-0000:00:04.0-4/input1
[ 1122.959639] input: Generic USB input mapper as /devices/virtual/input/input10
[ 1154.209722] input: Generic USB input mapper as /devices/virtual/input/input11
[ 1343.287807] input: Generic USB input mapper as /devices/virtual/input/input12
[ 1387.907595] usb 3-4: USB disconnect, address 2

Quote:uname -a
Quote:Linux XBMCLive 2.6.32-26-generic #48-Ubuntu SMP Wed Nov 24 09:00:03 UTC 2010 i686 GNU/Linux

I tried to run once more the command, but now the message is different:
Quote:Loaded map file test.map
Found HID device
Opened HID interface on /dev/hidraw0
Generic USB mapper driver setup

At this point the bash signal dissapears, I can press any button, and only Ctrl-C stops whatewer it does...


- coldsource - 2011-01-27 00:23

Hi Diego,

The main problem comes from the fact that uinput if not built in your kernel. After loading the module with:
Quote:modprobe uinput
uinput is loaded correctly since you can see the uinput main device in /dev/uinput as ls shows.
I think the last try was the good one because the last message of :
Quote:Loaded map file test.map
Found HID device
Opened HID interface on /dev/hidraw0
Generic USB mapper driver setup
proved hid_mapper started correctly.

At this point you should be able to press the remote button you mapped as 'KEY_F' and see a 'F' appear in any X application. If it does not work try blacklisting your remote from Xorg because it can cause confilcts to have both Xorg and hid_mapper listen to the same device.

Remember that hid_mapper must be running when you press the remote button for this to work (pressing CTRL C will quit hid_mapper). If it is working you can do the full mapping and start hid_mapper at boot by starting it in /etc/rc.local.


- Cucurbitace - 2011-01-27 19:43

It is working ! Thanks a lot ! I still have to make a clean map file (5 keys are not recognized and I have to figure out how map all the others). But congratulations coldsource, nice piece of coding you've made. Big Grin


- Cucurbitace - 2011-01-27 22:05

I was hoping to use this post to share my map file, but I found another problem:

Every key that use a value above 9 (A to E) is not recognized by the program.

Here is my actual zydacron.map:

Code:
0100000000520000:KEY_UP
0100000000510000:KEY_DOWN
0100000000500000:KEY_LEFT
01000000004F0000:KEY_RIGHT
0100000000280000:KEY_ENTER
01000000002a0000:KEY_BACKSPACE
0400040000000000:KEY_C
0500200000000000:KEY_PREVIOUSSONG
0500010000000000:KEY_PLAYPAUSE
0500100000000000:KEY_NEXTSONG
0500080000000000:KEY_R
0500400000000000:KEY_STOP
0500040000000000:KEY_F
0501000000000000:KEY_KPPLUS
0502000000000000:KEY_KPMINUS
0401000000000000:KEY_HOME
0508000000000000:KEY_PAGEUP
0510000000000000:KEY_PAGEDOWN
0504000000000000:KEY_MUTE
0500020000000000:KEY_TAB
01000000001E0000:KEY_1
01000000001F0000:KEY_2
0100000000200000:KEY_3
0100000000210000:KEY_4
0100000000220000:KEY_5
0100000000230000:KEY_6
0100000000240000:KEY_7
0100000000250000:KEY_8
0100000000260000:KEY_9
0100000000270000:KEY_0
0602000000000000:KEY_S
0402000000000000:KEY_F11
0400200000000000:KEY_V
0408000000000000:KEY_F9
0410000000000000:KEY_F8
0420000000000000:KEY_F10
0480000000000000:KEY_F12

So this keys don't work: BACKSPACE, RIGHT, 1 and 2. I've tried to capitalize, but it doesn't change anything.

coldsource, any idea where it can come from ? Frown

Thanks.