KoblentsBlog Photography
Contact About
Published Nov 6, 2015
The problem:
echo "foo" | ncat -u <ip> <port>
closes before printing any return value from the (UDP, in this case) server.
There are various solutions proposed. The -q or -Q options don't exist on my system. Using echo -n doesn't help. I didn't try to do a mkfifo. The quick and dirty way worked best (adjust delay based on latency):
1
(echo "foo" && sleep 0.1) | ncat -u <ip> <port>
 
Published Nov 4, 2015
Installing libftdi on a mac is easy these days.
123
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install libusb
$ brew install libftdi
But then you write a program using libftdi, and surprise surprise, it won't let your program open the FTDI device. Something like:
FTDI USB open error: unable to claim usb device. Make sure the default FTDI driver is not in use (-t)
So we can check which FTDI kernel extensions are loaded using
kextstat | grep -i ftdi
, and if there are any, on a modern system, it'll be AppleUSBFTDI. It can be unloaded easily:
sudo kextunload -bundle-id com.apple.driver.AppleUSBFTDI

And if you're lucky, you can now run your programs against libftdi with no issue. When you're done, kextload replacing kextunload in the command above re-loads the driver.
However, you may face a seemingly impossible problem: you unload the kext, you try to run your program, and you get the same exact error. Unplugging and replugging the device doesn't help. It clearly enumerates - it's visible when you do
system_profiler SPUSBDataType
- yet you can't take it!
If this happens, try running
kextstat | grep -i ftdi
again; you'll likely see that the legacy FTDI driver - com.FTDI.driver.FTDIUSBSerialDriver - is now present! Once you unload this too, re-run your code, and it should be able to talk to the FTDI device.
Note: Originally written 11/4/2015, updated 5/4/2021 to note Homebrew's new installer.
 
 
« January 2016 October 2015 »
© Copyright Koblents.com, 2012-2024