PlusToolkit / ndicapi

A common C API for communicating with NDI Polaris and Aurora devices
MIT License
47 stars 31 forks source link

More than four serial ports on MacOS #24

Closed thompson318 closed 3 years ago

thompson318 commented 3 years ago

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.

thompson318 commented 3 years ago

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

lassoan commented 3 years ago

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.

thompson318 commented 3 years ago

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

rajkundu commented 1 year ago

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!