[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
coldsource Offline
Junior Member
Posts: 41
Joined: Dec 2010
Reputation: 0
Post: #11
Hi jpmayo.
The driver works as a daemon, so it is normal that you have to run it on each boot for the mapping to work. Also is it normal to run it as root, because of the default properties of the HID files in /dev (only readable by root).

I think the simplest would be to but something in /etc/rc.local, like :
Quote:hid_mapper --manufacturer '...' --product '...' --map '...' &

Put it before the exit statement. It should be enough to make it work.

Hope this helps
find quote
jpmayo Offline
Junior Member
Posts: 2
Joined: Jan 2011
Reputation: 0
Post: #12
I tried that, but it dosen't seem to work. I can only get it to work if I got to terminal and type
Quote:sudo /./hid_mapper --manufacturer 'Cy se' --product 'W-01RN USB_V3.1' --map '/s$
find quote
Diego2002 Offline
Junior Member
Posts: 5
Joined: Jan 2011
Reputation: 0
Post: #13
Hello coldsource!

I try to compile the source, but I get this error to make:

root@XBMCLive:/home/xxx/hid_mapper/hid_mapper# 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 had deal with c++ a long time ago, so I can not really find the problem. I checked those lines, but nothing interesting. It's even else...

Can you help plz?

Thx
Diego
find quote
coldsource Offline
Junior Member
Posts: 41
Joined: Dec 2010
Reputation: 0
Post: #14
What it your Linux distribution ?

This file does mapping between text description of keys and standard constants. I have generated the file based on ubuntu 10.10 so it is possible that you do not have all the keys defined.

One solution could be to delete the entries that are not recognized from the file, it should be harmless. Just be careful to remove entries from both arrays (keys_char and keys_int : one have quotes around values and the other not). Then recompile and it should be ok.
find quote
Cucurbitace Offline
Junior Member
Posts: 10
Joined: Jan 2011
Reputation: 0
Question    Post: #15
Hi,

I feel this might just be the solution I'm looking for quit a few time! The program compiled fine, but when I use the command:

hif_mapper --list-devices

I get this:
Code:
Found HID device at /dev/hidraw0
  Manufacturer : Microsoft
  Product name : Basic Optical Mouse

Found HID device at /dev/hidraw1
  Manufacturer : NOVATEK
  Product name : USB Keyboard

Found HID device at /dev/hidraw3

The last one is my remote, but as you can see, there is no manufacturer nor product name.

Any idea what I may try?

Thanks
find quote
coldsource Offline
Junior Member
Posts: 41
Joined: Dec 2010
Reputation: 0
Post: #16
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
find quote
Cucurbitace Offline
Junior Member
Posts: 10
Joined: Jan 2011
Reputation: 0
Post: #17
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
find quote
coldsource Offline
Junior Member
Posts: 41
Joined: Dec 2010
Reputation: 0
Post: #18
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.
find quote
Cucurbitace Offline
Junior Member
Posts: 10
Joined: Jan 2011
Reputation: 0
Post: #19
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.
find quote
coldsource Offline
Junior Member
Posts: 41
Joined: Dec 2010
Reputation: 0
Post: #20
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 !
find quote
Post Reply