Android之增加U盘同时使用的数量

一、前言

	在设备上同时插入三个U盘时,只有两个挂载成功。
	系统:android 5.1
	平台:RK3288

二、修改

1、修改device/rockchip/fstab.rk30board.bootmode.emmc

# non box product,configuration to the first item, will filter out left
/devices/ff580000.usb                           /mnt/usb_storage     vfat      defaults        voldmanaged=usb_storage:auto
/devices/ff580000.usb                           /mnt/usb_storage     vfat      defaults        voldmanaged=usb_storage:auto
/devices/ff500000.usb                           /mnt/usb_storage     vfat      defaults        voldmanaged=usb_storage:auto
/devices/ff500000.usb                           /mnt/usb_storage     vfat      defaults        voldmanaged=usb_storage:auto
/devices/ff540000.usb                           /mnt/usb_storage     vfat      defaults        voldmanaged=usb_storage:auto
/devices/ff540000.usb                           /mnt/usb_storage     vfat      defaults        voldmanaged=usb_storage:auto
/devices/ff540000.usb                           /mnt/usb_storage     vfat      defaults        voldmanaged=usb_storage:auto

/devices/后面的代表不同USB控制器,需确定好U盘插入的是哪个控制器,在我的项目中是ff540000.usb,这个控制器上通过hub接出三个USB口,要使这三个USB同时接三个U盘,需要创建三个/devices/ff540000.usb

2、修改device/common/init.rockchip.rc

    mkdir /mnt/usb_storage 0755 system system
    mkdir /mnt/usb_storage/USB_DISK0 0755 system system
    mkdir /mnt/usb_storage/USB_DISK1 0755 system system
    mkdir /mnt/usb_storage/USB_DISK2 0755 system system
    mkdir /mnt/usb_storage/USB_DISK3 0755 system system
    mkdir /mnt/usb_storage/USB_DISK4 0755 system system
    mkdir /mnt/usb_storage/USB_DISK5 0755 system system
	mkdir /mnt/usb_storage/USB_DISK6 0755 system system

在rc文件里创建/mnt/usb_storage/USB_DISK6,U盘将会挂载在这个目录里。

3、device/common/overlay/frameworks/base/core/res/res/xml/storage_list.xml

	<storage android:mountPoint="/mnt/usb_storage/USB_DISK4"
			 android:storageDescription="@string/storage_usb4"
             android:primary="false"
			 android:allowMassStorage="true"
             android:removable="true"
             android:mtpReserve="100" />
	<storage android:mountPoint="/mnt/usb_storage/USB_DISK5"
			 android:storageDescription="@string/storage_usb5"
             android:primary="false"
			 android:allowMassStorage="true"
             android:removable="true"
             android:mtpReserve="100" />
	<storage android:mountPoint="/mnt/usb_storage/USB_DISK6"
			 android:storageDescription="@string/storage_usb6"
             android:primary="false"
			 android:allowMassStorage="true"
             android:removable="true"
             android:mtpReserve="100" />

系统会分析这个文件里的属性然后挂载,所以需要在这添加一项

PS:由于fstab.rk30board.bootmode.emmc中USB_DISK0-3分别被ff580000.usb、ff500000.usb 占用,所以ff540000.usb这个文件是从 USB_DISK4开始挂载。

参考Android5.1新增挂载目录支持多个U盘

你可能感兴趣的:(Android系统篇)