ktoonsez/KT747-JB — pull request #7 by FrozenCow (2013-04-19 20:18:42+00:00)
Title: USB: f_mass_storage: Added cdrom option to UMS-lun-devices

I don't have a Samsung Galaxy S3 Sprint nor AT&T, but I know these devices have the problem to be stuck in CD-rom-mode, since that is hardcoded into the kernel. With this patch it should be possible for applications (like DriveDroid) to switch between CD-rom-mode and USB-mode. The option to switch between the two modes should be available in sysfs:

To enable CD-rom-mode:
echo 1 > /sys/devices/platform/s3c-usbgadget/gadget/lun0/cdrom

To disable CD-rom-mode (and thereby enabling USB-mode):
echo 0 > /sys/devices/platform/s3c-usbgadget/gadget/lun0/cdrom

Note that this code is untested for the Galaxy S3, since I don't have one. However I've applied the same patch to CyanogenMods nightly kernel a while back for the Galaxy S1. That patch was accepted and all nightlies have been running well. (https://github.com/CyanogenMod/android_kernel_samsung_aries/commit/979aa0d835ddca5fdbaab47bcd9aa7f7d359feb0)

I'm not sure exactly in what other branches this patch should be applied, but I send it here just to get things going. I have tried building CM10.1 with this patch, but somehow my build would crash and since I don't have a phone to test I cannot debug that situation.

There is another patch I have applied to the Galaxy S1 kernel that should fix a problem with the CD-rom-mode (letting your PC boot off of the CD-rom device), but for now that isn't high priority. If you're interested, the patch for Galaxy S1 is here: https://github.com/CyanogenMod/android_kernel_samsung_aries/commit/1736943179733a4629e0eaa773848bdeeaeefec1