如果做的方案有两个USB都用作host(主机设备),既可以用作读USB存储和插usb鼠标键盘。
首先,在device目录下配置。
init.sun7i.rc中添加如下两行:
mkdir /mnt/usbhost1 0000 system system
mkdir /mnt/usbhost2 0000 system system
overlay\frameworks\base\core\res\res\xml\storage_list.xml文件中添加如下语句:
overlay\frameworks\base\core\res\res\xml\storage_list.xml
<storage android:mountPoint="/mnt/usbhost1"
android:storageDescription="@string/storage_usb"
android:primary="false"
android:removable="true"
android:emulated="false"
android:mtpReserve="0"
android:maxFileSize="0"/>
<storage android:mountPoint="/mnt/sata"
android:storageDescription="@string/storage_sata"
android:primary="false"
android:removable="true"
android:emulated="false"
android:mtpReserve="0"
android:maxFileSize="0"/>
<storage android:mountPoint="/mnt/usbhost0"
android:storageDescription="@string/storage_usb"
android:primary="false"
android:removable="true"
android:emulated="false"
android:mtpReserve="0"
android:maxFileSize="0"/>
<storage android:mountPoint="/mnt/usbhost2"
android:storageDescription="@string/storage_usb"
android:primary="false"
android:removable="true"
android:emulated="false"
android:mtpReserve="0"
android:maxFileSize="0"/>
vold.fstab文件中的挂载修改成如下:
# Mounts the first usable partition of the specified device
#/devices/platform/awsmc.3/mmc_host for sdio
dev_mount sata /mnt/sata auto /devices/platform/sw_ahci.0
dev_mount sdcard /mnt/sdcard auto /devices/virtual/block/nandk /devices/platform/sunxi-mmc.2/mmc_host
dev_mount extsd /mnt/extsd auto /devices/platform/sunxi-mmc.1/mmc_host /devices/platform/sunxi-mmc.0/mmc_host
dev_mount usbhost1 /mnt/usbhost1 auto /devices/platform/sw-ehci.1/usb2/2-1/2-1.1
dev_mount usbhost0 /mnt/usbhost0 auto /devices/platform/sw_hcd_host0/usb1/1-1
dev_mount usbhost2 /mnt/usbhost2 auto /devices/platform/sw-ehci.2/usb4/4-1
另外sys_config.fex文件中修改usb配置:
;-------------------------------------------------------------------------------
[usbc0]
usb_used = 1
usb_port_type = 1
usb_detect_type = 0
usb_id_gpio = port:PH04<0><1><default><default>
usb_det_vbus_gpio = "axp_ctrl"
usb_drv_vbus_gpio = port:PB09<1><0><default><0>
usb_restrict_gpio = port:PH00<1><0><default><0>
usb_host_init_state = 1
usb_restric_flag = 0
usb_restric_voltage = 3550000
usb_restric_capacity= 5
;-------------------------------------------------------------------------------
;--- USB1控制标志
;------------------------------------------------------------------------------
[usbc1]
usb_used = 1
usb_port_type = 1
usb_detect_type = 0
usb_drv_vbus_gpio =
usb_restrict_gpio =
usb_host_init_state = 1
usb_restric_flag = 0
;------------------------------------------------------------------------------
;--- USB2控制标志
;------------------------------------------------------------------------------
[usbc2]
usb_used = 1
usb_port_type = 1
usb_detect_type = 0
usb_drv_vbus_gpio =
;usb_drv_vbus_gpio = port:PH03<1><0><default><0>
usb_restrict_gpio =
usb_host_init_state = 1
usb_restric_flag = 0