node-red / node-red/node-red-nodes
Add error messages when `/dev/input` fails to open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 13h 57m
- Merged PRs (30d)
- 3
Description
Which node are you reporting an issue on?
node-red-node-pi-gpio
What are the steps to reproduce?
- Install node-red on a raspberry pi running raspberry pi OS (Debian 11)
- Make sure the user running node-red is NOT a member of the
inputgroup in/etc/group - Create a flow with an rpi-keyboard node
- Deploy the flow. Note that the rpi-keyboard node will vascillate between "OK" and "Stopped"
- Look in the node red logs (e.g., run
node-red-log) and look for information about what is wrong - Find none. :)
What happens?
There is no error logged that I could find in this circumstance. For background, you can see my discord post about it, too.
What do you expect to happen?
It would be nice if there was a "Failed to open keyboard: permission denied" or similar log message.
I looked at the code, and it seems like lines 185 and 208 of nrgpio.py might be the right place. I'd be happy to submit a PR with a few except calls in there to handle the failed permissions and post error messages. It would be my first contribution, so I wanted to ask about whether (a) this is the right place, and (b) won't this flood the logs with messages over and over, every time it tries to initialise the keyboard or mouse? So is there something I should do to throttle it or limit the amount of logging it does?
If someone wants to answer the questions to make sure I have the problem correctly scoped and whether I'm right about the solution, I will gladly work up and contribute a PR to fix it.
Please tell us about your environment:
- Node-RED version: 3.0.2
- node.js version: v16.20.0
- npm version: 9.6.7
- Platform/OS: Linux raspberrypi 6.1.21-v8+
- Browser: Firefox usually
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading hardware/PiGpio/nrgpio.py around lines 185 and 208, then reproduce the missing /dev/input permission error with the user outside the input group. Check the output with node-red-log; done means failed keyboard or mouse opens produce a useful permission error without repeatedly flooding the logs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100