I have a requirement where i have to read data streams coming on serial port. I am using javax.comm API for same.
When I try to list ports, using below code I never get any port list.
portList = CommPortIdentifier.getPortIdentifiers();
System.out.println("start: "+portList.hasMoreElements());
It returns false.
Can anyone help me if I am missing anything?
My PS2 port didn't came in list. Is there any other way to list PS2 port??
My full code is as below,
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
System.out.println("portid: "+portId.getName());
}
output
portid: COM1
portid: COM3
portid: LPT1
My actual requirement is to read data on USB port. I was facing issues using JUSB and it didn't work. So I decided to get serial to USb converter and read on serial port. But, there is no such convertable available in market.
Now, thinking of another work around I was able to get a PS2 to usb converter. It would be great if you could help me listing PS2 port using Java and read/write to it or suggest some API for same on windows platform.
Any help in this regard is highly appreciated.