1. 程式人生 > >IMX6Q 對micro sd卡的支援&android 開放讀寫許可權

IMX6Q 對micro sd卡的支援&android 開放讀寫許可權

顯示SD card不受支援
檢查原理圖microSD用的是SD3
SD3_DAT0/1/2/3/CLK/CMD
探測引腳SD3_CD_B------>NANDF_D0

1.dts
&usdhc3 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_usdhc3>;
    bus-width = <4>;
    cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
    
    no-1-8-v;
    keep-power-in-suspend;
    enable-sdio-wakeup;
    status = "okay";
};

    pinctrl_usdhc3: usdhc3grp {
            fsl,pins = <
                MX6QDL_PAD_SD3_CMD__SD3_CMD        0x17059
                MX6QDL_PAD_SD3_CLK__SD3_CLK        0x10059
                MX6QDL_PAD_SD3_DAT0__SD3_DATA0        0x17059
                MX6QDL_PAD_SD3_DAT1__SD3_DATA1        0x17059
                MX6QDL_PAD_SD3_DAT2__SD3_DATA2        0x17059
                MX6QDL_PAD_SD3_DAT3__SD3_DATA3        0x17059
            
            >;
        };

&iomuxc {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_hog>;

    imx6qdl-sabresd {
        pinctrl_hog: hoggrp {
            fsl,pins = <
                MX6QDL_PAD_NANDF_D0__GPIO2_IO00 0x80000000  /*microsd cd pin*/
};

2.配置檔案fstab.freescale usdhc3的地址為2198000
--- a/device/fsl/xxx_6q/fstab.freescale
+++ b/device/fsl/xxx_6q/fstab.freescale
@@ -3,7 +3,7 @@
 # The filesystem that contains the filesystem checker binary (typically /system) cannot
 # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
 
-/devices/soc0/soc/2100000.aips-bus/219c000.usdhc/mmc_host* auto auto defaults voldmanaged=sdcard:auto,encrypt
+/devices/soc0/soc/2100000.aips-bus/2198000.usdhc/mmc_host* auto auto defaults voldmanaged=sdcard:auto,encrypt


3.android讀寫外接sd卡許可權配置
檔案管理器在儲存時出現:外接儲存卡寫許可權被禁止 ,請在儲存檔案時賦予寫許可權操作.
--- a/frameworks/base/data/etc/platform.xml
+++ b/frameworks/base/data/etc/platform.xml
@@ -123,7 +123,9 @@
          the fragility as one can remove a built-in permission which
          no longer needs to be mapped to gids and break grant propagation. -->
     <permission name="android.permission.READ_EXTERNAL_STORAGE" />
-    <permission name="android.permission.WRITE_EXTERNAL_STORAGE" />
+       <permission name="android.permission.WRITE_EXTERNAL_STORAGE">
+       <group gid="sdcard_r"/>
+       <group gid="meida_rw"/>