Keyboard in OpenWrt
Beginning with this documentation section we try to do something unreal seemingly – to transform our router into a fully-featured computer. Although this target seems to be unreal however it can be succeeded as easy as well we have done in the previous sections.
At first we need to connect a standard input-device, it is a keyboard.
On the stage of configuration OpenWrt the following modules are to be selected:
Base system:
<*> busybox:
Linux System Utilities:
<*> lsusb
Kernel modules:
USB Support:
<M> kmod-usb-hid
Let’s install the packages:
root@OpenWrt:/# opkg install kmod-usb-hid Installing kmod-usb-hid (2.6.36.2-1) to root... Downloading ftp://ftp:ftp@192.168.0.9/kmod-usb-hid_2.6.36.2-1_brcm47xx.ipk. Installing kmod-hid (2.6.36.2-1) to root... Downloading ftp://ftp:ftp@192.168.0.9/kmod-hid_2.6.36.2-1_brcm47xx.ipk. Installing kmod-input-core (2.6.36.2-1) to root... Downloading ftp://ftp:ftp@192.168.0.9/kmod-input-core_2.6.36.2-1_brcm47xx.ipk. Installing kmod-input-evdev (2.6.36.2-1) to root... Downloading ftp://ftp:ftp@192.168.0.9/kmod-input-evdev_2.6.36.2-1_brcm47xx.ipk. Configuring kmod-input-core. Configuring kmod-hid. Configuring kmod-input-evdev. Configuring kmod-usb-hid. |
Let’s connect the keyboard and check the output dmesg:
root@OpenWrt:/# dmesg usb 1-1.3: new low speed USB device using ohci_hcd and address 5 input: USB USB Keykoard as /devices/ssb0:1/usb1/1-1/1-1.3/1-1.3:1.0/input/input0 generic-usb 0003:1C4F:0002.0001: input: USB HID v1.10 Keyboard [USB USB Keykoard] on usb-ssb0:1-1.3/input0 |
We also check if a corresponding device has been created:
root@OpenWrt:/# ls /dev/input/* /dev/input/event0 /dev/input/event1 |
My output lsusb looks like the this:
root@OpenWrt:/# lsusb Bus 001 Device 001: ID 1d6b:0001 Bus 002 Device 001: ID 1d6b:0002 Bus 001 Device 002: ID 0a05:7211 Bus 001 Device 003: ID 0a05:7211 Bus 001 Device 004: ID 0951:1603 Bus 001 Device 005: ID 1c4f:0002 |
The device with ID 1c4f:0002 SiGma Micro is a connected keyboard.
A corresponding file of the device should be created in the directory /proc:
root@OpenWrt:/# cat /proc/bus/input/ /proc/bus/input/devices /proc/bus/input/handlers root@OpenWrt:/# cat /proc/bus/input/devices I: Bus=0003 Vendor=1c4f Product=0002 Version=0110 N: Name="USB USB Keykoard" P: Phys=usb-ssb0:1-1.3/input0 S: Sysfs=/devices/ssb0:1/usb1/1-1/1-1.3/1-1.3:1.0/input/input0 U: Uniq= H: Handlers=kbd event0 B: EV=120013 B: KEY=10000 7 ff800000 7ff febeffdf f3cfffff ffffffff fffffffe B: MSC=10 B: LED=7 |
Let’s check the response to the pressing the buttons:
root@OpenWrt:/# cat /dev/input/event0 | hexdump 0000000 00cc 0000 74e7 000b 0004 0004 0004 0007 0000010 00cc 0000 751f 000b 0001 001e 0001 0000 0000020 00cc 0000 7531 000b 0000 0000 0000 0000 0000030 00cc 0000 b356 000b 0004 0004 0004 0007 0000040 00cc 0000 b37b 000b 0001 001e 0000 0000 0000050 00cc 0000 b387 000b 0000 0000 0000 0000 0000060 00ce 0000 e2bd 0003 0004 0004 0028 0007 0000070 00ce 0000 e2ec 0003 0001 001c 0001 0000 0000080 00ce 0000 e2ff 0003 0000 0000 0000 0000 0000090 00ce 0000 bd78 0004 0004 0004 0028 0007 00000a0 00ce 0000 bd9e 0004 0001 001c 0000 0000 00000b0 00ce 0000 bdab 0004 0000 0000 0000 0000 |
Buy an usb-keyboard from us: