Another option is to recompile your kernel with your button mapping hard coded in. I used this option since the current version of V4L-utils didn't support the Streamzap protocol. This method worked great but would be a pain every time I upgrade as I would need to recompile the kernel, so I also wrote a patch for V4L-utils which adds in the required code to support the RC5-SZ protocol which the Streamzap remote uses. I have a patch for the GIT version and one that should apply to the latest release(0.8.5).
Here's the on for the release version(also adds in any other changes between this version and git):
Code:
--- v4l-utils-0.8.5/utils/keytable/keytable.c 2011-07-17 12:06:39.000000000 -0400
+++ v4l-utils-0.8.5/utils/keytable/keytable.new 2012-01-16 10:26:55.000000000 -0500
@@ -86,6 +86,8 @@
JVC = 1 << 3,
SONY = 1 << 4,
LIRC = 1 << 5,
+ SANYO = 1 << 6,
+ RC_5_SZ = 1 << 7,
OTHER = 1 << 31,
};
@@ -110,7 +112,7 @@
" SYSDEV - the ir class as found at /sys/class/rc\n"
" TABLE - a file with a set of scancode=keycode value pairs\n"
" SCANKEY - a set of scancode1=keycode1,scancode2=keycode2.. value pairs\n"
- " PROTOCOL - protocol name (nec, rc-5, rc-6, other) to be enabled\n"
+ " PROTOCOL - protocol name (nec, rc-5, rc-5-sz, rc-6, jvc, sony, sanyo, lirc, other) to be enabled\n"
" DELAY - Delay before repeating a keystroke\n"
" PERIOD - Period to repeat a keystroke\n"
" CFGFILE - configuration file that associates a driver/table name with a keymap file\n"
@@ -213,7 +215,9 @@
} else if (!strcmp(p, "type")) {
p = strtok(NULL, " ,\n");
do {
- if (!strcasecmp(p,"rc5") || !strcasecmp(p,"rc-5"))
+ if (!strcasecmp(p,"rc5-sz") || !strcasecmp(p,"rc-5-sz"))
+ ch_proto |= RC_5_SZ;
+ else if (!strcasecmp(p,"rc5") || !strcasecmp(p,"rc-5"))
ch_proto |= RC_5;
else if (!strcasecmp(p,"rc6") || !strcasecmp(p,"rc-6"))
ch_proto |= RC_6;
@@ -223,6 +227,8 @@
ch_proto |= JVC;
else if (!strcasecmp(p,"sony"))
ch_proto |= SONY;
+ else if (!strcasecmp(p,"sanyo"))
+ ch_proto |= SANYO;
else if (!strcasecmp(p,"other") || !strcasecmp(p,"unknown"))
ch_proto |= OTHER;
else {
@@ -442,7 +448,9 @@
case 'p':
p = strtok(arg, ",;");
do {
- if (!strcasecmp(p,"rc5") || !strcasecmp(p,"rc-5"))
+ if (!strcasecmp(p,"rc5-sz") || !strcasecmp(p,"rc-5-sz"))
+ ch_proto |= RC_5_SZ;
+ else if (!strcasecmp(p,"rc5") || !strcasecmp(p,"rc-5"))
ch_proto |= RC_5;
else if (!strcasecmp(p,"rc6") || !strcasecmp(p,"rc-6"))
ch_proto |= RC_6;
@@ -452,6 +460,8 @@
ch_proto |= JVC;
else if (!strcasecmp(p,"sony"))
ch_proto |= SONY;
+ else if (!strcasecmp(p,"sanyo"))
+ ch_proto |= SANYO;
else if (!strcasecmp(p,"lirc"))
ch_proto |= LIRC;
else
@@ -713,8 +723,10 @@
while (p) {
if (debug)
fprintf(stderr, "%s protocol %s\n", name, p);
- if (!strcmp(p, "rc-5"))
- proto |= RC_5;
+ if (!strcmp(p, "rc-5-sz"))
+ proto |= RC_5_SZ;
+ else if (!strcmp(p, "rc-5"))
+ proto |= RC_5;
else if (!strcmp(p, "rc-6"))
proto |= RC_6;
else if (!strcmp(p, "nec"))
@@ -723,6 +735,9 @@
proto |= JVC;
else if (!strcmp(p, "sony"))
proto |= SONY;
+ else if (!strcmp(p, "sanyo"))
+ proto |= SANYO;
+
else
proto |= OTHER;
@@ -748,6 +763,9 @@
return errno;
}
+ if (rc_dev->current & RC_5_SZ)
+ fprintf(fp, "rc-5-sz ");
+
if (rc_dev->current & RC_5)
fprintf(fp, "rc-5 ");
@@ -763,6 +781,9 @@
if (rc_dev->current & SONY)
fprintf(fp, "sony ");
+ if (rc_dev->current & SANYO)
+ fprintf(fp, "sanyo ");
+
if (rc_dev->current & OTHER)
fprintf(fp, "unknown ");
@@ -873,7 +894,9 @@
fprintf(stderr, "%s protocol %s (%s)\n", name, p,
enabled? "enabled" : "disabled");
- if (!strcmp(p, "rc-5"))
+ if (!strcmp(p, "rc-5-sz"))
+ proto = RC_5_SZ;
+ else if (!strcmp(p, "rc-5"))
proto = RC_5;
else if (!strcmp(p, "rc-6"))
proto = RC_6;
@@ -883,6 +906,8 @@
proto = JVC;
else if (!strcmp(p, "sony"))
proto = SONY;
+ else if (!strcmp(p, "sanyo"))
+ proto = SANYO;
else if (!strcmp(p, "lirc")) /* Only V2 has LIRC support */
proto = LIRC;
else
@@ -917,6 +942,9 @@
/* Disable all protocols */
fprintf(fp, "none\n");
+ if (rc_dev->current & RC_5_SZ)
+ fprintf(fp, "+rc-5-sz\n");
+
if (rc_dev->current & RC_5)
fprintf(fp, "+rc-5\n");
@@ -932,6 +960,9 @@
if (rc_dev->current & SONY)
fprintf(fp, "+sony\n");
+ if (rc_dev->current & SANYO)
+ fprintf(fp, "+sanyo\n");
+
if (rc_dev->current & LIRC)
fprintf(fp, "+lirc\n");
@@ -952,12 +983,16 @@
fprintf (stderr, "NEC ");
if (proto & RC_5)
fprintf (stderr, "RC-5 ");
+ if (proto & RC_5_SZ)
+ fprintf (stderr, "RC-5-SZ ");
if (proto & RC_6)
fprintf (stderr, "RC-6 ");
if (proto & JVC)
fprintf (stderr, "JVC ");
if (proto & SONY)
fprintf (stderr, "SONY ");
+ if (proto & SANYO)
+ fprintf (stderr, "SANYO ");
if (proto & LIRC)
fprintf (stderr, "LIRC ");
if (proto & OTHER)
@@ -1350,6 +1385,27 @@
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 +1430,7 @@
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 +1452,16 @@
/* 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;
See next message for the git patch. Was too big to fit in one message. :-)