2

Is it possible to enable USB gadgets functions via ADB? Especially in a Release build device.

i can use setprop but in Release build devices it wont work. Also how do i use the gadgets after enabling it since /dev is read only.

Tanzin
  • 53
  • 1
  • 7
  • What do you mean by "USB gadgets functions"? As far as I know this is not an official Android feature. – Robert Nov 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 Latif Nov 17 '22 at 15:33
  • Thanks a lot. I was wondering since i saw few functins with a file explorer. – Tanzin Nov 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) – Tanzin Nov 18 '22 at 17:58

0 Answers0