1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-24 00:48:27 +02:00

lpc111x-isp/lpc111x.c: new option -n to disable powering the device

This commit is contained in:
Werner Almesberger 2012-12-29 21:18:32 -03:00
parent be82db036f
commit b2f131003d

View File

@ -265,7 +265,7 @@ static void at_exit(void)
} }
static void start_isp(void) static void start_isp(int power)
{ {
const char *res; const char *res;
@ -275,6 +275,7 @@ static void start_isp(void)
} }
atexit(at_exit); atexit(at_exit);
if (power)
ubb_power(1); ubb_power(1);
usleep(100*1000); usleep(100*1000);
@ -306,7 +307,8 @@ static void start_isp(void)
static void usage(const char *name) static void usage(const char *name)
{ {
fprintf(stderr, fprintf(stderr,
"usage: %s [-q] [-v ...]\n\n" "usage: %s [-n] [-q] [-v ...]\n\n"
" -n don't power the device\n"
" -q suppress basic progress messages\n" " -q suppress basic progress messages\n"
" -v increase verbosity level\n" " -v increase verbosity level\n"
, name); , name);
@ -316,10 +318,14 @@ static void usage(const char *name)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int power = 1;
int c; int c;
while ((c = getopt(argc, argv, "qv")) != EOF) while ((c = getopt(argc, argv, "nqv")) != EOF)
switch (c) { switch (c) {
case 'n':
power = 0;
break;
case 'q': case 'q':
quiet = 1; quiet = 1;
break; break;
@ -337,7 +343,7 @@ int main(int argc, char **argv)
usage(*argv); usage(*argv);
} }
start_isp(); start_isp(power);
identify(); identify();