Sunday, November 17, 2024

driver – macOS recognizes USB CDC-ACM serial port as dialup modem

I am recently attempting to program STM32 microcontrollers under macOS, and I used my CMSIS-DAP compatible interface to flash the microcontroller.

Normally an CMSIS-DAP interface would appear as a USB composite device: it contains an HID device which is used to access the debug port on STM32, and another one as USB CDC ACM serial port (from which you can access a physical serial port on the interface).

Under macOS, CDC serial ports are supposed to be recognized as /dev/tty.usbmodemXXX, but it wouldn’t appear on my Mac at all. Later I would find out it was actually recognized as a dial up modem (in Network tab of system preferences):

CMSIS-DAP Link interface recognized as modem

Of course I didn’t like what macOS did so I tried deleting the device from Network tab and chose “No” when it asks me whether I want it to reappear next time I plug it in, hoping it would let me access the raw serial port device when network services is not trying to occupy it, and it did not. Serial port devices still doesn’t show up. Later it turns out Apple left no way to undo that so I can’t restore my computer to how it behaved in the beginning.

From the ioreg output (after I deleted it from Network and did a bit more research on how to show macOS device hierachy) I can see CDC ACM driver is picking up the CDC serial port part of the composite device but apparently IOSerialBSDClient is not present, meaning serial port is of course not available.

    | |   | | | +-o USB2.1 Hub@00100000  <class IOUSBHostDevice, id 0x100000755, registered, matched, active, busy 0 (243 ms), retain 39>
    | |   | | |   +-o AppleUSB20Hub@00100000  <class AppleUSB20Hub, id 0x100000810, registered, matched, active, busy 0 (236 ms), retain 23>
    | |   | | |   | +-o AppleUSB20HubPort@00110000  <class AppleUSB20HubPort, id 0x10000081d, registered, matched, active, busy 0 (0 ms), retain 12>
    | |   | | |   | +-o AppleUSB20HubPort@00120000  <class AppleUSB20HubPort, id 0x10000081f, registered, matched, active, busy 0 (236 ms), retain 16>
    | |   | | |   | | +-o CMSIS-DAP@00120000  <class IOUSBHostDevice, id 0x100000b2d, registered, matched, active, busy 0 (234 ms), retain 46>
    | |   | | |   | |   +-o AppleUSBCDCCompositeDevice  <class AppleUSBCDCCompositeDevice, id 0x100000b34, !registered, !matched, active, busy 0, retain 4>
    | |   | | |   | |   +-o IOUSBHostInterface@0  <class IOUSBHostInterface, id 0x100000b36, registered, matched, active, busy 0 (21 ms), retain 12>
    | |   | | |   | |   | +-o AppleUserUSBHostHIDDevice  <class AppleUserHIDDevice, id 0x100000b41, registered, matched, active, busy 0 (1 ms), retain 20>
    | |   | | |   | |   |   +-o IOHIDInterface  <class IOHIDInterface, id 0x100000b4a, registered, matched, active, busy 0 (1 ms), retain 6>
    | |   | | |   | |   +-o IOUSBHostInterface@1  <class IOUSBHostInterface, id 0x100000b37, registered, matched, active, busy 0 (8 ms), retain 9>
    | |   | | |   | |   | +-o AppleUSBACMControl  <class AppleUSBACMControl, id 0x100000b40, registered, matched, active, busy 0 (0 ms), retain 6>
    | |   | | |   | |   +-o IOUSBHostInterface@2  <class IOUSBHostInterface, id 0x100000b38, registered, matched, active, busy 0 (220 ms), retain 5>
    | |   | | |   | |   +-o Android File Tra  <class AppleUSBHostDeviceUserClient, id 0x100000b3a, !registered, !matched, active, busy 0, retain 6>
    | |   | | |   | |   +-o Android File Tra  <class AppleUSBHostDeviceUserClient, id 0x100000b4e, !registered, !matched, active, busy 0, retain 6>

The problem here is:

  1. Will I be able to make macOS stop using a dialup modem driver in my system, and just let CDC ACM serial ports be TTY serial ports? Or force it use serial port driver for this device?

  2. How do I let the modem driver pick it up again (i.e. just undo the delete)? I already tried everything in an earlier post and it would not work.

(The CMSIS-DAP interface’s flashing ability is totally fine. Just missing the virtual serial port device from macOS. It would work under my Windows computer and even in Asahi Linux)

Related Articles

Latest Articles