What do you mean by "USB gadgets functions"? As far as I know this is not an official Android feature.
– RobertNov 17 '22 at 08:23
As mentioned, it's unclear what "USB gadgets functions" mean here. Did you mean enabling/disabling the USB functionality of an Android device? Or did you mean turning on/off the connected device? Otherwise, could you provide a concrete example? Also, for those who are not familiar with this, what did you mean by setprop and /dev?
– Andrew T.Nov 17 '22 at 12:46
1
Not possible with ADB but with root you can configure Android's USB Gadget Functions through sysfs on old devices (/sys/class/android_usb/) or configfs on new devices (/config/usb_gadget/). To entirely disable USB Gadget functionality of Linux kernel you need to rebuild the kernel. System properties (setprop) only control how Android framework should configure different gadget functions including ADB and MTP.
– Irfan LatifNov 17 '22 at 15:33
Thanks a lot. I was wondering since i saw few functins with a file explorer.
– TanzinNov 18 '22 at 17:38
one last question, any way/work-around to use usb gadgets without root? api works in non root ?or perhaps porting? (github.com/linux-usb-gadgets)
– TanzinNov 18 '22 at 17:58
setprop
and/dev
? – Andrew T. Nov 17 '22 at 12:46sysfs
on old devices (/sys/class/android_usb/
) orconfigfs
on new devices (/config/usb_gadget/
). To entirely disable USB Gadget functionality of Linux kernel you need to rebuild the kernel. System properties (setprop
) only control how Android framework should configure different gadget functions including ADB and MTP. – Irfan Latif Nov 17 '22 at 15:33