Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for linux low latency mode issue #2240 (revised) #1

Merged
merged 2 commits into from
May 1, 2021

Conversation

GazHank
Copy link
Owner

@GazHank GazHank commented May 1, 2021

Fix for low latency mode:

Changes

serialport_linux.cpp:

  • Revise the linux set method to only attempt an update if required (if the bit doesn't need to be flipped then don't attempt an unnecessary call for which we might not have permission)
  • Addition of a linux specific linuxGetLowLatencyMode method - for consistency with linuxGetSystemBaudRate, allowing removal of the logic from the more general unix code

serialport_linux.h:

  • Addition of a linux specific linuxGetLowLatencyMode method - for consistency with linuxGetSystemBaudRate

serialport_unix.cpp:

  • Revise sequence of set method - to allow control bits (e.g. dtr) to be set even if low latency fails
  • Revise sequence of get method - to allow control bits (e.g. dtr) to be returned even if get of low latency info fails
  • Revise get method to invoke linux specific method (point 2 above, and removing broken logic in the process)
  • Revise the error messages for the set and get messages for the low latency calls to make it clearer when these fail - since they are likely to fail when we don't have suitable access rights

Testing

Tested on Linux Ubuntu LTS and Win10:

  • Linux without admin rights
    • Set method call {dtr: true} - succeeds without error
    • Set method call {dtr: true, lowLatency: true} - dtr correctly set, error reported for lowLatency, but handled without issue
    • Get method call - succeeds without error
  • Linux with admin rights
    • Set method call {dtr: true} - succeeds without error
    • Set method call {dtr: true, lowLatency: true} - succeeds without error
    • Get method call - succeeds without error
  • Windows 10
    • Set method call {dtr: true} - succeeds without error
    • Set method call {dtr: true, lowLatency: true} - succeeds without error (lowLatency ignored)
    • Get method call - succeeds without error

Additional considerations

The the focus of this change was entirely on addressing errors per serialport#2240 as such I have not performed any actual benchmarking of the lowLatency mode to check for changes to latency (or increases to CPU load - setserial has info on expected benefits/impacts).

@GazHank GazHank merged commit 60a167b into master May 1, 2021
@GazHank GazHank deleted the pr/GazHank/2241-1 branch July 11, 2021 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant