mardi 27 janvier 2015

Getting rid of the emulated CD drive and unknown devices in MTP mode [Partial Fix] topic






When you connect your MIUI device to the computer through USB in File Transfer (MTP) mode (that is, not in Photo Transfer), it also emulates a CD-ROM drive. The ISO image for the fake CD contains a copy of Mi Assistant, a device management tool for the PC, which is in Chinese only and can be downloaded from the Internet anyway. Basically, it's all useless and mildly annoying.
Attachment 3137500

Here's what you need to do to get rid of it:
Step 1. Edit /system/build.prop and add the line:

Code:


persist.service.cdrom.enable=0

Step 2. Edit /init.qcom.usb.rc and where it says:

Code:


on property:sys.usb.config=mtp

(a) Change the first line to remove mention of mass_storage (this is for the CD only):

Code:


write /sys/class/android_usb/android0/functions mtp

(b) Remove these two lines:

Code:


write /sys/class/android_usb/android0/f_mass_storage/lun/ro 1
write /sys/class/android_usb/android0/f_mass_storage/lun/file /data/miui/cdrom_install.iso


Similarly, where it says:

Code:


on property:sys.usb.config=mtp,adb

(a) Change the first line after the above to:

Code:


write /sys/class/android_usb/android0/functions mtp,adb

(b) Remove these two lines:

Code:


write /sys/class/android_usb/android0/f_mass_storage/lun/ro 1
write /sys/class/android_usb/android0/f_mass_storage/lun/file /data/miui/cdrom_install.iso


Step 3. Delete the ISO image file to free up some space.
File location: /data/miui/cdrom_install.iso

And here's how to do it:
Using Android Debug Bridge from the command line:

Code:


adb root
adb shell "mount -o remount,rw /system"
adb shell "echo persist.service.cdrom.enable=0 >>/system/build.prop"
adb pull /init.qcom.usb.rc


Now use your favorite editor to make changes as described above in step 2.

Code:


adb push init.qcom.usb.rc /
adb shell "mount -o remount,ro /system"
adb shell "rm -f /data/miui/cdrom_install.iso"
adb reboot


Using ES File Explorer:
Download from Play Store or the developer's website. Install. Open. In context menu (hold leftmost button for 1 second), switch Root Explorer to On (this will fail). Go back to the home screen. Open Security, Permissions, Root Access. Put the switch next to ES File Explorer to On. Now you can switch back to ES File Explorer, and follow the steps 1-3 above. Use the built-in editor the make changes in the files.

Unknown USB devices when connected in MTP mode
When your device is connected in MTP mode (File Transfer) there are 3 unrecognized USB devices. To check if you have them too, go to Control Panel and choose Device Manager or run mmc devmgmt.msc from the command line (screenshot 1). The devices appear to have no hardware IDs (screenshot 2) and their class number seems to be {c897b31c-e8d2-59e9-a212-ccf0962fe102} (full registry dump provided as attachment).
Attachment 3137478 Attachment 3137479
This problem appears to be caused by the CD-ROM emulation as well: the number of devices will actually increase to 4 when it's switched off following the instructions above, which means there must be one extra step to get rid of it completely. This doesn't seem to cause any problems and the issue appears to be purely cosmetic. If I have time to investigate it further, I will report the conclusions back here. Meanwhile, if anyone has an idea what the cause is, please feel free to share it (might also be a driver issue).

Disclaimer: there might be some mistakes in what I wrote. Please use at your own discretion. This should work with a "developer" stock ROM out of the box, otherwise you'll need to set-up root access first.








Attached Thumbnails


Click image for larger version<br/><br/>Name:	Xiaomi USB Unknown Devices 1.png<br/>Views:	N/A<br/>Size:	42.0 KB<br/>ID:	3137478
 

Click image for larger version<br/><br/>Name:	Xiaomi USB Unknown Devices 2.png<br/>Views:	N/A<br/>Size:	18.4 KB<br/>ID:	3137479
 

Click image for larger version<br/><br/>Name:	Xiaomi USB CD-ROM ISO Emulation.png<br/>Views:	N/A<br/>Size:	23.1 KB<br/>ID:	3137500
 











Attached Files





File Type: zip Xiaomi USB Unknown Devices Registry Class Dump.reg.zip -
[Click for QR Code]
(654 Bytes)










Aucun commentaire:

Enregistrer un commentaire