I need to use a keyboard for the application I'm developing. The keyboard is used to be connected to the USB-Host. Later it will be replaced by a laser scanner.
So I plugged the keyboard in, got the PnP-Event:
[ 139.540000] usb 1-1.1: new low-speed USB device number 4 using ehci-platform
[ 139.670000] usb 1-1.1: New USB device found, idVendor=0a81, idProduct=0103
[ 139.680000] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 139.680000] usb 1-1.1: Product: USB Keyboard
[ 139.680000] usb 1-1.1: Manufacturer: CHESEN
tried to hook the input events, but there is only /dev/input/event0 available. Shouldn't the USB device be listed there? I am not very familiar with linux. So I would be happy if someone would explain how to map the keyboard to linino so it can be used.
My second question would be whats the best way to forward the input events to my sketch? I can't use the serial terminal because it conflicts with my TFT...
Do you have an LCD connected to the serial pins on the Yun? If so, doesn't that interfere with the bridge between the Arduino and Linino?
I am trying to get an LCD working with my Yun, and think the best way to do it will be to connect it to the USB host on the Linino, then use the Bridge to communicate between the LCD and Arduino sketch. I would think you should be able to do the same thing with the keyboard.
Gernby:
Do you have an LCD connected to the serial pins on the Yun? If so, doesn't that interfere with the bridge between the Arduino and Linino?
It does indeed. But the problem with the USB HID is another. It seems that OpenWRT doesn't support low speed USB devices. I'll try to connect a PS/2 keyboard next, using the PS2Keyboard lib. I hope that a future patch for LININO will fix the USB problem.
Gernby:
I am trying to get an LCD working with my Yun, and think the best way to do it will be to connect it to the USB host on the Linino, then use the Bridge to communicate between the LCD and Arduino sketch. I would think you should be able to do the same thing with the keyboard.
Not sure if this is the correct way, but I was modifying these files:
~/linino/trunk/package/kernel/modules/001-depends.mk (to add +kmod-hid-generic)
~/linino/trunk/package/kernel/modules/input.mk (to add CONFIG_HIDRAW=y)
Thanks again sonnyyu for providing the kmod-hid-generic and kmod-hid module install packages above. My USB keyboard (/dev/input/eventX) and HID RAW (/dev/hidrawX) devices are now visible for use.
Sorry, I only have access to the same public precompiled binaries/firmware that are located at download.linino.org where our Yun's web panel OPKG-Configuration (/etc/opkg.conf) is configured to point to.
cat /dev/input/event1 | hexdump #continuous dumping of raw (useless) hex data
OR
hexdump -n 96 /dev/input/event1 | head -n 2 | cut -d' ' -f9 #single keystroke's code and value
write a script to continuously monitor and decode /dev/input/event1 stream and echo the characters to the bridge
(still in the works. I'm still very new at this)
Sonnyyu, do you know the best way to have the actual characters dump into the console rather than the keycodes? I've written a script that listens to the events, parses them, and translates them, but it is not looping fast enough to keep up with user input. Keys are being dropped and I'm having to manage the shift and control keys manually. This can't be right...
It seems like there should be a simple solution to this. I'm not super-familiar with linux, but I have a feeling that it is a simple answer that I am just not aware of.
evtest-capture captures the information and events from the input device specified on the command line and writes it to the xml file given. If no filename is given for the output file, evtest-capture.xml is chosen as default.