The branch stable/13 has been updated by wulf:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1a918f430d0d82fd25eebccb4b47f13d6f9715e3

commit 1a918f430d0d82fd25eebccb4b47f13d6f9715e3
Author:     Vladimir Kondratyev <[email protected]>
AuthorDate: 2021-09-02 19:31:51 +0000
Commit:     Vladimir Kondratyev <[email protected]>
CommitDate: 2021-09-21 23:40:18 +0000

    hidmap: Implement forbidden flag for hidmap item.
    
    If HID usage is mapped to evdev event by hidmap item marked with this
    flag than entire driver attachment is blocked.
    
    (cherry picked from commit cded1fdb3763ba1f0f3663e605a5e63089dc8e22)
---
 sys/dev/hid/hidmap.c | 5 ++++-
 sys/dev/hid/hidmap.h | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys/dev/hid/hidmap.c b/sys/dev/hid/hidmap.c
index 46e789fa7cec..c46930214323 100644
--- a/sys/dev/hid/hidmap.c
+++ b/sys/dev/hid/hidmap.c
@@ -481,7 +481,10 @@ hidmap_probe_hid_descr(void *d_ptr, hid_size_t d_len, 
uint8_t tlc_index,
        /* Check that all mandatory usages are present in report descriptor */
        if (items != 0) {
                for (i = 0; i < nitems_map; i++) {
-                       if (map[i].required && isclr(caps, i)) {
+                       KASSERT(!(map[i].required && map[i].forbidden),
+                           ("both required & forbidden item flags are set"));
+                       if ((map[i].required && isclr(caps, i)) ||
+                           (map[i].forbidden && isset(caps, i))) {
                                items = 0;
                                break;
                        }
diff --git a/sys/dev/hid/hidmap.h b/sys/dev/hid/hidmap.h
index 6ac23b3dc4ee..f5ce10069e1a 100644
--- a/sys/dev/hid/hidmap.h
+++ b/sys/dev/hid/hidmap.h
@@ -98,7 +98,8 @@ struct hidmap_item {
        bool                    has_cb:1;
        bool                    final_cb:1;
        bool                    invert_value:1;
-       u_int                   reserved:10;
+       bool                    forbidden:1;    /* Forbidden by driver */
+       u_int                   reserved:9;
 };
 
 #define        HIDMAP_ANY(_page, _usage, _type, _code)                         
\
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to