Posts

Post not yet marked as solved
2 Replies
1.1k Views
I have a USB CDC ACM device which appears in the /dev filesystem as /dev/tty.usbmodem... and /dev/cu.usbmodem... . Most of the time, I am able to read from and write to this device using serial port libraries, including the POSIX calls open(), read(), write(), etc.However, if the device is plugged in, then my mac goes to sleep for at least a few minutes (3 seems very repeatable), when the PC wakes up and I try to open the file, the call to open() blocks or hangs forever. This also happens if I use the `O_NONBLOCK` option, which should return immediately. I am not loading any special device drivers, but instead relying on the built-in driver loaded for USB CDC ACM devices.This affects not only my software, but also built-in utilities including `screen` and other common libraries including pyserial. I've tried both the /dev/tty.usbmodem... and /dev/cu.usbmodem.. filepaths. This occurs across multiple versions of macOS including Mojave and High Sierra. I've tried using direct USB-C cable connections to the device and different USB-C hubs, all with the same effect.From the output of ioreg -r -c IOUSBHostDevice -l I've confirmed that the com.apple.driver.usb.cdc.acm driver is being loaded for my device. When I unload that driver, the device no longer appears, and when it is reloaded, everything works as normal. After a sleep, I tried to unload and reload the driver without unplugging and reconnecting the physical, hub, but this also does not resolve the issue.sudo kextunload -b com.apple.driver.usb.cdc.acm sudo kextload -b com.apple.driver.usb.cdc.acm
Posted
by blasagna.
Last updated
.