Device instantiation fails on OS X Mavericks

Issue #13 resolved
Ben Bass
repo owner created an issue

The following is consistent and representative of the failure mode. Note this is similar to the issue which previously required an unload of the FTDI serial driver (e.g. as installed by Arduino), but this appears to be different, as that driver isn't (apparently) loaded.

MacBook-Air:~ ben$ sudo python
Python 2.7.5 (default, Aug 25 2013, 00:04:04) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pylibftdi import *
>>> Driver().list_devices()
[('FTDI', 'UB232R', 'FTAS1UN5')]
>>> Driver().libftdi_version()
(1, 0, 0, '1.0', 'unknown')
>>> d = Device()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/pylibftdi/driver.py", line 236, in __init__
    self.open()
  File "/Library/Python/2.7/site-packages/pylibftdi/driver.py", line 291, in open
    raise FtdiError(msg)
pylibftdi._base.FtdiError: device not found (-3)
>>> 

Comments (5)

  1. Ben Bass reporter

    Tracing through with pdb shows that this is iterating through VID/PID combinations (all two of them), and when none succeed it returns the result of the last one, even though the first is the 'interesting' error. (This is testing with a UB232R)

    Error -5, unable to claim usb device. Make sure the default FTDI driver is not in use

    So at the very least resolving this ticket should include some sense of error priorities, where -3 'unable to find device' is a lower priority than -5 'can find it, but can't open it'.

  2. Ben Bass reporter

    Aha...:

    MacBook-Air:~ ben$ kextstat | grep -i ftdi
      130    0 0xffffff7f82231000 0x7000     0x7000     com.apple.driver.AppleUSBFTDI (1.0.1b1) <116 35 5 4 3>
    MacBook-Air:~ ben$ sudo kextunload -bundle-id com.apple.driver.AppleUSBFTDI
    MacBook-Air:~ ben$ kextstat | grep -i ftdi
    MacBook-Air:~ ben$ sudo python -m pylibftdi.examples.led_flash
    <working>
    

    so key thing here is a documentation update.

  3. Log in to comment