Fazecast/jSerialComm

PTY ports created by "socat" are not searched anymore after 2.9.2 release

zalexua opened this issue · 4 comments

ttyACM0 - real Arduino UNO connected.
ttyACM1 - virtual PTY port created by socat:

# while true; do socat PTY,link=/dev/ttyACM1,mode=777,group=dialout,unlink-close=0  TCP:localhost:23000,forever,interval=3; sleep 2; done

code to discover that:

import com.fazecast.jSerialComm.SerialPort;
public class ComTest {
	public static void main(String[] args) {
		System.out.println("Library Version: " + SerialPort.getVersion​());
		System.out.println("Ports discovered by getCommPorts():");
		
		SerialPort[] ports = SerialPort.getCommPorts();
		
		for (SerialPort port: ports) {
			System.out.println(port.getSystemPortName() + " : " + port.getPortDescription() + " || " + port.getDescriptivePortName());
		}
	}
}

result when use different library versions:

# java -classpath jSerialComm-2.9.1.jar:. ComTest
Library Version: 2.9.1
Ports discovered by getCommPorts():
ttyACM0 : USB-Based Serial Port || USB-Based Serial Port
ttyACM1 : USB-Based Serial Port || USB-Based Serial Port

# java -classpath jSerialComm-2.9.2.jar:. ComTest
Library Version: 2.9.2
Ports discovered by getCommPorts():
ttyACM0 : Serial Device (acm) || Serial Device (acm)

As you can see, the virtual ttyACM1 has been lost from search result.
So, Java software which searches existing ports and allows only to select a port from drop-down will lost possibility to work with such virtual ports too.

I guess it's caused by commit 15ef0dc

But the support of the PTY ports was discussed here many years ago and implemented for socat users for intention. Now it's lost :(

Please test the following beta library version and see if your PTY ports are now visible again:

https://www.dropbox.com/t/wOjW1tbTqZNcHLvX

Thanks for the bug report!

It got back to work!
Now the device is listed and named nicely (better than before), see last one:

# java -classpath jSerialComm-2.10.0-beta3.jar:. ComTest
Library Version: 2.10.0-beta3
Ports discovered by getCommPorts():
ttyS4 : Physical Port S4 || Physical Port S4
ttyS0 : Physical Port S0 || Physical Port S0
ttyUSB0 : CP2102 USB to UART Bridge Controller || CP2102 USB to UART Bridge Controller
ttyACM1 : Pseudo-Terminal Device || PTY Device

Fully implemented and fixed with the latest release of v2.10.0 and v2.10.1.

Now I found another regression - port created by Bluetooth connections got lost.
If I connect to a BT SPP device by command:

# rfcomm connect 1 90:E3:2B:11:7B:B6
Connected /dev/rfcomm1 to 90:E3:2B:11:7B:B6 on channel 1
Press CTRL-C for hangup

The java code example, using v2.9.1 library, sees it as:
rfcomm1 : Bluetooth Port rfcomm1 || Bluetooth Port rfcomm1
and it's missing in output of v2.9.2 and v 2.10.3