keytable: Add support for Sanyo IR protocol
authorMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 23 Nov 2011 21:29:37 +0000 (19:29 -0200)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 23 Nov 2011 21:32:34 +0000 (19:32 -0200)
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
utils/keytable/keytable.c

index 3abf36b..2dc8e66 100644 (file)
@@ -86,6 +86,7 @@ enum ir_protocols {
        JVC             = 1 << 3,
        SONY            = 1 << 4,
        LIRC            = 1 << 5,
+       SANYO           = 1 << 6,
        OTHER           = 1 << 31,
 };
 
@@ -110,7 +111,7 @@ static const char doc[] = "\nAllows get/set IR keycode/scancode tables\n"
        "  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-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"
@@ -223,6 +224,8 @@ static error_t parse_keyfile(char *fname, char **table)
                                                        ch_proto |= JVC;
                                                else if (!strcasecmp(p,"sony"))
                                                        ch_proto |= SONY;
+                                               else if (!strcasecmp(p,"sanyo"))
+                                                       ch_proto |= SONY;
                                                else if (!strcasecmp(p,"other") || !strcasecmp(p,"unknown"))
                                                        ch_proto |= OTHER;
                                                else {
@@ -452,6 +455,8 @@ static error_t parse_opt(int k, char *arg, struct argp_state *state)
                                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
@@ -723,6 +728,8 @@ static enum ir_protocols v1_get_hw_protocols(char *name)
                        proto |= JVC;
                else if (!strcmp(p, "sony"))
                        proto |= SONY;
+               else if (!strcmp(p, "sanyo"))
+                       proto |= SANYO;
                else
                        proto |= OTHER;
 
@@ -763,6 +770,9 @@ static int v1_set_hw_protocols(struct rc_device *rc_dev)
        if (rc_dev->current & SONY)
                fprintf(fp, "sony ");
 
+       if (rc_dev->current & SANYO)
+               fprintf(fp, "sanyo ");
+
        if (rc_dev->current & OTHER)
                fprintf(fp, "unknown ");
 
@@ -883,6 +893,8 @@ static enum ir_protocols v2_get_protocols(struct rc_device *rc_dev, char *name)
                        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
@@ -932,6 +944,9 @@ static int v2_set_protocols(struct rc_device *rc_dev)
        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");
 
@@ -958,6 +973,8 @@ static void show_proto(     enum ir_protocols proto)
                fprintf (stderr, "JVC ");
        if (proto & SONY)
                fprintf (stderr, "SONY ");
+       if (proto & SANYO)
+               fprintf (stderr, "SANYO ");
        if (proto & LIRC)
                fprintf (stderr, "LIRC ");
        if (proto & OTHER)