Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to disconnect USB device from ADB?

Tags:

android

adb

I have a lot of scripts that use ADB to debug Android applications via Wi-Fi with emulators. The problem appears when I charge my Android phone via USB from my computer: ADB sees it and sends commands to my phone instead of emulator. Is there a way to disconnect ADB from phone that charges via USB? I know I can send commands to emulators only via -e switch, as well as send them to specific device via -s switch. However, it is not OK for me, because I have to rewrite a lot of scripts to add more arguments if I want to implement this device selection feature. I don't need workarounds, I just curious does Google force ADB to debug any phone connected via USB that has USB debugging enabled in settings, or it is possible to remove specific USB connected phone from devices list on ADB side? When I run adb disconnect, USB device remains connected.

like image 453
Vitalii Avatar asked May 26 '16 12:05

Vitalii


People also ask

How do I detach a device from adb?

To disable adb - you can use adb disconnect or simply turn off usb debugging under developer options . For disconnecting usb connection for internal storage certain ROMS have the option.


1 Answers

USB connection for internal storage and adb connection for debugging are two separate things.

To disable adb - you can use adb disconnect or simply turn off usb debugging under developer options.

For disconnecting usb connection for internal storage certain ROMS have the option. e.g. CM 13 that i have at the moment allows connecting USB just for charging. Generally on other ROMS and Stock ROM I've not seen this option but you can try this. -> If you connect your device via USB while locked the internal storage will not be available unless you unlock the device once.

like image 173
AndroidMechanic - Viral Patel Avatar answered Sep 17 '22 15:09

AndroidMechanic - Viral Patel