android USB OTG功能怎么打开及实现

2025-03-25 02:15:21
推荐回答(2个)
回答1:

[Description]
USB OTG功能如何打开及实现
[Keyword]
USB OTG U盘 Keyboard Mouse
[Solution]
1、检查HW原理图,确认是否支持OTG功能(vbus是否供上电,IDDIG pin连接是否正确)

2、若HW确认支持OTG功能,则按照以下方法分别打开USB OTG功能及实现挂载:
如何打开USB OTG功能: 在alps/mediatek/config/{project}/autoconfig/kconfig/project中打开CONFIG_USB_MTK_OTG和CONFIG_USB_MTK_HDRC_HCD CONFIG_USB_MTK_OTG =y CONFIG_USB_MTK_HDRC_HCD = y 在dws中设定OTG VBUS对应的输出控制pin配置为GPIO模式,var name为GPIO_OTG_DRVVBUS_PIN。再设定IDDIG pin默认模式为IDDIG,var name为GPIO_OTG_IDDIG_EINT_PIN
如何实现挂载: init.project.rc起始位置处添加如下内容
on early-init
mkdir /mnt/usbotg 0000 system system vold.fstab末尾添加如下一行
dev_mount usbotg /mnt/usbotg auto /devices/platform/mt_usb storage_list.xml添加如下一个xml节点

android:storageDescription=@string/storage_external_usb
android:removable=true
android:primary=false /> 备注:需要根据ProjectConfig.mk中的resource_overlay_support的值来修改对应路径的storage_list.xml文件: RESOURCE_OVERLAY_SUPPORT的值为generic==>> alps/mediatek/custom/{project}/resource_overlay/generic/frameworks/base/core/res/res/xml/storage_list.xml RESOURCE_OVERLAY_SUPPORT的值为空 ==>> framework/base/core/res/res/xml/storage_list.xml 对于82平台,resource_overlay_support的值可配置为sd_in_ex_otg、sd_ex_otg,则无需再修改对应路径的storage_list.xml文件

[Attention]
目前USB OTG功能只支持U盘(一个FAT分区)、Keyboard、Mouse、PTP device

回答2:

很多人买了华为mate20后,发现他还是有很多新功能的,但是很多小伙伴就不知道怎么使用这些新功能,就以OTG功能为例,华为Mate20上面也有这个功能,那么华为mate20otg开关在哪里呢?下面就给大家介绍一下吧。