FrameworkComputer / inputmodule-rs

Framework Laptop 16 Input Module SW/FW
MIT License
223 stars 24 forks source link

Better port permission setup and errors #42

Closed zachfeldman closed 1 year ago

zachfeldman commented 1 year ago

This PR achieves two things:

Before:

zach@zach-laptopw:~/dev/inputmodule-rs (main)$ ./target/x86_64-unknown-linux-gnu/debug/inputmodule-control led-matrix --clock
Current Time = 22:30
thread 'main' panicked at 'Failed to open port: Error { kind: Io(PermissionDenied), description: "Permission denied" }', inputmodule-control/src/inputmodule.rs:392:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After:

zach@zach-laptopw:~/dev/inputmodule-rs (main)$ ./target/x86_64-unknown-linux-gnu/debug/inputmodule-control led-matrix --clock
Current Time = 23:46
thread 'main' panicked at 'Permission denied, couldn't access input module port. Ensure that udev rule is installed or the port the module is on is otherwise accessible.', inputmodule-control/src/inputmodule.rs:398:80
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
zachfeldman commented 1 year ago

@JohnAZoidberg just rebased this - could we merge it soon potentially?

JohnAZoidberg commented 1 year ago

Sorry for the long wait @zachfeldman. Thanks for the contribution! :D

JohnAZoidberg commented 1 year ago

I tested it and adjusted a bit according to the best practices recommended by the arch wiki. We don't need to open the permissions to 666. 660 is enough with udev giving access to the logged in user.

zachfeldman commented 1 year ago

Hey no problem @JohnAZoidberg I know it's been a busy time for your team! Thanks so much for taking the time to review this/get it in.