让linux2.6.24内核在开发板支持usb鼠标

来源:互联网 发布:淘宝香港丰胸 编辑:程序博客网 时间:2024/05/01 17:27
Cited from http://blogold.chinaunix.net/u2/64681/showart_508931.html
今天下午,对以前移植的linux2.6.24内核不能检测USB鼠标进行了修改menuconfig,新内核的USB鼠标在内核 drivers/hid/usbhid目录下,文件名:usbmouse.c,如果你需要对鼠标驱动修改就看这个文件,我的开发板暂时不需要对鼠标驱动定 制特别的操作,于是在保证2410配置文件默认的情况下,make menuconfig然后选择 Device Drivers -->进入 选中HID Devices  ---> 进入 USB HID Boot Protocol drivers  --->  看到 USB HIDBP Mouse (simple Boot) support,选中它,如果没有出现该项说明你在上边的步骤中选中了其他多余项,可以根据打开的kconfig文件中看到,注意红色部分:
 
menu "USB HID Boot Protocol drivers"
 depends on USB!=n && USB_HID!=y
config USB_KBD
 tristate "USB HIDBP Keyboard (simple Boot) support"
 depends on USB && INPUT
 ---help---
   Say Y here only if you are absolutely sure that you don't want
   to use the generic HID driver for your USB keyboard and prefer
   to use the keyboard in its limited Boot Protocol mode instead.
   This is almost certainly not what you want.  This is mostly
   useful for embedded applications or simple keyboards.
   To compile this driver as a module, choose M here: the
   module will be called usbkbd.
   If even remotely unsure, say N.
config USB_MOUSE
 tristate "USB HIDBP Mouse (simple Boot) support"
 depends on USB && INPUT
 ---help---
   Say Y here only if you are absolutely sure that you don't want
   to use the generic HID driver for your USB mouse and prefer
   to use the mouse in its limited Boot Protocol mode instead.
   This is almost certainly not what you want.  This is mostly
   useful for embedded applications or simple mice.
   To compile this driver as a module, choose M here: the
   module will be called usbmouse.
   If even remotely unsure, say N.
endmenu
 
选中以后,make zImage好了,烧录开发板,重启,可以看到检测到鼠标驱动了,原来的报出的错误没有了,但是第二天我发现USB鼠标没有在/dev目录下,所以我重新 把Device Drivers -->进入 选中HID Devices  ---> 进入后,将USB的选项调整成这样,
  │ │          *** USB Input Devices ***                                  │ │  
  │ │    <*>   USB Human Interface Device (full HID) support              │ │  
  │ │    [ ]     Enable support for iBook/PowerBook/MacBook/MacBookPro spe│ │  
  │ │    [ ]     Force feedback support (EXPERIMENTAL)                    │ │  
  │ │    [*]     /dev/hiddev raw HID device support       
 
因为选中了USB Human Interface Device (full HID) support这一项, 所以USB_MOUSE的选项被关闭了,我同时选中了对[*]     /dev/hiddev raw HID device support 的项,编译时可以看到:
。。。。。。
  CC      drivers/hid/hid-core.o
  LD      drivers/hid/hid.o
  CC      drivers/hid/usbhid/hid-core.o
  CC      drivers/hid/usbhid/hiddev.o
  LD      drivers/hid/usbhid/usbhid.o
  LD      drivers/hid/usbhid/built-in.o
。。。。。。
 
烧录,重启开发板:
 
。。。。。。
 
usb 1-1: new low speed USB device using s3c2410-ohci and address 2
usb 1-1: configuration #1 chosen from 1 choice
usbcore: registered new interface driver hiddev
input: USB Mouse as /class/input/input0
input: USB HID v1.10 Mouse [USB Mouse] on usb-s3c24xx-1
usbcore: registered new interface driver usbhid
drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
 
 
。。。。。。
 
手动创建节点mknod mouse c 13 32,测试鼠标cat mouse,移动鼠标有数据打印出来。

补充:
make menuconfig 中如果需要查询哪个编译选项,按"\"。