1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-17 01:35:20 +02:00
ben-blinkenlights/avrdude/patches/local-config.patch

100 lines
3.3 KiB
Diff
Raw Normal View History

Index: avrdude-5.11.1/main.c
===================================================================
--- avrdude-5.11.1.orig/main.c 2012-07-22 10:56:13.864393215 -0300
+++ avrdude-5.11.1/main.c 2012-07-22 11:10:16.845006009 -0300
@@ -57,6 +57,8 @@
#include "update.h"
+#define MAX_LOCAL_CFG 10 /* maximum number of local config files */
+
/* Get VERSION from ac_cfg.h */
char * version = VERSION;
@@ -98,6 +100,7 @@
" -b <baudrate> Override RS-232 baud rate.\n"
" -B <bitclock> Specify JTAG/STK500v2 bit clock period (us).\n"
" -C <config-file> Specify location of configuration file.\n"
+ " -L <config-file> Add project-local configuration file(s).\n"
" -c <programmer> Specify programmer type.\n"
" -D Disable auto erase for flash memory\n"
" -i <delay> ISP Clock Delay [in microseconds]\n"
@@ -271,6 +274,8 @@
char * partdesc; /* part id */
char sys_config[PATH_MAX]; /* system wide config file */
char usr_config[PATH_MAX]; /* per-user config file */
+ const char *local_cfg[MAX_LOCAL_CFG]; /* project-local config files */
+ int n_local_cfg = 0; /* number of local config files */
int cycles; /* erase-rewrite cycles */
int set_cycles; /* value to set the erase-rewrite cycles to */
char * e; /* for strtol() error checking */
@@ -401,7 +406,8 @@
/*
* process command line arguments
*/
- while ((ch = getopt(argc,argv,"?b:B:c:C:DeE:Fi:np:OP:qstU:uvVx:yY:")) != -1) {
+ while ((ch = getopt(argc,argv,"?b:B:c:C:DeE:Fi:L:np:OP:qstU:uvVx:yY:"))
+ != -1) {
switch (ch) {
case 'b': /* override default programmer baud rate */
@@ -456,6 +462,15 @@
ovsigck = 1;
break;
+ case 'L':
+ if (n_local_cfg == MAX_LOCAL_CFG) {
+ fprintf(stderr, "%s: too many local config files (%d)\n",
+ progname, MAX_LOCAL_CFG);
+ exit(1);
+ }
+ local_cfg[n_local_cfg++] = optarg;
+ break;
+
case 'n':
nowrite = 1;
break;
@@ -608,6 +623,20 @@
}
}
}
+
+ for (i = 0; i != n_local_cfg; i++) {
+ if (verbose)
+ fprintf(stderr, "%sLocal configuration file #%d is \"%s\"\n",
+ progbuf, i+1, local_cfg[i]);
+ rc = read_config(local_cfg[i]);
+ if (rc) {
+ fprintf(stderr,
+ "%s: error reading local configuration file \"%s\"\n",
+ progname, local_cfg[i]);
+ exit(1);
+ }
+ }
+
// set bitclock from configuration files unless changed by command line
if (default_bitclock > 0 && bitclock == 0.0) {
bitclock = default_bitclock;
Index: avrdude-5.11.1/avrdude.1
===================================================================
--- avrdude-5.11.1.orig/avrdude.1 2012-07-22 11:52:57.387569871 -0300
+++ avrdude-5.11.1/avrdude.1 2012-07-22 11:59:46.569374592 -0300
@@ -32,6 +32,7 @@
.Op Fl B Ar bitclock
.Op Fl c Ar programmer-id
.Op Fl C Ar config-file
+.Op Fl L Ar config-file
.Op Fl D
.Op Fl e
.Oo Fl E Ar exitspec Ns
@@ -467,6 +468,9 @@
together with
.Fl t
to continue in terminal mode.
+.It Fl L Ar config-file
+Load the specified local config file to complement the
+system and user configuration. This option can be repeated.
.It Fl i Ar delay
For bitbang-type programmers, delay for approximately
.Ar delay