Export to GitHub

polarhrm - rcx5_datalnk.wiki


Introduction

Introduction USB programming linux linux/usb Introduction

DataLnk HID device

the device gets recognized as HID(human interface device) device. let's take a look at lsusb thomas@thomas-ThinkPad-R400:~$ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 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 005 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 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 010: ID 0da4:0004 Polar Electro OY Bus 004 Device 004: ID 0a5c:2145 Broadcom Corp. Bluetooth with Enhanced Data Rate II Bus 004 Device 002: ID 08ff:2810 AuthenTec, Inc. AES2810 Bus 002 Device 012: ID 0bdb:1900 Ericsson Business Mobile Networks BV F3507g Mobile Broadband Module ok looks good. now see the /dev folder where we find two devices created. using the kernel modules hid and usbhid thomas@thomas-ThinkPad-R400:/dev$ ls hid* hidraw0 thomas@thomas-ThinkPad-R400:/dev/usb$ ls hiddev0

communicate with the device

I basicly figured out 3 general options to use the device.

libusb

using libusb:

libhid

https://launchpad.net/ubuntu/jaunty/amd64/libhid0/0.2.15+20060325-2.2ubuntu1

example using libusb http://www.cs.indiana.edu/~bpisupat/work/usb.html http://www.cs.indiana.edu/~bpisupat/work/oc_usb.c

/dev/hidraw0 or /dev/usb/hiddev0

http://www.mjmwired.net/kernel/Documentation/hid/hidraw.txt http://lxr.free-electrons.com/source/samples/hidraw/hid-example.c

usbsnoop

usbsnoop

helps understanding the protocoll MUST READ!

snoop log to c code usbsnoop info

links

Development of a User-Space Application for an HID Device, Using libhid

reverse engineering a keyboard