keytable: add support for XMP IR protocol
PATCH 1/1 keytable: add support for XMP IR protocol
--- utils/keytable/keytable.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
utils/keytable/keytable.c +25 -1
@@ -86,6 +86,7 @@ enum ir_protocols {LIRC =1 <<5 ,SANYO =1 <<6 ,RC_5_SZ =1 <<7 , +XMP =1 <<8 , 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, 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, xmp, 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"
@@ -234,6 +235,8 @@ 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,"xmp")) + ch_proto |=XMP ; else if (!strcasecmp(p,"other") || !strcasecmp(p,"unknown")) ch_proto |=OTHER ; else {
@@ -471,6 +474,8 @@ 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,"xmp")) + ch_proto |=XMP ; else goto err_inval; p =strtok (NULL ,",;" );
@@ -744,6 +749,8 @@ 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, "xmp")) + proto |=XMP ; else proto |= OTHER;
@@ -790,6 +797,9 @@ 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 &XMP ) +fprintf (fp,"xmp " ); +if (rc_dev->current &OTHER )fprintf (fp,"unknown " );
@@ -921,6 +931,8 @@ 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, "xmp")) + proto =XMP ; else proto =OTHER ;
@@ -977,6 +989,9 @@ 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 &XMP ) +fprintf (fp,"+xmp\n" ); +if (rc_dev->current &OTHER )fprintf (fp,"+unknown\n" );
@@ -1006,6 +1021,8 @@ static void show_proto( enum ir_protocols proto)fprintf (stderr,"LIRC " );if (proto &RC_5_SZ )fprintf (stderr,"RC-5-SZ " ); +if (proto &XMP ) +fprintf (stderr,"XMP " );if (proto &OTHER )fprintf (stderr,"other " ); }
@@ -1128,6 +1145,10 @@ static int get_attribs(struct rc_device *rc_dev, char *sysfs_name) rc_dev->supported |=SONY ;if (v1_get_sw_enabled_protocol (cur->name)) rc_dev->current |=SONY ; + }else if (strstr (cur->name,"/xmp_decoder" )) { + rc_dev->supported |=XMP ; +if (v1_get_sw_enabled_protocol (cur->name)) + rc_dev->current |=XMP ; } }
@@ -1159,6 +1180,9 @@ static int set_proto(struct rc_device *rc_dev)if (rc_dev->supported &SONY ) rc +=v1_set_sw_enabled_protocol (rc_dev,"/sony_decoder" , rc_dev->current &SONY ); +if (rc_dev->supported &XMP ) + rc +=v1_set_sw_enabled_protocol (rc_dev,"/xmp_decoder" , + rc_dev->current &XMP ); }else { rc =v1_set_hw_protocols (rc_dev); }
Signature · 10 lines
1.9.3
--
======-------- Marcel J.E. Mol MESA Consulting B.V.
=======--------- ph. +31-(0)6-54724868 P.O. Box 112
=======--------- [email protected] 2630 AC Nootdorp
__==== www.mesa.nl ---____U_n_i_x______I_n_t_e_r_n_e_t____ The Netherlands ____
They couldn't think of a number, Linux user 1148 -- counter.li.org
so they gave me a name! -- Rupert Hine -- www.ruperthine.comEm Mon, 16 Jun 2014 23:17:11 +0200
"Marcel J.E. Mol" <[email protected]> escreveu:
You also missed your Signed-off-by: here. There will be a small conflict with this patch, as I added yesterday the missing support for sharp and mce-kbd on ir-keytable.
It would be nice if you could rebase it, but if you can't, I'll do it anyway after merging your Kernel patch.
Regards,
Mauro
Quoted 112 lines
--- utils/keytable/keytable.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)utils/keytable/keytable.c +25
-1@@ -86,6 +86,7 @@ enum ir_protocols {LIRC =1 <<5 ,SANYO =1 <<6 ,RC_5_SZ =1 <<7 , +XMP =1 <<8 , 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, 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, xmp, 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" @@ -234,6 +235,8 @@ 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,"xmp")) + ch_proto |=XMP ; else if (!strcasecmp(p,"other") || !strcasecmp(p,"unknown")) ch_proto |=OTHER ; else {@@ -471,6 +474,8 @@ 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,"xmp")) + ch_proto |=XMP ; else goto err_inval; p =strtok (NULL ,",;" );@@ -744,6 +749,8 @@ 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, "xmp")) + proto |=XMP ; else proto |= OTHER;@@ -790,6 +797,9 @@ 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 &XMP ) +fprintf (fp,"xmp " ); +if (rc_dev->current &OTHER )fprintf (fp,"unknown " );@@ -921,6 +931,8 @@ 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, "xmp")) + proto =XMP ; else proto =OTHER ;@@ -977,6 +989,9 @@ 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 &XMP ) +fprintf (fp,"+xmp\n" ); +if (rc_dev->current &OTHER )fprintf (fp,"+unknown\n" );@@ -1006,6 +1021,8 @@ static void show_proto( enum ir_protocols proto)fprintf (stderr,"LIRC " );if (proto &RC_5_SZ )fprintf (stderr,"RC-5-SZ " ); +if (proto &XMP ) +fprintf (stderr,"XMP " );if (proto &OTHER )fprintf (stderr,"other " ); }@@ -1128,6 +1145,10 @@ static int get_attribs(struct rc_device *rc_dev, char *sysfs_name) rc_dev->supported |=SONY ;if (v1_get_sw_enabled_protocol (cur->name)) rc_dev->current |=SONY ; + }else if (strstr (cur->name,"/xmp_decoder" )) { + rc_dev->supported |=XMP ; +if (v1_get_sw_enabled_protocol (cur->name)) + rc_dev->current |=XMP ; } }@@ -1159,6 +1180,9 @@ static int set_proto(struct rc_device *rc_dev)if (rc_dev->supported &SONY ) rc +=v1_set_sw_enabled_protocol (rc_dev,"/sony_decoder" , rc_dev->current &SONY ); +if (rc_dev->supported &XMP ) + rc +=v1_set_sw_enabled_protocol (rc_dev,"/xmp_decoder" , + rc_dev->current &XMP ); }else { rc =v1_set_hw_protocols (rc_dev); }