Netdex / android-usb-script

An Android app that allows you to script USB gadgets (work-in-progress).
MIT License
37 stars 12 forks source link

customizing massstorage #13

Closed ahmedfamhy3 closed 1 year ago

ahmedfamhy3 commented 1 year ago

how i can customize the masstorage there isn't any wiki or documentation

Netdex commented 1 year ago

See LuaUsbLibrary.java for the list of options that can be passed to the mass storage gadget.

String file = config.get("file").optjstring("/data/local/tmp/mass_storage-lun0.img");
boolean ro = config.get("ro").optboolean(false);
long size = config.get("size").optlong(256);

Here's an example with all the default options explicitly specified:

_ = luausb.create({ 
    id = 0, 
    type = "storage",
    file = "/data/local/tmp/mass_storage-lun0.img",  -- location of backing file
    ro = false,                                      -- read-only
    size = 256                                       -- size in MiB
})