Unable to open serial port using simply python script on macOS Catalina: [Errno 16] Resource is busy

apple.stackexchange https://apple.stackexchange.com/questions/377174

  •  25-05-2021
  •  | 
  •  

Domanda

On a brand new MacBook16 running Catalina (10.15.1) I am getting the following error trying to connect to an FTDI FT232R USB UART device.

Python 2.7.17 (v2.7.17:c2f86d86e6, Oct 19 2019, 16:07:15) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> ser = serial.Serial('/dev/tty.usbserial-A106NU2I', 38400, timeout=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/cbagwell/.virtualenvs/toolbelt/lib/python2.7/site-packages/serial/serialutil.py", line 240, in __init__
    self.open()
  File "/Users/cbagwell/.virtualenvs/toolbelt/lib/python2.7/site-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 16] could not open port /dev/tty.usbserial-A106NU2I: [Errno 16] Resource busy: '/dev/tty.usbserial-A106NU2I'

I see the following events under the Console application:

006002.877344 python@(null): AppleUSBHostUserClient::openGated: could not open provider USB3.0 Hub             . provider already opened for exclusive access by a kernel client
006002.878136 python@(null): AppleUSBHostUserClient::openGated: could not open provider USB2.0 Hub             . provider already opened for exclusive access by a kernel client

So it appears that some kernel client already has the "/dev/tty.usbserial-A106NU2I" file opened with exclusive access.

My question is, how do I determine which kernel client (or kernel extension?) has this file opened?

I have tried using "sudo lsof | grep tty" and don't see anything there.

The device is visible and recognized under About this Mac -> System Report -> USB

Thanks!

È stato utile?

Soluzione

I had the same problem, serial port resource busy and could not see which process used it.

I found this thread here: https://forums.developer.apple.com/thread/124414

They recommend installing the latest version of the FTDI driver, 2.4.2, found here: https://www.ftdichip.com/Drivers/VCP.htm

That did the trick.

Cheers

Altri suggerimenti

This doesn't work with Catalina. It throws error as following when tried to install.

/Library/Extensions/FTDIUSBSerialDriver.kext failed to load - (libkern/kext) not loadable (reason unspecified); check the system/kernel logs for errors or try kextutil(8)

sudo dmesg

Notice - new kext com.apple.driver.usb.AppleUSBHostPlatformProperties, v1.2 matches prelinked kext but can't determine if executables are the same (no UUIDs).

UPDATE from FTDI

Apple are moving from what are called Kernel Extentions (.kexts) to what are called Driver Extensions (.dexts) for the implementation of drivers starting in macOS Catalina (10.15). Currently .kexts are still supported in macOS Catalina, however after the beta release they issued an update which stopped our driver from loading. This update required our driver (FTDIUSBSerialDriver.kext) to be re-signed and notarized, we completed this process with an updated Apple Developer ID (as they lapse every two years). Unfortunately when Apple issued our new Developer ID to re-sign and notarize the driver package they did so without the .kext support option enabled (as .kexts are being deprecated it is no longer automatically included). This is why there is a code signature issue with our driver, currently we are waiting on Apple issuing us with the correct Developer ID to be able to sign .kexts for macOS Catalina.

As such our current VCP driver available on the website has a signature issue and wont load. However if the device you are using implements a default FTDI VID/PID combination it should be picked up by the inbuilt AppleUSBFTDI.dext driver and present accordingly in the ‘/dev’ folder on your system in the following form:

/dev/cu.usbserial-xxxxxxxx

/dev/tty.usbserial-xxxxxxxx

My FTDI module has default PID VID but still doesn't work. Apple needs to check. enter image description here

UPDATE# FTDI 2.4.4 should work fine with Catalina now.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a apple.stackexchange
scroll top