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

Need to report a decent error if the user doesn't have permissions for a serial port #33

Open
mrstegeman opened this issue Aug 30, 2018 · 2 comments

Comments

@mrstegeman
Copy link
Contributor

By default (under ubuntu) you need to be root or a member of the dialout group in order to open the serial port.

If the user doesn't have sufficient permissions then we should detect this and report a reasonable error.

Requires WebThingsIO/gateway#877

@Swaagie
Copy link

Swaagie commented Feb 29, 2020

@mrstegeman The first (partial) fix for this is in systemd systemd/systemd#14959 (comment). Just ran into the same issue a bit different. serialport uses udevadm info -e under the hood to list available ports. However udevadm didn't emit any errors and only exits with code 1. The second step here would be getting serialport to listen for the errors (or at minimum exit code 1 on finish) https://github.com/serialport/node-serialport/blob/258574260f312cdeb81bb265a437762f8e5e0ae4/packages/bindings/lib/linux-list.js#L43.

I'll open a PR against serialport to at rejecton exit code 1 as I'm unsure how fast different distro's will pickup on the improved systemd. From source code it seems that both darwin and w32 use async/await and should throw on error.

After serialport merges the PR, gateway should technically be able to reject based on errors.

@Swaagie
Copy link

Swaagie commented Mar 7, 2020

serialport/node-serialport#2046 is now a thing and list should reject with an error

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

No branches or pull requests

2 participants