Hi, in linuxgpio_open() you use linuxgpio_fds[pgm->pinno[i]]. However if some one uses an inverse pin definition, pgm->pinno[i] has PIN_INVERSE set, which is definitely out of bounds of your array.
Something similar can be found in linuxgpio_close with linuxgpio_fds[pgm->pinno[PIN_AVR_RESET]]. In linuxgpio_export/unexport/dir/openfd you should use PIN_MASK. I do not like the idea to have the "linuxgpio" entry in avrdude.conf. Almost everyone who wants to use linuxgpio will probably have another configuration of pins. I think it would be better to put a general template in the documentation (or maybe also as comment in avrdude.conf). This template could be look as follows: -------------------------- # This programmer bitbangs GPIO lines using the Linux sysfs GPIO interface # # Set the configuration below to match the GPIO lines connected to the # relevant ISP header pin. (pin number N corresponds to gpioN) # # Put it in a separate file <your name>.conf, to use it add this file # with -C+<your name>.conf to the command line. # # If the Linux sysfs GPIO interface is compiled in, can be checked by # -c?type on the command line (look for linuxgpio there) programmer id = "<your name>"; desc = "<your description>"; type = "linuxgpio"; reset = ?; sck = ?; mosi = ?; miso = ?; ; -------------------------------------------- If there is a special widely used combination of an embedded board with an avr connected, then one could add for it a specific entry to avrdude.conf. Kind regards René -----Ursprüngliche Nachricht----- Von: avrdude-dev-bounces+r.liebscher=gmx...@nongnu.org [mailto:avrdude-dev-bounces+r.liebscher=gmx...@nongnu.org] Im Auftrag von Radoslav Kolev Gesendet: Dienstag, 8. Januar 2013 17:31 An: Joerg Wunsch Cc: avrdude-dev@nongnu.org Betreff: Re: [avrdude-dev] Updated patch for Linux sysfs GPIO programmer type On Wed, Jan 2, 2013 at 10:39 PM, Joerg Wunsch <j...@uriah.heep.sax.de> wrote: >> Please, have a look at the attached preliminary version and let me >> know if it fits the requirements to be included in the official >> avrdude release. > > From an eyeball-review, it looks mostly good, thanks! I'm attaching an updated version of the patch incorporating all your suggestions. Also I've fixed the off by one pin number issue by assuming that MISO, MOSI, SCK and RESET are always set in the config file, even if the value is zero. I've also added some error checking and reporting for example if the configured pin is already exported and used for somehting else. I'll also put in in the web based patch tracking system. Let me know if you think it requires any further changes. Best regards, Radoslav _______________________________________________ avrdude-dev mailing list avrdude-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avrdude-dev