Reputation: 41
I'm using jSSC-2.6.0 in a cross-platform application. The returned portlist on Windows machines (32/64bit) are correct, however the MacOSX (v10.6 and 10.7) application does not return any serial devices. If I view the serial devices manually in terminal ls /dev/tty.*
, I can view three devices. Running the following line from the jssc example file returns nothing on that same MAC machine:
String[] portNames = SerialPortList.getPortNames();
I can only see a whole bunch of devices, including the ones in the terminal, after I use:
String[] portNames = SerialPortList.getPortNames("/dev/", Pattern.compile("tty."));
A drawback is that it hangs the machine for 10 seconds and on the other machine (10.7) it does not respond after 30 seconds.
Is there a way to reliably connect to a serial device on the MAC using jssc?
Upvotes: 4
Views: 3913
Reputation: 216
jSSC use this regexp
for listing serial ports on Mac: tty.(serial|usbserial|usbmodem).*
If your device cannot be found with this regexp you should change it for getting your device name.
The next important thing is that jSSC try to open port and get termios
structure for identify the real serial device. In described situation I can suggest to use only official and latests drivers. Port listing functionality is realy simple, try to use some serial port terminal for checking this issue on another software.
Upvotes: 3