Android remounts the image file or partitions to CD mode, so that the computer can recognize and read and write (android cdrom by driverdroid)

  1. Old version of Android implementation (usually below Android8)
cd /sys/class/android_usb/android0
echo -n 0 >enable
#这里是你需要挂载iso或者img的路径
echo -n '/dev/block/bootdevice/by-name/userdata' >f_mass_storage/lun/file
echo -n 'mass_storage' >functions
#这里的vid跟pid默认可以不动,也可以不要以下这两条命令
echo -n <VID> >idVendor
echo -n <PID> >idProduct
echo -n 1 >enable

2. The new version of Android implementation (Android9 and above)

cd /config/usb_gadget/g1
#这里的0x409要注意一下,每个人的设备可能都会不同,得用命令匹配出来,下面会有demo文件放出
echo -n 'msc' >configs/b.1/strings/0x409/configuration
#这里的vid跟pid默认可以不动,也可以不要以下这两条命令
echo -n <VID> >idVendor
echo -n <PID> >idProduct
for f in configs/b.1/f*; do rm $f; done
ln -s functions/mass_storage.0 configs/b.1/f1
#这里是你需要挂载iso或者img的路径
echo -n '/dev/block/bootdevice/by-name/userdata' >configs/b.1/f1/lun.0/file

See article source

script written by myself

renderings
insert image description here

Guess you like

Origin blog.csdn.net/sorry_my_life/article/details/117705959