PlusToolkit/ndicapi

More than four serial ports on MacOS

thompson318 opened this issue · 4 comments

Hello, we're having a problem getting serial port names on MacOS, see here Looking at the code for ndiSerialDeviceName at line 645 it seems be hard code to only find the first 4 items in /dev/cu.*. Does anyone know the reason for this? Would it break anything if I changed the 4 to i?
thanks.

Or just increase 4 to a bigger number to avoid dynamically allocating memory. 6 would fix my problem.

Probably the value of 4 was added because above that value there were other devices that did not respond well to probing. It was done probably 10-20 years ago, things are very different now, so you can try and increase the number. We can revert back the number to 4 if we find that it causes issues on some systems (or make the value configurable somewhere).

Note that generation of device name based on an integer value is a convenience method (particularly useful for iterating through a number of devices for automatic detection), but you should be able to open the device by specifying the device name.

Fixed this downstream by using pyserial for serial port discovery instead of ndiSerialDeviceName.

My apologies – I hadn't seen this issue, so I made what seems to be an exact duplicate (#34). My bad!

On the bright side, I believe this should be fixed by #35. That patch does not use a statically-sized array, so there should now be virtually no limit to the number of serial ports that can be searched on macOS. Glad that you got it fixed downstream, though!