How to redirect USB keyboard to console?

Oct 28, 2003 1 Replies

I have a Linux embedded system running Busybox and need to connect USB keyboard to it. I have compiled the USB keyboard support in the kernel (USB HID support and Input core support). When I connect the keyboard, I get the following message:



hub.c: new USB device 00:07.2-1, assigned address 2 : USB HID v1.00 Keyboard [046a:0001] on usb2:2.0



When I disconnect it, I get



usb.c: USB disconnect on device 00:07.2-1 address 2



Therefore I conclude that the drivers are working properly and the only thing I need is to redirect the keyboard to the console. Can anybody tell me how? Is there any device corresponding to the USB keyboard, which could be redirected? How could I create such device (maj. min. numbers etc.)? In my embedded system with Busybox there are only devices which I create by myself, it is not a distribution like RedHat or Mandrake...



I have found a solution of the similar problem for FreeBSD using the kbdcontrol command, but this command is not available in my development system (Mandrake). Is there any utility that could be installed on my embedded system, which will solve my problem?



Thank you Bob


IIRC the driver is called "usbkbdev"; it operates as an event sink from hid and injects keystrokes into the console driver. I'm not sure if it works when you have a serial console, but it certainly does the necessary glue job for PC hardware consoles.

Depending on what you are doing with the keyboard, it may be preferable to use it from the hid event driver instead of as a keyboard per se. This makes it quite easy to monitor key up and down events and everything else the keyboard is actually reporting. That would be with the module "evdev" as described in section 5 "event interface" of .../Documentation/input/input.txt.

Grant Taylor - gtaylorpicante.com - http://www.picante.com/~gtaylor/ Linux Printing Website and HOWTO: http://www.linuxprinting.org/

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required