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:
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) {