Thursday, December 7, 2017

hid-generic driver

* enable input device driver first. HID depends on it.
kernel menuconfig -> device drivers -> input device supports
- select Generic input layer
kernel menuconfig -> device drivers -> HID support -> HID bus support ->
- select /dev/hidraw raw HID device support
- select Generic HID driver


CONFIG_INPUT=y
CONFIG_HID=y
CONFIG_HIDRAW=y
CONFIG_HID_GENERIC=y

Sunday, December 3, 2017

hidraw udev rules

/etc/udev/rules.d/100-hidraw.rules

KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", ATTRS{idVendor}=="1234", ATTRS{idProduct}=="4321", GROUP="plugdev"


Friday, December 1, 2017

linux lsusb

lsusb -vd 2650:1616

echo -n -e '\x66\x6f\x6f' > /dev/hidraw0
echo -n -e \\x66\\x6f\\x6f > /dev/hidraw0


https://www.kernel.org/doc/Documentation/hid/hidraw.txt

libudev to locate hidraw
devices attached to the system.  There is a tutorial on libudev with a
working example at:
 http://www.signal11.us/oss/udev/

write()
--------
The write() function will write a report to the device. For USB devices, if
the device has an INTERRUPT OUT endpoint, the report will be sent on that
endpoint. If it does not, the report will be sent over the control endpoint,
using a SET_REPORT transfer.

The first byte of the buffer passed to write() should be set to the report
number.  If the device does not use numbered reports, the first byte should
be set to 0. The report data itself should begin at the second byte.

http://elixir.free-electrons.com/linux/latest/source/samples/hidraw/hid-example.c


http://www.signal11.us/oss/udev/

$/sys/class/hidraw/hidraw0$ ls
/sys/class/hidraw/hidraw0/device

/sys/bus/usb/devices/2-1.2/

DNS info on Linux


$ nmcli device show eth0

cat /etc/resolv.conf