Is there a way to disconnect USB device from ADB?

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.


ADB doesn't support disconnecting a USB connection now(version 1.0.39).

"adb disconnect" can only disconnect a TCP connection set up by "adb connect", it can not disconnect a USB connection.

You can "disconnect" a connection by using push and reconnect commands as a workaround:

1.push a file to phone

adb -s SERIAL push somefile /data/local/tmp

2.reconnect while push is still in progress

adb -s SERIAL reconnect

SERIAL means serial number listed in the output of 'adb devices' command.

Repeat step 1 and 2, after a while, you can find this device is in offline state from output of "adb devices".

No adb command can operate this offline device until you kill-server and start-server.

Tags:

Android

Adb