Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
daniellee630911 opened this issue Sep 4, 2023 · 2 comments
Open

Comments

@daniellee630911
Copy link

daniellee630911 commented Sep 4, 2023

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
Copy link

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

@codefuturedalao
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants