diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index d568d12..6f87b34 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -1789,12 +1789,14 @@ static int mass_storage_function_init(struct android_usb_function *f,
config->fsg.nluns = 1;
name[0] = "lun";
+ printk("lei: I am in %s\n",__func__);
if (dev->pdata && dev->pdata->cdrom) {
config->fsg.luns[config->fsg.nluns].cdrom = 1;
config->fsg.luns[config->fsg.nluns].ro = 1;
config->fsg.luns[config->fsg.nluns].removable = 0;
name[config->fsg.nluns] = "lun0";
config->fsg.nluns++;
+ printk("lei: I am in %s and dev->pdata->cdrom\n",__func__);
}
if (dev->pdata && dev->pdata->internal_ums) {
config->fsg.luns[config->fsg.nluns].cdrom = 0;
@@ -1802,6 +1804,7 @@ static int mass_storage_function_init(struct android_usb_function *f,
config->fsg.luns[config->fsg.nluns].removable = 1;
name[config->fsg.nluns] = "lun1";
config->fsg.nluns++;
+ printk("lei: I am in %s and internal_ums,config->fsg.nluns=%d\n",__func__,config->fsg.nluns);
}
config->fsg.luns[0].removable = 1;
@@ -3029,9 +3032,12 @@ static int __devinit android_probe(struct platform_device *pdev)
&pdata->swfi_latency);
pdata->cdrom = of_property_read_bool(pdev->dev.of_node,
"qcom,android-usb-cdrom");
+ printk("lei: I am in %s and pdata->cdrom=%d\n",__func__,pdata->cdrom);
pdata->cdrom = 1;//default enable cdrom
pdata->internal_ums = of_property_read_bool(pdev->dev.of_node,
"qcom,android-usb-internal-ums");
+ printk("lei: I am in %s and pdata->internal_ums=%d\n",__func__,pdata->internal_ums);
+ pdata->internal_ums = 1;//这行的目的是为了增加一个lun,如果没有这个变量的话,直接在上面增加一个lun也行。
len = of_property_count_strings(pdev->dev.of_node,
"qcom,streaming-func");
if (len > MAX_STREAMING_FUNCS) {
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
index 7e62c19..09e6be3 100644
--- a/drivers/usb/gadget/storage_common.c
+++ b/drivers/usb/gadget/storage_common.c
@@ -654,6 +654,7 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
/* R/W if we can, R/O if we must */
ro = curlun->initially_ro;
+ printk("lei:%s ==> ro=%d\n",__func__,ro);
if (!ro) {
filp = filp_open(filename, O_RDWR | O_LARGEFILE, 0);
if (PTR_ERR(filp) == -EROFS || PTR_ERR(filp) == -EACCES)
--- a/rootdir/etc/init.qcom.usb.sh
+++ b/rootdir/etc/init.qcom.usb.sh
@@ -249,7 +249,8 @@ per_sysusbconfig=`getprop persist.sys.usb.config`
if [ -f $cdromname ]; then
setprop persist.service.cdrom.enable 1
echo "mounting usbcdrom lun"
- echo $cdromname > /sys/class/android_usb/android0/f_mass_storage/lun0/file
+ #echo $cdromname > /sys/class/android_usb/android0/f_mass_storage/lun0/file
+ echo "/dev/block/mmcblk1p1" > /sys/class/android_usb/f_mass_storage/lun1/file
case "$per_sysusbconfig" in
"mtp,adb")
setprop persist.sys.usb.config mtp,adb,mass_storage
on property:sys.usb.config=mtp,adb
stop adbd
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 05C6
write /sys/class/android_usb/android0/idProduct 9039
write /sys/class/android_usb/android0/functions mtp,mass_storage,adb
write /sys/class/android_usb/android0/enable 1
write /sys/devices/virtual/android_usb/android0/f_mass_storage/lun/ro 1
write /sys/devices/virtual/android_usb/android0/f_mass_storage/lun/file /etc/usb_driver.iso
+ write /sys/devices/virtual/android_usb/android0/f_mass_storage/lun8/file /dev/block/mmcblk1p1"
start adbd
setprop sys.usb.state ${sys.usb.config}