permissions - EPERM error writing to file in node.js -
i'm trying update gpios on raspberrypi writing /sys/class/gpio
folder , it's subfolders , files.
when run command
fs.readfilesync('/sys/class/gpio/gpio2/value', 'utf-8');
i correct response, no problem.
when run
fs.writefilesync('/sys/class/gpio/gpio2/value',0);
i eperm error, if understand correctly, telling me don't have correct permissions write file.
when list permissions on file, see both root , gpio group have read , write permissions, , current user 'pi' part of gpio group. should fine.
if run sudo node, should have permission, still eperm error.
it appears me '/sys/class/gpio' virtual path '/sys/devices/gpio', looking @ permissions on folder, gpio group has permissions there too, , of course, root.
is specific gpio? see few node modules enable gpio control via fs.writefile, example, https://github.com/enotionz/gpio/blob/master/lib/gpio.js writes directly same directory.
Comments
Post a Comment