From f2bbd411fe9b4cccfa544c01936aa7b19fb30070 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 14 Sep 2015 10:37:33 +1000 Subject: [PATCH] tools: enable a plain dpi get/set Works on the active profile, active resolution by default. Signed-off-by: Peter Hutterer --- tools/ratbag-command.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/ratbag-command.c b/tools/ratbag-command.c index af5028e8..9421c753 100644 --- a/tools/ratbag-command.c +++ b/tools/ratbag-command.c @@ -807,11 +807,33 @@ ratbag_cmd_resolution_dpi(const struct ratbag_cmd *cmd, struct ratbag_cmd_options *options, int argc, char **argv) { + struct ratbag_device *device; + struct ratbag_profile *profile; + struct ratbag_resolution *resolution; + if (argc < 1) { usage(); return 1; } + device = options->device; + profile = options->profile; + resolution = options->resolution; + + if (!resolution) { + if (!profile) + profile = ratbag_cmd_get_active_profile(device); + if (!profile) + return 1; + + resolution = ratbag_cmd_get_active_resolution(profile); + if (!resolution) + return 1; + + options->profile = profile; + options->resolution = resolution; + } + return run_subcommand(argv[0], cmd, ratbag, options, @@ -1174,6 +1196,7 @@ static const struct ratbag_cmd *ratbag_commands[] = { &cmd_button, &cmd_resolution, &cmd_profile, + &cmd_resolution_dpi, NULL, };