Skip to content

USB TTL adapters not recognized on macOS #3

@natevw

Description

@natevw

Your apps are not finding my serial adapter. I have a cheap generic USB↔︎TTL adapter which IOKit lists as follows (on macOS 10.14.6 at least):

{
    CFBundleIdentifier = "com.apple.iokit.IOSerialFamily";
    IOCalloutDevice = "/dev/cu.Repleo-PL2303-00001014";
    IOClass = IOSerialBSDClient;
    IODialinDevice = "/dev/tty.Repleo-PL2303-00001014";
    IOMatchCategory = IODefaultMatchCategory;
    IOProbeScore = 1000;
    IOProviderClass = IOSerialStreamSync;
    IOResourceMatch = IOBSD;
    IOSerialBSDClientType = IOSerialStream;
    IOTTYBaseName = "Repleo-PL2303-";
    IOTTYDevice = "Repleo-PL2303-00001014";
    IOTTYSuffix = 00001014;
}

There's two troubles here:

  1. In your
    CFDictionarySetValue(classesToMatch, CFSTR(kIOSerialBSDTypeKey), CFSTR(kIOSerialBSDRS232Type));
    you are matching on kIOSerialBSDRS232Type. If you search for kIOSerialBSDAllTypes instead, this will at least be included in the results of SerialPort::getSerialPortPaths.
  2. In
    if (portlist.getAllKeys()[i].contains("usbserial")) {
    you are further filtering the list such that the kIOTTYDeviceKey (IOTTYDevice above, what your mac_Serial code calls the "friendly" name) has to include the string "usbserial" — in this case the friendly name is "Repleo-PL2303-00001014" and gets discarded.

This affects all the apps (WT-Flasher, WAV-Trigger-Remote, etc.) but filing here as it's sort of the "main" app. There's not a real easy workaround other than to fix the code, although by carefully tweaking the string constants (and one corresponding CFString length field) in the app binary I was able to get the flasher tool to work on my own machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions