天天看點

USB裝置的驅動移植

  核心裡已經做好了很完善的 USB 驅動了,可以支援大多數 USB 裝置,我的闆子上

使用了 USB HUB,擴充出四個 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 

22

          [*] /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 盤的支援

啟動時輸出:

Initializing USB Mass Storage driver...

usbcore: registered new interface driver usb-storage

USB Mass Storage support registered.

usbcore: registered new interface driver libusual

usb 1-1: configuration #1 chosen from 1 choice

hub 1-1:1.0: USB hub found

hub 1-1:1.0: 4 ports detected

如果出現這個,說明已經找到 USB HUB,可以使用四個 USB 裝置。

U 盤的挂載:

插入 U 盤後會提示:

[[email protected] /dev]# usb 1-1.4: new full speed USB device using s3c2410-ohci

and address 3       Å 插入第三個 USB 口

usb 1-1.4: configuration #1 chosen from 1 choice

scsi0 : SCSI emulation for USB Mass Storage devices

scsi 0:0:0:0: Direct-Access     Kingston DataTraveler G2  1.00 PQ: 0 ANSI:

2

sd 0:0:0:0: [sda] 7831552 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: Attached scsi generic sg0 type 0

sd 0:0:0:0: [sda] Assuming drive cache: write through 

23

 sda: sda1    Å 裝置名稱

sd 0:0:0:0: [sda] Assuming drive cache: write through

sd 0:0:0:0: [sda] Attached SCSI removable disk

U 盤的裝置名稱就是 sda1,将它挂載到/mnt/udisk3 目錄下:

#mount /dev/sda1 /mnt/udisk3

進入/mnt/udisk3 目錄就可以檢視 U 盤中的内容了。

解除安裝 U 盤,用指令:

#umount /mnt/udisk3

如果再插入一個 U 盤,會提示:

[[email protected] /]# usb 1-1.1: new full speed USB device using s3c2410-ohci

and address 4

usb 1-1.1: configuration #1 chosen from 1 choice

scsi1 : SCSI emulation for USB Mass Storage devices

scsi 1:0:0:0: Direct-Access     Lenovo   USB Flash Drive  1100 PQ: 0 ANSI:

0 CCS

sd 1:0:0:0: [sdb] 15663104 512-byte logical blocks: (8.01 GB/7.46 GiB)

sd 1:0:0:0: Attached scsi generic sg1 type 0

sd 1:0:0:0: [sdb] Write Protect is off

sd 1:0:0:0: [sdb] Assuming drive cache: write through

sd 1:0:0:0: [sdb] Assuming drive cache: write through

 sdb: sdb1   Å 裝置名稱

sd 1:0:0:0: [sdb] Assuming drive cache: write through

sd 1:0:0:0: [sdb] Attached SCSI removable disk

注意,新插入的這個 U 盤的裝置名稱為 sdb1,依此類推,再插入的 U 盤裝置名稱将

會是 sdc1 和 sdd1。