Hello! Thank you for your efforts with the library.
I am trying to run it on a Raspberry Pi 3 (Raspbian GNU/Linux 8 (jessie)), and it is impossible to make it work without sudo. To narrow down the issue for you, here is what I am talking about:
pi@raspberrypi:~/node_modules/rc522 $ node rc522_output.js
bcm2835_init: Unable to open /dev/mem: Permission denied
Segmentation fault
It works with sudo though, and reads the RFID tags properly. It seems that your library still tries to access /dev/mem even when it's not running under root. This fault seems to contradict this excerpt from your documentation:
Prior to the release of Raspbian Jessie in Feb 2016, access to any peripheral device via /dev/mem on the RPi required the process to run as root. Raspbian Jessie permits non-root users to access the GPIO peripheral (only) via /dev/gpiomem, and this library supports that limited mode of operation.
If the library runs with effective UID of 0 (ie root), then bcm2835_init() will attempt to open /dev/mem, and, if successful, it will permit use of all peripherals and library functions.
If the library runs with any other effective UID (ie not root), then bcm2835_init() will attempt to open /dev/gpiomem, and, if successful, will only permit GPIO operations. In particular, bcm2835_spi_begin() and bcm2835_i2c_begin() will return false and all other non-gpio operations may fail silently or crash.
My permissions to the devices are below:
pi@raspberrypi:~/node_modules/rc522 $ ls -lat /dev/mem
crw-r----- 1 root kmem 1, 1 Oct 11 16:20 /dev/mem
pi@raspberrypi:~/node_modules/rc522 $ ls -lat /dev/gpio*
crw-rw---- 1 root gpio 244, 0 Oct 11 16:20 /dev/gpiomem
It is imperative that sudo is not used in our application, because we are calling this library from Node-RED framework, which cannot properly terminate processes launched with sudo. Please, let me know if there is anything immediate that can be done about this, as my school project depends on this library functioning properly.
Another issue with the library is that everything fails silently. For instance, when we launch
pi@raspberrypi:~/node_modules/rc522 $ node main.js
there are no error messages passed to the console from the child processes... The proper handling of error messages would be most helpful.
Thank you.
Hello! Thank you for your efforts with the library.
I am trying to run it on a Raspberry Pi 3 (Raspbian GNU/Linux 8 (jessie)), and it is impossible to make it work without
sudo. To narrow down the issue for you, here is what I am talking about:It works with sudo though, and reads the RFID tags properly. It seems that your library still tries to access
/dev/memeven when it's not running underroot. This fault seems to contradict this excerpt from your documentation:My permissions to the devices are below:
It is imperative that
sudois not used in our application, because we are calling this library from Node-RED framework, which cannot properly terminate processes launched withsudo. Please, let me know if there is anything immediate that can be done about this, as my school project depends on this library functioning properly.Another issue with the library is that everything fails silently. For instance, when we launch
pi@raspberrypi:~/node_modules/rc522 $ node main.jsthere are no error messages passed to the console from the child processes... The proper handling of error messages would be most helpful.
Thank you.