void print_usage(void)
{
fprintf(stderr, "Usage: gpio-hammer [options]...\n" "Hammer GPIO lines, 0->1->0->1...\n" " -n Hammer GPIOs on a named device (must be stated)\n" " -o Offset[s] to hammer, at least one, several can be stated\n" " [-c ] Do loops (optional, infinite loop if not stated)\n" " -? This helptext\n" "\n" "Example:\n" "gpio-hammer -n gpiochip0 -o 4\n"
);
}
int main(int argc, char **argv)
{ constchar *device_name = NULL; unsignedint lines[GPIOHANDLES_MAX]; unsignedint loops = 0; int num_lines; int c; int i;
i = 0; while ((c = getopt(argc, argv, "c:n:o:?")) != -1) { switch (c) { case'c':
loops = strtoul(optarg, NULL, 10); break; case'n':
device_name = optarg; break; case'o': /* * Avoid overflow. Do not immediately error, we want to * be able to accurately report on the amount of times * '-o' was given to give an accurate error message
*/ if (i < GPIOHANDLES_MAX)
lines[i] = strtoul(optarg, NULL, 10);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.