robertsonics / WTConfig

Tsunami / WAV Trigger Unified Configurator Utility
4 stars 4 forks source link

USB TTL adapters not recognized on macOS #3

Open natevw opened 3 years ago

natevw commented 3 years ago

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 https://github.com/robertsonics/WTConfig/blob/6df9642d143cb2db67d6d256f23ff1caae8854a4/Source/mac_Serial.cpp#L44 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 https://github.com/robertsonics/WTConfig/blob/6df9642d143cb2db67d6d256f23ff1caae8854a4/Source/MainComponent.cpp#L213 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.