mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-05 21:38:09 +02:00
tools: tidy up the usage() for the tools a bit
Now that the debug-gui is a user-visible tool, make sure the usage reflects the right command name. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
a69294251d
commit
2d42e87deb
4 changed files with 28 additions and 21 deletions
|
|
@ -907,7 +907,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
tools_init_context(&context);
|
tools_init_context(&context);
|
||||||
|
|
||||||
if (tools_parse_args(argc, argv, &context))
|
if (tools_parse_args("debug-events", argc, argv, &context))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
be_quiet = context.options.quiet;
|
be_quiet = context.options.quiet;
|
||||||
|
|
|
||||||
|
|
@ -877,7 +877,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
tools_init_context(&context);
|
tools_init_context(&context);
|
||||||
|
|
||||||
if (tools_parse_args(argc, argv, &context) != 0)
|
if (tools_parse_args("debug-gui", argc, argv, &context) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
udev = udev_new();
|
udev = udev_new();
|
||||||
|
|
|
||||||
|
|
@ -93,9 +93,10 @@ log_handler(struct libinput *li,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tools_usage(void)
|
tools_usage(const char *command)
|
||||||
{
|
{
|
||||||
printf("Usage: libinput debug-events [options] [--udev [<seat>]|--device /dev/input/event0]\n");
|
printf("Usage: libinput %s [options] [--udev [<seat>]|--device /dev/input/event0]\n",
|
||||||
|
command);
|
||||||
printf("--udev <seat>.... Use udev device discovery (default).\n"
|
printf("--udev <seat>.... Use udev device discovery (default).\n"
|
||||||
" Specifying a seat ID is optional.\n"
|
" Specifying a seat ID is optional.\n"
|
||||||
"--device /path/to/device .... open the given device only\n"
|
"--device /path/to/device .... open the given device only\n"
|
||||||
|
|
@ -160,7 +161,10 @@ tools_init_context(struct tools_context *context)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
tools_parse_args(int argc, char **argv, struct tools_context *context)
|
tools_parse_args(const char *command,
|
||||||
|
int argc,
|
||||||
|
char **argv,
|
||||||
|
struct tools_context *context)
|
||||||
{
|
{
|
||||||
struct tools_options *options = &context->options;
|
struct tools_options *options = &context->options;
|
||||||
|
|
||||||
|
|
@ -205,12 +209,12 @@ tools_parse_args(int argc, char **argv, struct tools_context *context)
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
case OPT_HELP:
|
case OPT_HELP:
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
exit(0);
|
exit(0);
|
||||||
case OPT_DEVICE:
|
case OPT_DEVICE:
|
||||||
options->backend = BACKEND_DEVICE;
|
options->backend = BACKEND_DEVICE;
|
||||||
if (!optarg) {
|
if (!optarg) {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
options->device = optarg;
|
options->device = optarg;
|
||||||
|
|
@ -234,7 +238,7 @@ tools_parse_args(int argc, char **argv, struct tools_context *context)
|
||||||
break;
|
break;
|
||||||
case OPT_TAP_MAP:
|
case OPT_TAP_MAP:
|
||||||
if (!optarg) {
|
if (!optarg) {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (streq(optarg, "lrm")) {
|
if (streq(optarg, "lrm")) {
|
||||||
|
|
@ -242,7 +246,7 @@ tools_parse_args(int argc, char **argv, struct tools_context *context)
|
||||||
} else if (streq(optarg, "lmr")) {
|
} else if (streq(optarg, "lmr")) {
|
||||||
options->tap_map = LIBINPUT_CONFIG_TAP_MAP_LMR;
|
options->tap_map = LIBINPUT_CONFIG_TAP_MAP_LMR;
|
||||||
} else {
|
} else {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -284,7 +288,7 @@ tools_parse_args(int argc, char **argv, struct tools_context *context)
|
||||||
break;
|
break;
|
||||||
case OPT_CLICK_METHOD:
|
case OPT_CLICK_METHOD:
|
||||||
if (!optarg) {
|
if (!optarg) {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (streq(optarg, "none")) {
|
if (streq(optarg, "none")) {
|
||||||
|
|
@ -297,13 +301,13 @@ tools_parse_args(int argc, char **argv, struct tools_context *context)
|
||||||
options->click_method =
|
options->click_method =
|
||||||
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
||||||
} else {
|
} else {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPT_SCROLL_METHOD:
|
case OPT_SCROLL_METHOD:
|
||||||
if (!optarg) {
|
if (!optarg) {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (streq(optarg, "none")) {
|
if (streq(optarg, "none")) {
|
||||||
|
|
@ -319,13 +323,13 @@ tools_parse_args(int argc, char **argv, struct tools_context *context)
|
||||||
options->scroll_method =
|
options->scroll_method =
|
||||||
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
|
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
|
||||||
} else {
|
} else {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPT_SCROLL_BUTTON:
|
case OPT_SCROLL_BUTTON:
|
||||||
if (!optarg) {
|
if (!optarg) {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
options->scroll_button =
|
options->scroll_button =
|
||||||
|
|
@ -340,14 +344,14 @@ tools_parse_args(int argc, char **argv, struct tools_context *context)
|
||||||
break;
|
break;
|
||||||
case OPT_SPEED:
|
case OPT_SPEED:
|
||||||
if (!optarg) {
|
if (!optarg) {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
options->speed = atof(optarg);
|
options->speed = atof(optarg);
|
||||||
break;
|
break;
|
||||||
case OPT_PROFILE:
|
case OPT_PROFILE:
|
||||||
if (!optarg) {
|
if (!optarg) {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (streq(optarg, "adaptive")) {
|
if (streq(optarg, "adaptive")) {
|
||||||
|
|
@ -355,7 +359,7 @@ tools_parse_args(int argc, char **argv, struct tools_context *context)
|
||||||
} else if (streq(optarg, "flat")) {
|
} else if (streq(optarg, "flat")) {
|
||||||
options->profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
|
options->profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
|
||||||
} else {
|
} else {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -366,14 +370,14 @@ tools_parse_args(int argc, char **argv, struct tools_context *context)
|
||||||
options->quiet = true;
|
options->quiet = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
tools_usage();
|
tools_usage(command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,13 @@ struct tools_context {
|
||||||
};
|
};
|
||||||
|
|
||||||
void tools_init_context(struct tools_context *context);
|
void tools_init_context(struct tools_context *context);
|
||||||
int tools_parse_args(int argc, char **argv, struct tools_context *context);
|
int tools_parse_args(const char *command,
|
||||||
|
int argc,
|
||||||
|
char **argv,
|
||||||
|
struct tools_context *context);
|
||||||
struct libinput* tools_open_backend(struct tools_context *context);
|
struct libinput* tools_open_backend(struct tools_context *context);
|
||||||
void tools_device_apply_config(struct libinput_device *device,
|
void tools_device_apply_config(struct libinput_device *device,
|
||||||
struct tools_options *options);
|
struct tools_options *options);
|
||||||
void tools_usage(void);
|
void tools_usage(const char *command);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue