aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-08-13 17:54:49 (GMT)
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-08-13 17:54:49 (GMT)
commita66d38bd2006ac9705031e048f27e6c480560347 (patch)
tree98f2f4ca135c432cd9faf280d4cdb4fcfa468bad
parentab0d16a2575b385c10992be8a7be8d4a7836b28c (diff)
keytable: Add more information about the device
Print more information about the device on query mode. It also provides some info when called with the compatibility mode or against a non-RC device (e. g. now it will provide some info if someone uses -d <device> parameter). Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--utils/keytable/keytable.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index aa0627f..3abf36b 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -1350,6 +1350,27 @@ static void show_evdev_attribs(int fd)
get_rate(fd, &delay, &period);
}
+static void device_info(int fd, char *prepend)
+{
+ struct input_id id;
+ char buf[32];
+ int rc;
+
+ rc = ioctl(fd, EVIOCGNAME(sizeof(buf)), buf);
+ if (rc >= 0)
+ fprintf(stderr,"%sName: %.*s\n",prepend, rc, buf);
+ else
+ perror ("EVIOCGNAME");
+
+ rc = ioctl(fd, EVIOCGID, &id);
+ if (rc >= 0)
+ fprintf(stderr,
+ "%sbus: %d, vendor/product: %04x:%04x, version: 0x%04x\n",
+ prepend, id.bustype, id.vendor, id.product, id.version);
+ else
+ perror ("EVIOCGID");
+}
+
static int show_sysfs_attribs(struct rc_device *rc_dev)
{
static struct sysfs_names *names, *cur;
@@ -1374,6 +1395,7 @@ static int show_sysfs_attribs(struct rc_device *rc_dev)
display_proto(rc_dev);
fd = open(rc_dev->input_name, O_RDONLY);
if (fd > 0) {
+ device_info(fd, "\t");
show_evdev_attribs(fd);
close(fd);
} else {
@@ -1395,6 +1417,16 @@ int main(int argc, char *argv[])
/* Just list all devices */
if (!clear && !readtable && !keys.next && !ch_proto && !cfg.next && !test && !delay && !period) {
+ if (devname) {
+ fd = open(devname, O_RDONLY);
+ if (fd < 0) {
+ perror("Can't open device");
+ return -1;
+ }
+ device_info(fd, "");
+ close(fd);
+ return 0;
+ }
if (show_sysfs_attribs(&rc_dev))
return -1;

Privacy Policy