diff options
author | Vladimir Kondratyev <wulf@FreeBSD.org> | 2021-09-02 19:31:51 +0000 |
---|---|---|
committer | Vladimir Kondratyev <wulf@FreeBSD.org> | 2021-09-02 19:35:27 +0000 |
commit | cded1fdb3763ba1f0f3663e605a5e63089dc8e22 (patch) | |
tree | fa7bf7e69917bc3e4d84feead2c851d9f4f7d3fc /sys/dev/hid | |
parent | 0075742d1834d52b5e24a606aca63ad7e67e81f3 (diff) | |
download | src-cded1fdb3763ba1f0f3663e605a5e63089dc8e22.tar.gz src-cded1fdb3763ba1f0f3663e605a5e63089dc8e22.zip |
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.
MFC after: 2 week
Diffstat (limited to 'sys/dev/hid')
-rw-r--r-- | sys/dev/hid/hidmap.c | 5 | ||||
-rw-r--r-- | 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) \ |