Set mass storage as virtural CDROM for driver install.
author蔡建清 <caijq@rock-chips.com>
Tue, 29 Oct 2013 06:55:39 +0000 (14:55 +0800)
committerwlq <wlq@rock-chips.com>
Wed, 30 Oct 2013 13:12:06 +0000 (21:12 +0800)
arch/arm/configs/rk3188_ac_defconfig
drivers/usb/gadget/Kconfig
drivers/usb/gadget/android.c [changed mode: 0755->0644]

index baf2c1807497ee8f19614ce0d79d1465e6c577e5..e1d22889ee02f4b08ab66664b4591d6bb4eed21e 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_EXPERIMENTAL=y
+CONFIG_UMS_AS_CDROM=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_KERNEL_LZO=y
 CONFIG_LOG_BUF_SHIFT=19
index 49d5f1d2930dc61452d7799f479987a45ab5d2e4..40744b26855f1c06d032fc8d3f3422f960873258 100644 (file)
@@ -1086,5 +1086,11 @@ config BYPASS_INPUT_TO_HIDG
         help
          If say "y" there will create a new gadget HIDG
          and HID reports form HID devices will be bypass to PC 
-       
+
+config UMS_AS_CDROM
+       bool "Set mass storage as a virtual CDROM"
+       default n
+       help
+         Set mass storage as a virtual CDROM for drivers install.
+             
 endif # USB_GADGET
old mode 100755 (executable)
new mode 100644 (file)
index ad057bf..86a77db
@@ -639,10 +639,19 @@ static int mass_storage_function_init(struct android_usb_function *f,
                                                                GFP_KERNEL);
        if (!config)
                return -ENOMEM;
-
+#ifdef CONFIG_UMS_AS_CDROM   
+       //printk(KERN_ERR "CONFIG_UMS_AS_CDROM is true++++++++++++++++++\n");   
+       config->fsg.nluns = 1;
+       config->fsg.luns[0].removable = 1;
+       config->fsg.luns[0].ro = 1;
+    config->fsg.luns[0].cdrom = 1;
+#else
+       //printk(KERN_ERR "CONFIG_UMS_AS_CDROM is false -------------------\n");
        config->fsg.nluns = 2;
        config->fsg.luns[0].removable = 1;
        config->fsg.luns[1].removable = 1;
+#endif
+
 
        common = fsg_common_init(NULL, cdev, &config->fsg);
        if (IS_ERR(common)) {
@@ -653,12 +662,14 @@ static int mass_storage_function_init(struct android_usb_function *f,
        err = sysfs_create_link(&f->dev->kobj,
                                &common->luns[0].dev.kobj,
                                "lun");
-        err = sysfs_create_link(&f->dev->kobj, &common->luns[1].dev.kobj,"lun1");
+#ifndef CONFIG_UMS_AS_CDROM    
+               //printk(KERN_ERR "CONFIG_UMS_AS_CDROM is false -------------------\n");
+       err = sysfs_create_link(&f->dev->kobj, &common->luns[1].dev.kobj,"lun1");
        if (err) {
                kfree(config);
                return err;
        }
-
+#endif
        config->common = common;
        f->config = config;
        return 0;