LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (http://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   How to use USB keyboard on embedded Linux? (http://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/how-to-use-usb-keyboard-on-embedded-linux-849369/)

lqu 12-09-2010 04:22 PM

How to use USB keyboard on embedded Linux?
 
I need to connect a usb keyboard to W5300E01 board from wiznet. The problem is there's no device file in /dev or /dev/usb or /dev/input. I also rebuild the kernel to include all the USB related features (usb HID, input->keyboard), but still there are no device files in /dev.

However, I know the kernel recognizes the keyboard from reading the kmsg and /proc/bus/input/device.

==================================
Here is the output from /proc/bus/input/devices:
==================================
I: Bus=0003 Vendor=046d Product=c312 Version=0110
N: Name="LITEON Technology USB Multimedia Keyboard"
P: Phys=usb-s3c24xx-1/input0
S: Sysfs=/class/input/input0
U: Uniq=
H: Handlers=kbd event0 evbug
B: EV=120013
B: KEY=10000 7 ff9f207a c14057ff febeffdf ffefffff ffffffff fffffffe
B: MSC=10
B: LED=7

=======================================
Here is the console output when I connect the usb keyboard:
=======================================
usb 1-1: new low speed USB device using s3c2410-ohci and address 3
usb 1-1: configuration #1 chosen from 1 choice
input: LITEON Technology USB Multimedia Keyboard as /class/input/input1
input,hidraw0: USB HID v1.10 Keyboard [LITEON Technology USB Multimedia Keyboard] on usb-s3c24xx-1
usb 1-1: Product: USB Multimedia Keyboard
usb 1-1: Manufacturer: LITEON Technology

cnxsoft 12-10-2010 02:17 AM

You may need to create the devices:
1. manually with mknod OR
2. In device_tables.txt when you build the image OR
3. With udev or mdev.

lqu 12-10-2010 11:53 AM

Thank you for your reply. I am thinking to manually create dev nodes with mknod, which major number should I use? Here is my /proc/devices. Thanks.

Character devices:
1 mem
2 pty
3 ttyp
4 /dev/vc/0
4 tty
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
29 fb
90 mtd
128 ptm
136 pts
162 raw
166 ttyACM
180 usb
188 ttyUSB
189 usb_device
204 s3c2410_serial
252 hidraw
253 usb_endpoint
254 rtc

Block devices:
1 ramdisk
7 loop
31 mtdblock
43 nbd
179 mmc
180 ub


Quote:

Originally Posted by cnxsoft (Post 4186778)
You may need to create the devices:
1. manually with mknod OR
2. In device_tables.txt when you build the image OR
3. With udev or mdev.


cnxsoft 12-11-2010 12:09 AM

The 1st column in /proc/devices is the major number
But I'm not really sure, which nodes you need for your devices. After a google search, I found some other people did the following for their USB Keyboard:

mkdir -p /dev/usb/hid
mknod /dev/usb/hid/hiddev0 c 180 96
mknod /dev/usb/hid/hiddev1 c 180 97
mknod /dev/usb/hid/hiddev2 c 180 98
mknod /dev/usb/hid/hiddev3 c 180 99
mknod /dev/usb/hid/hiddev4 c 180 100
mknod /dev/usb/hid/hiddev5 c 180 101
mknod /dev/usb/hid/hiddev6 c 180 102
mknod /dev/usb/hid/hiddev7 c 180 103
mknod /dev/usb/hid/hiddev8 c 180 104
mknod /dev/usb/hid/hiddev9 c 180 105
mknod /dev/usb/hid/hiddev10 c 180 106
mknod /dev/usb/hid/hiddev11 c 180 107
mknod /dev/usb/hid/hiddev12 c 180 108
mknod /dev/usb/hid/hiddev13 c 180 109
mknod /dev/usb/hid/hiddev14 c 180 110
mknod /dev/usb/hid/hiddev15 c 180 111

There is also the kernel doc about this: http://www.kernel.org/doc/Documentation/usb/hiddev.txt


All times are GMT -5. The time now is 09:46 PM.