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: keytable: "-p all" should not attempt BPF decodes that don't exist
Author:  Sean Young <s...@mess.org>
Date:    Fri May 8 10:44:59 2020 +0100

Currently we only have a BPF decoder for xbox_dvd. Other decoders
should not be attempted.

Reported-by: Ralf Schmidt <r...@gmx.de>
Signed-off-by: Sean Young <s...@mess.org>

 utils/keytable/keytable.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=dea6d59b4719eb247aaad1ec386c39197ddb3f61
diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index 6cb0217a9a73..a97530063fe6 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -940,12 +940,21 @@ static struct sysfs_names *find_device(char *name)
        return names;
 }
 
+/*
+ * If an rcdev does not have a decoder for a protocol, try to load a bpf
+ * replacement.
+ */
 static enum sysfs_protocols load_bpf_for_unsupported(enum sysfs_protocols 
protocols, enum sysfs_protocols supported)
 {
        const struct protocol_map_entry *pme;
        struct bpf_protocol *b;
 
        for (pme = protocol_map; pme->name; pme++) {
+               // So far, we only have a replacement for the xbox_dvd
+               // protocol
+               if (pme->sysfs_protocol != SYSFS_XBOX_DVD)
+                       continue;
+
                if (!(protocols & pme->sysfs_protocol) ||
                    (supported & pme->sysfs_protocol))
                        continue;
@@ -1151,7 +1160,7 @@ static int v2_set_protocols(struct rc_device *rc_dev)
 
        if (!stat(name, &st) && !(st.st_mode & 0222)) {
                fprintf(stderr, _("Protocols for device can not be changed\n"));
-               return 0;
+               return EINVAL;
        }
 
        fp = fopen(name, "w");
@@ -1318,8 +1327,7 @@ static int set_proto(struct rc_device *rc_dev)
        int rc = 0;
 
        if (rc_dev->version == VERSION_2) {
-               rc = v2_set_protocols(rc_dev);
-               return rc;
+               return v2_set_protocols(rc_dev);
        }
 
        rc_dev->current &= rc_dev->supported;
@@ -2102,9 +2110,7 @@ int main(int argc, char *argv[])
 
                rc_dev.current = load_bpf_for_unsupported(ch_proto, 
rc_dev.supported);
 
-               if (set_proto(&rc_dev))
-                       fprintf(stderr, _("Couldn't change the IR 
protocols\n"));
-               else {
+               if (!set_proto(&rc_dev)) {
                        fprintf(stderr, _("Protocols changed to "));
                        write_sysfs_protocols(rc_dev.current, stderr, "%s ");
                        fprintf(stderr, "\n");

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to