From 958e86f67eda36a31e193eefc42324a69e0df1d5 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Tue, 29 Sep 2015 19:02:12 +0200 Subject: [PATCH] ratbagctl: pick default device if none given for show-device Lets use the new get_device_path() helper to allow calling show-device without any argument. This follows what show-profile does already. Signed-off-by: David Herrmann --- src/ratbagctl.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/ratbagctl.c b/src/ratbagctl.c index a0da4b17..febca74d 100644 --- a/src/ratbagctl.c +++ b/src/ratbagctl.c @@ -422,9 +422,7 @@ static int show_device_print(struct ratbagctl *ctl, const char *device) _cleanup_(freep) char *path = NULL; int r; - r = sd_bus_path_encode_many(&path, - "/org/freedesktop/ratbag1/device/%", - device); + r = get_device_path(ctl, device, &path, &error); if (r < 0) goto exit; @@ -566,10 +564,6 @@ static int verb_show_device(struct ratbagctl *ctl, int argc, char **argv) } device = argv[optind]; - if (!device) { - fprintf(stderr, "No device specified\n"); - return -EINVAL; - } return show_device_print(ctl, device); }