-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
serialport.set fails on Linux due to Low Latency Mode (@serialport/bindings v9.0.7) #2240
Comments
Hi @reconbot & @jeremy-mf, I wanted to loop you both in as you were involved in the implementation of #2102 so am sure you will be far more knowledgable about this issue than I. I hope that's ok @AlexDygma looping you in for visibility due to impact on Dygmalab/Bazecor#207. I think we need to revert to SerialPort v8 until this is resolved |
Proposed fix to address serialport#2240
Ok, so I have a bit of an update on this issue: The main problem is that setting low latency mode requires admin access. If we try to call to run the set method without admin rights then we hit a few problems:
This all means that since v9.0.7 in order to run the set method we now either need to change the permissions on the ports, or run as sudo (in the case of electron apps As such I propose:
Further to this, there seems to be an issue with the get method (regardless of admin rights), with the method resulting in I think I've got a set of changes which work for this but just need to run some more checks before updating/replacing the Pull Request Do let me know if you have any comments or suggestions Many thanks Gareth |
Fix for linux low latency mode issue serialport#2240 (revised)
Hey all,
Reverting to v8 did fix the issue. I see you pushed fixes for this but I haven't got the chance to test those, but as soon as they're published on npm I'll check that. |
hi @hugohil would you be able to share a little extra info on the environment and version you are using? Which specific version seems to work, vs which one is broken. Any extra info on Linux distro, version and info about the node version you are building would be a bonus. The changes that are in the pipe for this should at the very least improve the clarity of the error you are seeing, since low latency issues will trigger a slightly more specific error message, but I'm not sure if this is a new issue for us to take a look at. I have to say it's quite interesting that you are hitting this issue during the GET step rather than SET which is where I was seeing issues. An extra check you might want to try is to run you app with admin rights (sudo) and see if you still get the error, since the main issue that low latency was actually triggering was an elevated permission requirement Cheers Gaz |
Hey ! @GazHank To be honnest, I did take a fair amount of time around this issue and this is the closest I got, which is still not quite the same thing. I'm working with Lidar scanner, more specifically RPLidar ones, and the Pi was running the python libraries as it should, getting informations and all from the scanner. I checked and those libraries were actually switching the I'll try with more elevated permissions level and update you. |
no problem @hugohil, I really hope the latest changes fix your issues. If v8 works for you on all platforms and v9.0.x works for all platforms except linux then I think this could be the fix you need. Let me know how you get on once you have access the the device again, I'd be happy to try to help. |
|
Hi @vicatcu could you confirm the error message your are seeing? and perhaps the code you are running? I've just rerun some checks on Ubuntu 20.04.2 and I'm not seeing the original issue. I'm able to set DTR: true and see the desired effect on the usb device. I might need a little more info to try to recreate the problem Cheers Gaz |
…serialport#2241) * only set lowLatency if defined * fix set and get methods for low_latency * clarify error messages Proposed fix to address serialport#2240
I'm still facing an issue (or a very similar one) when trying to set anything (in my case, RTS).
Minimal example:
And the output:
Attempted to run this script both as user and root (with The serial device is a standard CH340. |
Can you open this on a new issue? |
2024 Debian 12 and latest version of serial port getting |
Summary of Problem
Code to Reproduce the Issue
Versions, Operating System and Hardware
Additional info
This issue replaces issue #2239 to improve clarity.
It appears that this issue relates to the implementation of #2102. Specifically within the set method at serialport_unix.cpp (line 335) there is an attempt made to set low latency mode irrespective of if lowLatency was specified in the method call. Adding a check for
if (data->lowLatency)
per below seems to resolve this, but there may be another more preferable solution.I have tried adding a check for
defined(ASYNC_LOW_LATENCY)
but this doesnt seem to help...This issue is not present in @serialport/bindings v9.0.4, however if serialport is defined in the dependencies, then when the packages are installed the underlying packages (e.g. bindings) will be upgraded to v9.0.7 resulting in this issue appearing for anyone using serialport >=9.0.0
At present the only way to workaround this issue is to revert to serialport v8, or add @serialport/bindings 9.0.4 into the package.json resolutions per below:
The text was updated successfully, but these errors were encountered: