Android USB OTG converted to host debug note

Source: Internet
Author: User

(Original works, reproduced please indicate the path of reprint)

Recently on the MStar 786 platform, there is a need, that is, the USB OTG converted to a host USB drive.


Start debugging, thought as long as the OTG configuration removed, that is, CONFIG_USB_MS_OTG shield off, but after compiling the burn, insert and dial out the USB flash drive when found prompt


Android_work:did not send uevent (0 0 (NULL))


The flash drive does not light up, indicating that there is no power on.


Later search for information, only to find the need to pull the usb_cid foot low, low to show work in the host mode.


There are 2 ways to pull the pin down:

1) force it to pull down on the hardware.

2) pull down the software, in the kernel directory of the DRIVERS\USB\OTG\MS_OTG.C in the MS_OTG_INIT_IRQ function, the following code to screen off:

OTG ID pin pull-up
/* reg_t = READL (&msotg->op_regs->usbc_regs->port_ctrl);
reg_t |= Idpullup_ctrl;
Writel (reg_t, &msotg->op_regs->usbc_regs->port_ctrl); * *


After compiling the burn, the boot is inserted into the USB flash drive, with the following log, indicating successful recognition:




[1374.141871] Hub_events


[1374.144655] Hub_port_connect_change


[1374.303911] Hub_port_init


[1374.306911] ==13==> hub_port_init 1
[1374.310873] Plug in USB Port1
[1374.503906] USB 3-1: New high Speed USB device number 3 using Mstar-ehci-1
[1374.958064] usb-storage 3-1:1.0:quirks match for vid 058f pid 6,387:20
[1374.965494] usb-storage 3-1:1.0:this device (058f,6387,010b S) have unneeded subclass and Protocol entries in U Nusual_devs.h (Kernel 3.4.5)
[1374.965505] Please send a copy of the message to <[email protected]> and <[email protected]>
[1374.992704] Scsi1:usb-storage 3-1:1.0
[1374.999392] Hub_events


[1375.002158] Hub_events


[1375.996046] SCSI 1:0:0:0: direct-access Generic Flash Disk 8.07 pq:0 ansi:4
[1376.008295] SD 1:0:0:0: [SDB] 16293888 512-byte logical blocks: (8.34 gb/7.76 GiB)
[1376.017568] SD 1:0:0:0: [SDB] Write Protect is off
[1376.023685] SD 1:0:0:0: [SDB] Write cache:disabled, read cache:enabled, doesn ' t support DPO or FUA
[1376.038784] Sdb:sdb1
[1376.046711] SD 1:0:0:0: [SDB] attached SCSI removable disk
[1376.054754] SD 1:0:0:0: attached SCSI generic sg0 type 0



After recognition succeeds, a device node is generated under/dev/block/, possibly called sda1


You need to mount it manually to the MNT directory before you can access it:

Mount-t Vfat/dev/block/sda1/mnt/sdcard


You can then access the contents of the USB flash drive under root privileges on CD SDcard


Android USB OTG converted to host debug note

Related Article

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.