3

There are several options for connecting to an FTDI device from a Mac, depending on OS version and driver choice. Some of the techniques have been covered in other stackoverflow questions. One technique has not yet been covered (as far as I can tell), so I'm hoping someone can help with this last technique.

The current options for connecting are as follows:

  1. (pre-Mavericks only) Include the .dylib and header files from the FTDI driver directly in your Xcode project (no driver installation needed), as described in this question. This technique breaks under OSX Mavericks and later.
  2. (Mavericks & later) Use the pre-installed Apple FTDI driver. It's poorly documented, and seems a lot harder to use than the original FTDI driver. This technique won't work if you wish to support pre-Mavericks operating systems.
  3. (Mavericks & later) Unload the kext for Apple's Driver, and then use technique #1, above. Not a good option if you plan on distributing your app to non-tech-savvy customers. Also, it's not a permanent solution for Mavericks+ as the kext will have a tendency to re-appear.
  4. (Any mac version) Implement a codeless kext, that will have a higher match priority than the Apple's kext, thus, preventing Apple's driver from hijacking the connection to your device. Then use technique #1, above. This is one of the techniques suggested by Apple's documentation and by the comments in this stackoverflow answer. It's meant to be used for apps that use a custom connection solution, but it also works for those who just want to include FTDI's dylib and headers directly in their projects.
  5. (Any mac version) Install the original FTDI driver (as opposed to simply referencing the .dylib and headers in your project). This is, obviously, harder than technique #1, especially when it comes to building an installer for your app, but it has the benefit of working on any Mac version. Also, like #4, it is a technique supported by Apple's documentation.

Techniques 1-4 have been covered in other Stackoverflow questions (as noted inline). I'm trying to figure out how to do #5. According to the ReadMe that comes with the FTDI driver, "installing" simply means plopping the .dylib in the /usr/local/lib/ directory and the .h files in the /usr/local/lib/ directory. I've been able to get this technique to work, but ONLY if I also unload Apple's kext. However, according to Apple's documentation, I shouldn't need to unload Apple's kext when using this technique. From Apple's docs:

"the Apple driver intentionally sets a lesser probe score match to ensure that the FTDI Interface driver matches, when present"

So, apparently, "install the FTDI driver" means something different to Apple than it means to FTDI.

Does anyone know how to "install the FTDI driver" in the way that Apple's documentation intends, such that it will have a "higher probe score match" than Apple's kext and, thus, will not require me to unload Apple's kext?

Community
  • 1
  • 1
Troy
  • 21,172
  • 20
  • 74
  • 103

1 Answers1

2

Does anyone know how to "install the FTDI driver" in the way that Apple's documentation intends, such that it will have a "higher probe score match" than Apple's kext and, thus, will not require me to unload Apple's kext?

The "driver" being referred to here is the VCP kernel extension provided by FTDI, not the D2XX drivers. Installing that won't solve your problem, though; it'll just make the device get grabbed by FTDI's drivers instead of Apple's.

If you want to access an FTDI device directly on Mac OS X, your best bet is to set the VID/PID of your device to values which are not captured by either Apple's or FTDI's drivers. You can accomplish this using FT_PROG on Windows, or ft232r_prog on Mac OS X or Linux. (Note that this requires direct access to the FTDI device as well, so you will need to temporarily unload the kernel extensions to reprogram the VID/PID the first time on Mac OS X.)

  • Thanks, that makes sense. I wasn't thinking of the VCP drivers from FTDI... Does changing the VID/PID on the device have any unexpected consequences, or is it just an ID? Sorry if that's a dumb question... I'm not the hardware guy, so I have limited knowledge about the device, itself. – Troy Feb 16 '15 at 19:40
  • Also, is there an easy way to find out what PID values Apple's & FTDI's drivers are looking for? – Troy Feb 16 '15 at 19:43
  • Changing the VID/PID will not affect the function of the device. Contact FTDI support to have a block of PIDs assigned to you — any PIDs they assign to you will not be recognized by their drivers. –  Feb 16 '15 at 20:27
  • You mean they won't work with both the VCP driver *and* the D2XX driver? So, if I want any hope of using the D2XX driver, I need to use option 3 or 4, above? – Troy Feb 16 '15 at 20:46
  • Er, I mean they won't be recognized by the VCP drivers. The D2XX drivers can be used with any compatible FTDI device, regardless of the VID/PID. –  Feb 16 '15 at 20:48