keytable: add support for sharp and mce-kbd protocols
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Sat, 26 Jul 2014 01:39:57 +0000 (22:39 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Sat, 26 Jul 2014 01:49:04 +0000 (22:49 -0300)
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
utils/keytable/ir-keytable.1
utils/keytable/keytable.c

index 54d8e17..d7aaed6 100644 (file)
@@ -78,7 +78,7 @@ a file wit a set of scancode=keycode value pairs
 .IP \fISCANKEY\fR
 a set of scancode1=keycode1,scancode2=keycode2.. value pairs
 .IP \fIPROTOCOL\fR
-protocol name to be enabled (case insensitive). Supported protocols are: NEC, RC-5, RC-6, JVC, SONY, SANYO, LIRC, RC-5-SZ, other, all.
+protocol name to be enabled (case insensitive). Supported protocols are: NEC, RC-5, RC-6, JVC, SONY, SANYO, LIRC, RC-5-SZ, SHARP, MCE-KBD, other, all.
 .IP \fIDELAY\fR
 Delay before repeating a keystroke
 .IP \fIPERIOD\fR
index ceca761..6a8deee 100644 (file)
@@ -86,6 +86,8 @@ enum ir_protocols {
        LIRC            = 1 << 5,
        SANYO           = 1 << 6,
        RC_5_SZ         = 1 << 7,
+       SHARP           = 1 << 8,
+       MCE_KBD         = 1 << 9,
        OTHER           = 1 << 31,
 };
 
@@ -110,7 +112,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, jvc, sony, sanyo, rc-5-sz, lirc, other) to be enabled\n"
+       "  PROTOCOL - protocol name (nec, rc-5, rc-6, jvc, sony, sanyo, rc-5-sz, lirc, sharp, mce_kbd, other, all) 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"
@@ -234,6 +236,10 @@ static error_t parse_keyfile(char *fname, char **table)
                                                        ch_proto |= SANYO;
                                                else if (!strcasecmp(p,"rc-5-sz"))
                                                        ch_proto |= RC_5_SZ;
+                                               else if (!strcasecmp(p,"sharp"))
+                                                       ch_proto |= SHARP;
+                                               else if (!strcasecmp(p,"mce-kbd"))
+                                                       ch_proto |= MCE_KBD;
                                                else if (!strcasecmp(p,"other") || !strcasecmp(p,"unknown"))
                                                        ch_proto |= OTHER;
                                                else {
@@ -471,6 +477,10 @@ static error_t parse_opt(int k, char *arg, struct argp_state *state)
                                ch_proto |= LIRC;
                        else if (!strcasecmp(p,"rc-5-sz"))
                                ch_proto |= RC_5_SZ;
+                       else if (!strcasecmp(p,"sharp"))
+                               ch_proto |= RC_5_SZ;
+                       else if (!strcasecmp(p,"mce-kbd"))
+                               ch_proto |= RC_5_SZ;
                        else if (!strcasecmp(p,"all"))
                                ch_proto |= ~0;
                        else
@@ -746,6 +756,10 @@ static enum ir_protocols v1_get_hw_protocols(char *name)
                        proto |= SANYO;
                else if (!strcmp(p, "rc-5-sz"))
                        proto |= RC_5_SZ;
+               else if (!strcmp(p, "sharp"))
+                       proto |= SHARP;
+               else if (!strcmp(p, "mce-kbd"))
+                       proto |= MCE_KBD;
                else
                        proto |= OTHER;
 
@@ -792,6 +806,12 @@ static int v1_set_hw_protocols(struct rc_device *rc_dev)
        if (rc_dev->current & RC_5_SZ)
                fprintf(fp, "rc-5-sz ");
 
+       if (rc_dev->current & SHARP)
+               fprintf(fp, "sharp ");
+
+       if (rc_dev->current & MCE_KBD)
+               fprintf(fp, "mce_kbd ");
+
        if (rc_dev->current & OTHER)
                fprintf(fp, "unknown ");
 
@@ -923,6 +943,10 @@ static enum ir_protocols v2_get_protocols(struct rc_device *rc_dev, char *name)
                        proto = LIRC;
                else if (!strcmp(p, "rc-5-sz"))
                        proto = RC_5_SZ;
+               else if (!strcmp(p, "sharp"))
+                       proto = SHARP;
+               else if (!strcmp(p, "mce-kbd"))
+                       proto = MCE_KBD;
                else
                        proto = OTHER;
 
@@ -979,6 +1003,12 @@ static int v2_set_protocols(struct rc_device *rc_dev)
        if (rc_dev->current & RC_5_SZ)
                fprintf(fp, "+rc-5-sz\n");
 
+       if (rc_dev->current & SHARP)
+               fprintf(fp, "+sharp\n");
+
+       if (rc_dev->current & MCE_KBD)
+               fprintf(fp, "+mce-kbd\n");
+
        if (rc_dev->current & OTHER)
                fprintf(fp, "+unknown\n");
 
@@ -1008,6 +1038,10 @@ static void show_proto(  enum ir_protocols proto)
                fprintf (stderr, "LIRC ");
        if (proto & RC_5_SZ)
                fprintf (stderr, "RC-5-SZ ");
+       if (proto & SHARP)
+               fprintf (stderr, "SHARP ");
+       if (proto & MCE_KBD)
+               fprintf (stderr, "MCE_KBD ");
        if (proto & OTHER)
                fprintf (stderr, "other ");
 }