JeffLIrion / adb_shell

A Python implementation of ADB with shell and FileSync functionality.
Apache License 2.0
530 stars 60 forks source link

usb1.USBErrorBusy: LIBUSB_ERROR_BUSY [-6] when connect to device #225

Open daniellee630911 opened 1 year ago

daniellee630911 commented 1 year ago

Description

Following the readme guide to connect device, but the error raise when connect to device. Link

I can reproduce this every time, and never get sucess connect.

My code is

from adb_shell.auth.keygen import keygen

from adb_shell.adb_device import AdbDeviceTcp, AdbDeviceUsb

from adb_shell.auth.sign_pythonrsa import PythonRSASigner

keygen('./adbkey')

adbkey = './adbkey'

with open(adbkey) as f:

priv = f.read()

with open(adbkey + '.pub') as f:

 pub = f.read()

signer = PythonRSASigner(pub, priv)

device = AdbDeviceUsb()

device.connect(rsa_keys=[signer], auth_timeout_s=0.1)

Log

Traceback (most recent call last): File "/home/lleedaniel/Test_Code/gren_RSA_KEY.py", line 15, in device2.connect(rsa_keys=[signer], auth_timeout_s=0.1) File "/home/lleedaniel/.local/lib/python3.11/site-packages/adb_shell/adb_device.py", line 675, in connect self._available, self._maxdata = self._io_manager.connect(self._banner, rsa_keys, auth_timeout_s, auth_callback, adb_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/lleedaniel/.local/lib/python3.11/site-packages/adb_shell/adb_device.py", line 221, in connect self._transport.connect(adb_info.transport_timeout_s) File "/home/lleedaniel/.local/lib/python3.11/site-packages/adb_shell/transport/usb_transport.py", line 254, in connect self._transport.claimInterface(self._interface_number) File "/home/lleedaniel/.local/lib/python3.11/site-packages/usb1/init.py", line 1146, in claimInterface mayRaiseUSBError( File "/home/lleedaniel/.local/lib/python3.11/site-packages/usb1/init.py", line 127, in mayRaiseUSBError raiseUSBError(value) File "/home/lleedaniel/.local/lib/python3.11/site-packages/usb1/init.py", line 119, in raiseUSBError raise STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value) usb1.USBErrorBusy: LIBUSB_ERROR_BUSY [-6]

JoaoPedroMDP commented 10 months ago

Same thing here. I solved killing the shell with ./adb kill-server after seeing this issue

codefuturedalao commented 7 months ago

that really matters, "adb kill-server" is not a elegant way