Hi,

I was the maintainer of libusb when Zadig came to be.

Zadig is not part of the libusb project, but the its origin is code
and discussion in the libusb project, which became the libwdi
project.


Liviu Ionescu wrote:
> it looks like I am missing something with the usb configurations. 
> I checked the OpenOCD manual, but could not find an answer.

Your issues are unrelated to OpenOCD, similar to how having the
correct SATA controller driver installed is unrelated to OpenOCD.


> first question: what is the recommended configuration for windows
> to connect to FTDI boards?

It depends. If you do not want to use your device with any other
software than OpenOCD, then using the WinUSB.sys driver for your
device is a perfect strategy.

For the common libusb-1.0 implementation to work, WinUSB.sys must be
the driver used with your device. Setting that is what Zadig does.

If you *do* want to use other software, maybe because your device is
also supported by some proprietary vendor software with different
features than OpenOCD, then things are (much) more complicated,
because the other software generally requires another driver, e.g.
the ftd2xx driver from FTDI.


> is Zadig really mandatory?

Zadig is in any case never mandatory. It is at most a means to an
end, to instruct Windows to use the WinUSB.sys driver for your device.


> I read countless horror stories recommending **not** using Zadig,
> but without Zadig I could not find a way to configure OpenOCD to
> connect to the board.

You would go through the Control Panel and manually select the
WinUSB.sys to be used for your device.

Zadig does not always work perfectly as a way to select WinUSB.sys,
but neither does manually selecting the driver. You may have to switch
back and forth once or twice before WinUSB.sys really works.

Of course, if your vendor software requires a different driver and
Windows is set to use WinUSB.sys, then you have a horror story on
your hands - because the device will then *only* work with OpenOCD.


> second question: for macOS the situation is even more strange;
> using other FTDI devices was flawless, but OpenOCD refuses to
> connect to this board.

"FTDI device" is very unspecific. USB devices are complex and two
devices using the same FTDI chip can still work very differently.

I would guess that macOS recognizes your FTDI chip and considers it
to be a serial port (which is fairly likely) and selects the
appropriate Apple driver for that use case.

Same story here - libusb uses the macOS API to access USB devices,
and if the macOS kernel has loaded a specific driver for a device,
then libusb is not allowed to access it.

It used to be possible to blacklist (some) macOS drivers, so that no
specific driver is loaded and then libusb is allowed access. I can't
say whether this is possible with the FTDI serial port driver, if my
guess is actually correct.


Both Windows and macOS clearly want to "own" the USB driver. There
is one good way to make a USB device work seamlessly cross-platform
while avoiding all these kernel problems, but almost noone knows
about it and most developers are not prepared to learn, but prefer to
treat USB like a serial port with power, and users such as yourself
unfortunately suffer the consequences.

Your best bet may be to set up a Linux VM and pass the USB device
through to it. The good hypervisors work "around" the host kernel,
avoiding the driver issue completely.


//Peter

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to