How the Android USB OTG feature is opened and implemented

Source: Internet
Author: User

First, check the HW schematic to verify that OTG functionality is supported (Vbus is power-up, iddig pin connection is correct)
Second, if the HW confirms that the OTG feature is supported, turn on the USB OTG feature and implement the mount separately according to the following methods:


How to turn on the USB OTG feature:
1). Open CONFIG_USB_MTK_OTG and CONFIG_USB_MTK_HDRC_HCD in Alps/mediatek/config/[project]/autoconfig/kconfig/project
CONFIG_USB_MTK_OTG =y
CONFIG_USB_MTK_HDRC_HCD = y
2). In DWS set the OTG vbus corresponding output control PIN configured as Gpio mode, var name is Gpio_otg_drvvbus_pin. Set the Iddig PIN default mode to Iddig,var name to Gpio_otg_iddig_eint_pin
How to implement Mount:
1). Add the following at the starting position of the alps/mediatek/config/[project]/init.project.rc
For the previous version of KK:
On Early-init
MKDIR/MNT/USBOTG 0000 System System
For future versions of KK (included):
#需要特别注意的是, here is to add another on init, not add on Early-init:
On Init
MKDIR/MNT/MEDIA_RW/USBOTG 0700 MEDIA_RW MEDIA_RW
MKDIR/STORAGE/USBOTG 0700 root root
...
#service加在on Boot:
On boot
Service fuse_usbotg/system/bin/sdcard-u 1023-g 1023-w 1023-d/MNT/MEDIA_RW/USBOTG/STORAGE/USBOTG
Class Late_start
Disabled
#
# Connectivity Related services (Begin)
#
2) Add the following line to the end of the. fstab file
For the previous version of KK:
Modify Alps/mediatek/config/[project]/vold.fstab
Dev_mount USBOTG/MNT/USBOTG Auto/devices/platform/mt_usb
For a later version of KK (Note that the Fstab file here, if not in [project], copy one from the common to modify it):
Modify Alps/mediatek/config/[project]/fstab
/DEVICES/PLATFORM/MT_USB Auto VFAT defaults voldmanaged=usbotg:auto
3). Storage_list.xml Add the following XML node
For the previous version of KK:
<storage android:mountpoint= "/MNT/USBOTG"
android:storagedescription= "@string/storage_external_usb"
Android:removable= "true"
Android:primary= "false"/>
For future versions of KK (included):
<storage android:mountpoint= "/STORAGE/USBOTG"
android:storagedescription= "@string/storage_external_usb"
Android:removable= "true"
Android:primary= "false"/>
Note: specifically modify which path under the Storage_list.xml file, depending on the value of the Resource_overlay_support in the projectconfig.mk to be determined
For the following versions of JB3,
If the value of Resource_overlay_support is generic ==>> modify the alps/mediatek/custom/[project]/resource_overlay/generic/ Frameworks/base/core/res/res/xml/storage_list.xml
If the value of Resource_overlay_support is empty ==>> modify Alps/framework/base/core/res/res/xml/storage_list.xml
For JB3 (inclusive) versions, the value of Resource_overlay_support can be configured as SD_IN_EX_OTG or SD_EX_OTG as needed, no need to modify the file
SD_IN_EX_OTG or SD_EX_OTG respectively means inside card + external card +OTG or external card +OTG
The corresponding files were alps/mediatek/custom/common/sd_in_ex_otg/resource_overlay/generic/frameworks/base/core/res/res/xml/ Storage_list.xml or alps/mediatek/custom/common/sd_ex_otg/resource_overlay/generic/frameworks/base/core/res/res/ Xml/storage_list.xml

[Attention]
Currently USB OTG features only support USB flash drive (FAT format + one partition), Keyboard, Mouse, PTP device

How the Android USB OTG feature is opened and implemented

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.