[Samsung Galaxy S10/S10+/S10 5G/E Cross Device Deve] newbit:
Hello Fellows,

I've got it working... And even WITHOUT adjusting any usb.rc file.

First I had to download the Magisk Module isodrive (configfs)

Second, according to AOSP USB HAL, USB HAL or rather svc is supposed

to superseed the need of using usb.rc files. So it is not necessary anymore

to mod any of this files. Source of svc usb -> UsbCommand.java

The isodrive module does most of it anyways.

With an ISO file I can write in a shell:

newbit@S10 % adb shell
beyond1:/ $ su
beyond1:/ # isodrive cdrom /sdcard/Download/1DMP/Others/linuxmint-21.2-cinnamon-64bit.iso -cdrom
Write: -> /config/usb_gadget/g1/UDC
Write: /sdcard/Download/1DMP/Others/linuxmint-21.2-cinnamon-64bit.iso -> /config/usb_gadget/g1/functions/mass_storage.0/lun.0/file
Write: /sdcard/Download/1DMP/Others/linuxmint-21.2-cinnamon-64bit.iso -> /config/usb_gadget/g1/functions/mass_storage.0/lun.0/cdrom
Write: -cdrom -> /config/usb_gadget/g1/functions/mass_storage.0/lun.0/ro
Write: 10c00000.dwc3 -> /config/usb_gadget/g1/UDC
beyond1:/ # svc usb setFunctions mass_storage
newbit@S10 %
newbit@S10 % diskutil list /dev/disk2
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *3.0 GB disk2
1: Microsoft Basic Data ⁨⁩ 3.0 GB disk2s1
2: EFI ⁨ESP⁩ 4.3 MB disk2s2

(I am connected via wireless adb)

On my Mac the drive doesn't show up, also not on Windows 10/11, but on Linux it does. I guess it has something to do with the blocksize or hybrid iso format. Disk Util shows the drive, but it is not mounted. There is patch for Mac that could fix this, but it seems to be too high upstream, so I can't patch it.

[PATCH] usb: gadget: mass_storage: Fix cdrom data transfers on MAC-OS

With the Kernel Version cruel-HVJ5-v5.3, only small iso images were getting

mounted. So I applied some patches to the kernel source.

USB-gadget: mass-storage: Support DVD-like images

wget -O - https://github.com/0day-ci/linux/commit/4efab94.patch | patch -p1
wget -O - https://github.com/0day-ci/linux/commit/f8f066e.patch | patch -p1
wget -O - https://github.com/0day-ci/linux/commit/9184ce4cd7ff23a77b6d48d7716ac915b54d120e.patch | patch -p1

Same here, some of these patches seem to be too high upstream, but the size limitation patch worked. If some one can help me to find BACKPORT versions

of these patches, would be great.

A drive.img file I am using as virtual USB drive, is also possible to mount:

newbit@S10 % adb shell
beyond1:/ $ su
beyond1:/ # isodrive cdrom /data/adb/modules/virtsdusb.img -rw
Write: -> /config/usb_gadget/g1/UDC
Write: /data/adb/modules/virtsdusb.img -> /config/usb_gadget/g1/functions/mass_storage.0/lun.0/file
Write: /data/adb/modules/virtsdusb.img -> /config/usb_gadget/g1/functions/mass_storage.0/lun.0/cdrom
Write: -rw -> /config/usb_gadget/g1/functions/mass_storage.0/lun.0/ro
Write: 10c00000.dwc3 -> /config/usb_gadget/g1/UDC
beyond1:/ # svc usb setFunctions mass_storage
newbit@S10 %
newbit@S10 % diskutil list /dev/disk2
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: VirtualImg *8.6 GB disk2

Mounting this image, worked on all three systems.

To unmount just type:

isodrive cdrom

But then the drive gets unmounted no matter what. So it could make

sense to eject the drive first on the host.

The standard functions set into svc usb getFunctions are

mtp,conn_gadget. Which are pulled from getprop persist.sys.usb.config.

After a while, if there is nothing mounted or done with svc usb

it will put back the standard config by itself.

btw: At least it seems on the devel branch, there is still some progress...

Hope this helps a little...

Cheers

NewBit