mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-04 22:53:08 +02:00
lpc111x-isp/lpc111x.c: new option -n to disable powering the device
This commit is contained in:
parent
be82db036f
commit
b2f131003d
@ -265,7 +265,7 @@ static void at_exit(void)
|
||||
}
|
||||
|
||||
|
||||
static void start_isp(void)
|
||||
static void start_isp(int power)
|
||||
{
|
||||
const char *res;
|
||||
|
||||
@ -275,7 +275,8 @@ static void start_isp(void)
|
||||
}
|
||||
atexit(at_exit);
|
||||
|
||||
ubb_power(1);
|
||||
if (power)
|
||||
ubb_power(1);
|
||||
|
||||
usleep(100*1000);
|
||||
|
||||
@ -306,7 +307,8 @@ static void start_isp(void)
|
||||
static void usage(const char *name)
|
||||
{
|
||||
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"
|
||||
" -v increase verbosity level\n"
|
||||
, name);
|
||||
@ -316,10 +318,14 @@ static void usage(const char *name)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int power = 1;
|
||||
int c;
|
||||
|
||||
while ((c = getopt(argc, argv, "qv")) != EOF)
|
||||
while ((c = getopt(argc, argv, "nqv")) != EOF)
|
||||
switch (c) {
|
||||
case 'n':
|
||||
power = 0;
|
||||
break;
|
||||
case 'q':
|
||||
quiet = 1;
|
||||
break;
|
||||
@ -337,7 +343,7 @@ int main(int argc, char **argv)
|
||||
usage(*argv);
|
||||
}
|
||||
|
||||
start_isp();
|
||||
start_isp(power);
|
||||
|
||||
identify();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user