This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:
Subject: ir-keytable: be more permissive on protocol name Author: Sean Young <[email protected]> Date: Mon Mar 20 05:40:49 2017 -0300 Allowed the protocol to be specified with or without underscores or dashes. This also solves the problem of not being able to load the streamzap keymap. ./ir-keytable -w rc_keymaps/streamzap Protocol RC5_SZ invalid Reported-by: Matthias Reichl <[email protected]> Signed-off-by: Sean Young <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> utils/keytable/keytable.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=90897deb456724d6df980b8d7c53d31ffbe473c2 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index a6ecc9e3dc2e..bb5d0bd14622 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -120,9 +120,7 @@ const struct protocol_map_entry protocol_map[] = { { "other", NULL, SYSFS_OTHER }, { "lirc", NULL, SYSFS_LIRC }, { "rc-5", "/rc5_decoder", SYSFS_RC5 }, - { "rc5", NULL, SYSFS_RC5 }, { "rc-5x", NULL, SYSFS_INVALID }, - { "rc5x", NULL, SYSFS_INVALID }, { "rc-5-sz", NULL, SYSFS_RC5_SZ }, { "jvc", "/jvc_decoder", SYSFS_JVC }, { "sony", "/sony_decoder",SYSFS_SONY }, @@ -132,9 +130,7 @@ const struct protocol_map_entry protocol_map[] = { { "nec", "/nec_decoder", SYSFS_NEC }, { "sanyo", NULL, SYSFS_SANYO }, { "mce_kbd", NULL, SYSFS_MCE_KBD }, - { "mce-kbd", NULL, SYSFS_MCE_KBD }, { "rc-6", "/rc6_decoder", SYSFS_RC6 }, - { "rc6", NULL, SYSFS_RC6 }, { "rc-6-0", NULL, SYSFS_INVALID }, { "rc-6-6a-20", NULL, SYSFS_INVALID }, { "rc-6-6a-24", NULL, SYSFS_INVALID }, @@ -145,6 +141,21 @@ const struct protocol_map_entry protocol_map[] = { { NULL, NULL, SYSFS_INVALID }, }; +static bool protocol_like(const char *a, const char *b) +{ + while (*a && *b) { + if (*a == '-' || *a == '_') + a++; + if (*b == '-' || *b == '_') + b++; + if (tolower(*a) != tolower(*b)) + return false; + a++; b++; + } + + return !*a && !*b; +} + static enum sysfs_protocols parse_sysfs_protocol(const char *name, bool all_allowed) { const struct protocol_map_entry *pme; @@ -156,7 +167,7 @@ static enum sysfs_protocols parse_sysfs_protocol(const char *name, bool all_allo return ~0; for (pme = protocol_map; pme->name; pme++) { - if (!strcasecmp(name, pme->name)) + if (protocol_like(name, pme->name)) return pme->sysfs_protocol; } _______________________________________________ linuxtv-commits mailing list [email protected] https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
