how does macOS populate /dev/ for connected devices

Background: Rescan USB Serial Converter?


Summary: if you boot a Mac with a USB to serial device (for example) already connected or if you connect that device after it boots without it already connected, an entry for it will be created in /dev/


If you disconnect that device, its entry in /dev/ disappears, which is to be expected.


However if you reconnect that device, its entry in /dev/ is not created and cannot be made to reappear until after rebooting the Mac.


Example:


iMac7:dev john$ ls /dev/tty.*
/dev/tty.Bluetooth-Incoming-Port /dev/tty.iPhone-WirelessiAP
iMac7:dev john$ # Connect the device
iMac7:dev john$ ls /dev/tty.*
/dev/tty.Bluetooth-Incoming-Port /dev/tty.KeySerial1 /dev/tty.USA28X1423P1.1 /dev/tty.USA28X1423P2.2 /dev/tty.iPhone-WirelessiAP
iMac7:dev john$ # Disconnect the device
iMac7:dev john$ ls /dev/tty.*
/dev/tty.Bluetooth-Incoming-Port /dev/tty.iPhone-WirelessiAP
iMac7:dev john$ # Reconnect the device
iMac7:dev john$ ls /dev/tty.*
/dev/tty.Bluetooth-Incoming-Port /dev/tty.iPhone-WirelessiAP


After disconnecting the USB to serial device, the device /dev/tty.KeySerial1 and its related devices /dev/tty.USA28X1423P1.1 and /dev/tty.USA28X1423P2.2 are gone for good and will not reappear until after a reboot.


This behaviour exists as described in El Cap, High Sierra and Catalina, which leads me to believe it's been that way since the beginning and is working as intended. As far as I know a Linux system will repopulate /dev/ automatically, but I am not certain of that.


Is there a workaround? What can I do to force a Mac to repopulate /dev/ as though the device were connected the first time subsequent to a reboot?

Replies

I can't answer your question directly (I don't know how/when the system populates /dev when a USB to serial device appears), but it looks like you're using an ancient Keyspan adapter. I've had good experiences with SiLabs CP210x series converters (including endless amounts of hotplugging), so maybe you should give one of those a try. Look for CP2104-MINIEK at silabs.com.


You may find that the behavior around hot-plugging is different with a different device, with a different device driver.

It is ancient, but I provided that device only as an illustrative example. I also use Prolific devices with recent drivers but the devices themselves are irrelevant—the problem I would like to overcome is macOS's refusal to repopulate /dev/ after the device is disconnected and subsequently reconnected prior to a reboot.


The problem is illustrated in the example. Certain applications and devices require that device to be present in /dev/ and won't work without it.