mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-23 22:57:11 +02:00
ubb-patgen/ubb-patgen.c: new option -p to force interpretation as pattern
In the unlikely event that we have a file with the same name.
This commit is contained in:
parent
69aba6ae19
commit
d60ef14022
@ -489,10 +489,11 @@ static void usage(const char *name)
|
||||
"usage: %s\n"
|
||||
" %s [-q] -f freq_hz\n"
|
||||
" %s [-q] [-f freq_hz] -c [active_s]\n"
|
||||
" %s [-q] [-f freq_hz] [-C] file|pattern\n\n"
|
||||
" %s [-q] [-f freq_hz] [-C] [-p] file|pattern\n\n"
|
||||
" -c output bus clock on CLK without sending a pattern\n"
|
||||
" -C temporarily output bus clock on CLK (for debugging)\n"
|
||||
" -f freq_hz set bus clock to the specified frequency (default: 1 MHz)\n"
|
||||
" -p force interpretation of argument as pattern (and not file)\n"
|
||||
" -q quiet. Don't pretty-print frequencies; don't report clock\n"
|
||||
" differences.\n\n"
|
||||
" active_s keep running that many seconds after setting the clock\n"
|
||||
@ -515,14 +516,14 @@ int main(int argc, char **argv)
|
||||
struct mmcclk clk;
|
||||
int bus_hz = 0, clk_only = 0, clkout = 0, bus_rel = 0;
|
||||
const char *pattern = NULL;
|
||||
int quiet = 0;
|
||||
int quiet = 0, force_pattern = 0;
|
||||
double active_s = 0;
|
||||
struct timespec active_ns;
|
||||
int keep_clk = 1;
|
||||
char *end;
|
||||
int c;
|
||||
|
||||
while ((c = getopt(argc, argv, "cCf:q")) != EOF)
|
||||
while ((c = getopt(argc, argv, "cCf:pq")) != EOF)
|
||||
switch (c) {
|
||||
case 'f':
|
||||
if (!frequency(optarg, &bus_hz, &bus_rel))
|
||||
@ -534,6 +535,9 @@ int main(int argc, char **argv)
|
||||
case 'C':
|
||||
clkout = 1;
|
||||
break;
|
||||
case 'p':
|
||||
force_pattern = 1;
|
||||
break;
|
||||
case 'q':
|
||||
quiet = 1;
|
||||
break;
|
||||
@ -548,7 +552,7 @@ int main(int argc, char **argv)
|
||||
case 0:
|
||||
if (clk_only)
|
||||
break;
|
||||
if (clkout)
|
||||
if (clkout || force_pattern)
|
||||
usage(*argv);
|
||||
|
||||
ubb_open(UBB_ALL);
|
||||
@ -565,6 +569,8 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
case 1:
|
||||
if (clk_only) {
|
||||
if (force_pattern)
|
||||
usage(*argv);
|
||||
active_s = strtod(argv[argc-1], &end);
|
||||
if (*end)
|
||||
usage(*argv);
|
||||
@ -579,7 +585,7 @@ int main(int argc, char **argv)
|
||||
usage(*argv);
|
||||
}
|
||||
|
||||
if (pattern)
|
||||
if (pattern && !force_pattern)
|
||||
pattern = load_pattern(pattern);
|
||||
|
||||
ubb_open(UBB_ALL);
|
||||
|
Loading…
Reference in New Issue
Block a user