kcuzner / avrdude

avrdude with a Linux SPI programmer type
http://kevincuzner.com/2013/05/27/raspberry-pi-as-an-avr-programmer/
107 stars 68 forks source link

Open of /sys/class/gpio/... fails with permission error on Raspberry Pi #10

Closed thinkingcow closed 6 years ago

thinkingcow commented 8 years ago

On the 2016-03-18 version of Raspbian (Jessie), ownership of the files in /sys/class/gpio are set dynamically in /etc/udev/rules.d/99-com.rules: SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'chown -R root:gpio /sys/class/gpio ... However, the linuxspi driver, when running avrdude as non-root, sometimes tries to open the files before the permissions have been changed.

Suggested fix: If a file open in linuxspi_gpio_op_wr fails, wait a bit and try again, such as:

*\ linuxspi-orig.c 2016-04-03 08:38:00.385085898 -0700 --- linuxspi.c 2016-04-03 08:15:27.283272150 -0700


* 168,173 ** --- 168,180 ---- FILE* f = fopen(fn, "w"); if (!f) {