This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: Improve keycode reading by using V2 of the input protocol
Author:  Mauro Carvalho Chehab <[email protected]>
Date:    Tue Jan 25 10:37:45 2011 -0200

Instead of seeking for keys into the entire keycode space, use
V2. This allow to read just the codes that are inside the table.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 utils/keytable/keytable.c |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=db5df3ffe3637cb6ac1d70015552e94b8975f961

diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index 21cd5c2..08fdaa9 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -1251,7 +1251,7 @@ static void test_event(int fd)
        }
 }
 
-static void display_table(struct rc_device *rc_dev, int fd)
+static void display_table_v1(struct rc_device *rc_dev, int fd)
 {
        unsigned int i, j;
 
@@ -1269,6 +1269,40 @@ static void display_table(struct rc_device *rc_dev, int 
fd)
        display_proto(rc_dev);
 }
 
+static void display_table_v2(struct rc_device *rc_dev, int fd)
+{
+       int i;
+       struct input_keymap_entry_v2 entry;
+       int codes[2];
+
+       memset(&entry, '\0', sizeof(entry));
+       i = 0;
+       do {
+               entry.flags = KEYMAP_BY_INDEX;
+               entry.index = i;
+
+               if (ioctl(fd, EVIOCGKEYCODE_V2, &entry) == -1)
+                       break;
+
+               /* FIXME: Extend it to support scancodes > 32 bits */
+               codes[0] = ((u_int32_t *)entry.scancode)[0];
+               codes[1] = entry.keycode;
+
+               prtcode(codes);
+               i++;
+       } while (1);
+       display_proto(rc_dev);
+}
+
+static void display_table(struct rc_device *rc_dev, int fd)
+{
+       if (input_protocol_version < 0x10001)
+               display_table_v1(rc_dev, fd);
+       else
+               display_table_v2(rc_dev, fd);
+}
+
+
 int main(int argc, char *argv[])
 {
        int dev_from_class = 0, write_cnt;

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to