USB commands in U-boot

Source: Internet
Author: User

[U-boot: v2013.04]

[Author: Bo Shen <voice.shen@gmail.com>]

1. Use (help information)

U-boot> USB-USB sub-system usage: USB start-start (SCAN) USB controllerusb reset-Reset (rescan) USB controllerusb stop [f]-Stop USB [f] = force stopusb tree-show USB device treeusb info [Dev]-show available USB devicesusb storage-Show Details of USB storage devicesusb Dev [dev]-show or set current USB storage deviceusb part [Dev]-print Partition Table of one or all USB storage devicesusb read addr blk # CNT-read 'cnt 'blocks starting at Block' BLK # 'to memory address 'addr 'usb write addr blk # CNT-write 'cnt 'blocks starting at Block 'blk #' from memory address 'addr'

1.1usb start/USB Reset

U-boot> USB start (re) Start USB... usb0: scanning bus 0 for devices... 2 USB device (s) found scanning USB for storage devices... 1 storage device (s) found

USB tree 1.2

U-boot> USB treeusb Device Tree: 1 hub (12 Mb/s, 0mA) | OHCI root hub | +-2 mass storage (12 Mb/s, 200mA) Kingston datatraveler G3 001372982955ebc0c5ab0019

1.3 USB Info (USB info 1/USB Info 2)

U-boot> USB info 1: hub, USB revision 1.10-OHCI root hub-class: hub-packetsize: 8 deployments: 1-vendor: 0x0000 product 0x0000 version 0.0 configuration: 1-Interfaces: 1 self powered 0mA interface: 0-Alternate setting 0, endpoints: 1-class hub-endpoint 1 in interrupt maxpacket 2 interval 255 Ms 2: Mass Storage, USB revision 2.0-Kingston datatraveler G3 001372982955ebc0c5ab0019-class: (from interface) Mass Storage-packetsize: 64 deployments: 1-vendor: 0x0930 product 0x6545 version 1.0 configuration: 1-Interfaces: 1 bus powered 200mA interface: 0-Alternate setting 0, endpoints: 2-class mass storage, Transp. SCSI, bulk only-endpoint 1 in bulk maxpacket 64-endpoint 2 out bulk maxpacket 641.4 USB Devu-boot> USB Dev USB device 0: Vendor: Kingston Rev: pmap prod: datatraveler G3 type: removable hard disk capacity: 7441.6 MB = 7.2 GB (15240576x512)

2. Source Code Analysis

<Common/cmd_usb.c>

2.1 USB start/USB reset command code execution

[Strncmp (argv [1], "Start", 5) = 0]/[strncmp (argv [1], "reset", 5) = 0] --> usb_stop () --> usb_init () --> usb_stor_scan (1) (config_usb_storage) --> usb_host_eth_scan (1) (config_usb_host_ether)
--> Drv_usb_kbd_init () (config_usb_keyboard) --> return 0;

2.2 USB Stop command code execution

[Strncmp (argv [1], "stop", 4) = 0] --> (config_usb_keyboard) [argc = 2] --> usb_kbd_deregister () --> usb_stop --> return 0;

[Strncmp (argv [1], "stop", 4) = 0] --> (config_usb_keyboard) [argc! = 2] --> console_assign (stdin, "serial") --> usb_kbd_deregister () --> usb_stop --> return 0;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.