aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2017-08-17 17:05:23 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-08-20 09:27:01 -0400
commitb1c04ff76502b1530fe1305301cd26d3cfba13f2 (patch)
treefa1bcc82a9f531aa278048aa80e3c6163a6f1efa
parente440918467868a5f3e7f73f54ef2cbd85d68f3f1 (diff)
ir-keytable: "ir-keytable -s rc1" should only describe rc1, not all
Without this change "ir-keytable -s rc1" lists all rc devices, like it was run without any arguments. Signed-off-by: Sean Young <sean@mess.org>
-rw-r--r--utils/keytable/keytable.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index be569d4d..5d12ec31 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -243,7 +243,7 @@ static const char args_doc[] = N_(
"[for using the rc0 sysdev]");
/* Static vars to store the parameters */
-static char *devclass = "rc0";
+static char *devclass = NULL;
static char *devicename = NULL;
static int readtable = 0;
static int clear = 0;
@@ -1437,15 +1437,15 @@ static void device_info(int fd, char *prepend)
perror ("EVIOCGID");
}
-static int show_sysfs_attribs(struct rc_device *rc_dev)
+static int show_sysfs_attribs(struct rc_device *rc_dev, char *name)
{
static struct sysfs_names *names, *cur;
int fd;
- names = find_device(NULL);
+ names = find_device(name);
if (!names)
return -1;
- for (cur = names; cur->next; cur = cur->next) {
+ for (cur = names; cur; cur = cur->next) {
if (cur->name) {
if (get_attribs(rc_dev, cur->name))
continue;
@@ -1499,12 +1499,15 @@ int main(int argc, char *argv[])
close(fd);
return 0;
}
- if (show_sysfs_attribs(&rc_dev))
+ if (show_sysfs_attribs(&rc_dev, devclass))
return -1;
return 0;
}
+ if (!devclass)
+ devclass = "rc0";
+
if (cfg.next && (clear || keytable || ch_proto || devicename)) {
fprintf (stderr, _("Auto-mode can be used only with --read, --debug and --sysdev options\n"));
return -1;

Privacy Policy