2

I have a few FTDI devices connected to my Mac. They all have the same description, PID, and VID. I want to be able to specify to FT_OpenEx() which one I want to open.

I can use the IO Kit APIs to get the bus location ID of the device I'm interested. The FT_OpenEX() API allows me to pass in a location instead of a description or serial number.

However, the FT APIs that return location IDs return values that look nothing like bus location IDs. One of the devices I have connected has a bus location ID of 0x1a127000, bus when I use the FT APIs to get the locations of all devices, it will say things like 0x1a051 and 0x1a052.

Is there any way to convert from IO Kit bus location ID and the FT location, or otherwise specify which device to use?

John A. Vink
  • 301
  • 1
  • 3
  • 15

2 Answers2

2

I recently had a similar problem: on some locations and devices I got 0 as location id. I wrote a request for assistance to FTDI and this is what I got:

We tested a USB 3.0 host PCI card found it not compatible with our drivers for the following reason.

Existing host ports on a Windows machine are given a name in the format: \device\usbfdo-# where # is a number.

The USB 3.0 card is known as a \device\device# where # is a number.

The USB 3.0 host port does not follow the standard naming convention on a windows machine we do not attempt to open this port to send device ID to when enumerating and trying to load drivers.

As we expect Microsoft to follow convention when they add support for 3.0, we expect the problem to go away from our point of view. As such we are still of the opinion the problem lies with the 3.0 host and not our drivers.

Even if it was possible to make changes to support this host controller it is highly probable that the next host device you try (different manufacturer) will have another variant requiring a different modification. This would not be a sustainable model and goes against the PnP ethos of USB.

We believe this issue has been resolved in Windows 8. We are currently working on the certification of our new windows 8 driver, I expect this to be available by the end of February.

This is not very satisfying but at least it describes why it is not working. When I have time I will try to get the location id by using libusbX and then opening it with the FTDI API routines. Not sure when that will be, though...

Veit

Veit Zimmermann
  • 131
  • 1
  • 7
0

Since I already did this for linux once and have a working solution, I thought I'd try to figure it out for the mac as well. I am not sure if I did this correctly but here's what I came up with:

Basically, you take the MacOSX location id right shift 16 bits, binary & with 0xff00 and add the device address. That should be equal to the location ID you get from the ftdi driver.

Example:
In the "System Information" program I can find my USB device and see something like this:

Location ID:    0x14100000 / 21

That seems to be the "location id / device number". Now plug it into that formula:

0x141000000>>16 = 0x1410
0x1410&0xff00   = 0x1400
0x1400|21       = 0x1415

So in decimal notation the location id is: 5141 which matches what FTDI returned. Note that 21 used above is 0x15 in hex.

I just figured this out 30 minutes ago so if there are problems with this implementation let me know. I need this to work reliably as well. I tried putting a hub between the mac and the device and the formula still applies.

The IOKit calls are:

kr = (*dev)->GetLocationID(dev, &locationid);
kr = (*dev)->GetDeviceAddress(dev, &address);

described at the apple developer reference website.

EDIT since you have 5 digits in your FTDI location id, I would be interested in what your device device number is. Maybe my method doesn't hold up under your circumstances?

Alex
  • 619
  • 1
  • 8
  • 25