JeffLIrion / adb_shell

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

AdbDeviceUsb not working with MacOS X due to error 'LIBUSB_ERROR_ACCESS [-3]' #208

Open truebit opened 2 years ago

truebit commented 2 years ago

Description

connect to an USB Android device on Mac OS X failed:

signer = PythonRSASigner(pub, priv)
d = AdbDeviceUsb(serial='f3ee4049') # or without serial parameter
d.connect(rsa_keys=[signer], auth_timeout_s=0.1)

Log

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/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 "/usr/local/lib/python3.10/site-packages/adb_shell/adb_device.py", line 221, in connect
    self._transport.connect(adb_info.transport_timeout_s)
  File "/usr/local/lib/python3.10/site-packages/adb_shell/transport/usb_transport.py", line 242, in connect
    transport.detachKernelDriver(iface_number)
  File "/usr/local/lib/python3.10/site-packages/usb1/__init__.py", line 1199, in detachKernelDriver
    mayRaiseUSBError(
  File "/usr/local/lib/python3.10/site-packages/usb1/__init__.py", line 127, in mayRaiseUSBError
    __raiseUSBError(value)
  File "/usr/local/lib/python3.10/site-packages/usb1/__init__.py", line 119, in raiseUSBError
    raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
usb1.USBErrorAccess: LIBUSB_ERROR_ACCESS [-3]
truebit commented 2 years ago

if I ran the above python script with sudo. the device would connect successfully.

I think this should be related to https://github.com/libusb/libusb/issues/1014

YSaxon commented 10 months ago

try adb kill-server