内核里已经做好了很完善的 USB 驱动了,可以支持大多数 USB 设备,内核里也有对 USB HUB的支持,可直接使用。
配置内核,支持 USB:
Device drivers ---> SCSI Device support ---> <*> SCSI device support [*] legacy /proc/scsi/ support <*> SCSI disk support [*] HID Devices ---> <*> USB Human Interface Device (full HID) support [*] /dev/hiddev raw HID device support [*] USB support ---> <*> Support for Host-side USB [*] USB device filesystem [*] USB device class-devices(DEPRECATED) <*> USB Monitor <*> OHCI HCD support <*> USB Mass Storage support
|
USB Human Interface Device (full HID) support 是对 USB 鼠标键盘的支持
SCSI disk support 和 USB Mass Storage support 是对 U 盘的支持
启动时输出:
usbmon: debugfs is not available
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
如果出现这个,说明已经找到 USB HUB,可以使用两个 USB 设备。
测试:
插入U盘。当系统启动后插入U盘就会出现一些信息,可以看到sda就是U盘设备了,sda1是U盘的一个分区。
- [mxh2440]# usb 1-1: new full speed USB device using s3c2410-ohci and address 2
- usb 1-1: configuration #1 chosen from 1 choice
- scsi0 : SCSI emulation for USB Mass Storage devices
- scsi 0:0:0:0: Direct-Access kingston DataTraveIer G2 DL07 PQ: 0 ANSI: 0 CCS
- sd 0:0:0:0: Attached scsi generic sg0 type 0
- sd 0:0:0:0: [sda] 7829504 512-byte logical blocks: (4.00 GB/3.73 GiB)
- sd 0:0:0:0: [sda] Write Protect is off
- sd 0:0:0:0: [sda] Assuming drive cache: write through
- sd 0:0:0:0: [sda] Assuming drive cache: write through
- sda: detected capacity change from 0 to 4008706048
- sda:
- sd 0:0:0:0: [sda] Assuming drive cache: write through
- sd 0:0:0:0: [sda] Attached SCSI removable disk
我们查看/proc/partitions/目录:
发现sda的主设备号是8,次设备号是0,那么我们就创建这个设备的节点,b代表块设备.
注:一个字符设备或者块设备都有一个主设备号和次设备号。主设备号和次设备号统称为设备号。主设备号用于区分不同类型的设备,次设备号用于区分同一类型的不同设备。例如一个嵌入式系统,有两个LED指示灯,LED灯需要独立的打开或者关闭。那么,可以写一个LED灯的字符设备驱动程序,可以将其主设备号注册成5号设备,次设备号分别为1和2。这里,次设备号就分别表示两个LED灯。
#mknod /dev/sda b 8 0 #mkdir /mnt/usb #mount /dev/sda /mnt/usb //----挂载U盘挂载到/mnt/usb/目录下 |
阅读(3783) | 评论(0) | 转发(1) |