Fazecast / jSerialComm

Platform-independent serial port access for Java
GNU Lesser General Public License v3.0
1.35k stars 287 forks source link

Low latency support? #284

Closed caoasd53 closed 3 years ago

caoasd53 commented 4 years ago

Would you consider an enhancement to jSerialComm that allowed a Java program to set low latency on a USB serial port, at least under Linux? I am currently using setserial in a launch script outside the Java program to set low latency, but would prefer to be able to configure all attributes of the serial port in one place from within the Java code.

hedgecrw commented 4 years ago

I can't see a reason why setting this flag by default would be an issue for anyone, so I've done that in the latest update. Please test the following library version and see if it works for you without using your 'setserial' launch script:

https://www.dropbox.com/s/tb46283rwtq4jo4/jSerialComm-2.6.2.jar?dl=0

caoasd53 commented 4 years ago

From what I have read other places, setting the low latency flag can/does generate additional interrupt traffic and therefore CPU load. My application uses 4 serial ports, but really only benefits from the low latency setting on 1 port. I installed the version you posted in your previous message and disabled setserial in my launch script. From my testing thus far today, everything is running great with the expected level of performance. If there is additional CPU/interrupt load from the other 3 ports, it is not significant in my application. CPU load during my tests looks normal to the casual observer. Thank you for this change! Hopefully no one else reports an adverse impact.