Date: Tue, 21 Sep 2021 23:43:46 GMT From: Vladimir Kondratyev <wulf@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 29bcf5e7d7a7 - stable/13 - hidbus(4): Add routine to check presence of collection of given usage Message-ID: <202109212343.18LNhkXs048067@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=29bcf5e7d7a7eb15a692ec1fa2a0e3a3290a4c8e commit 29bcf5e7d7a7eb15a692ec1fa2a0e3a3290a4c8e Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2021-09-02 19:32:57 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2021-09-21 23:40:53 +0000 hidbus(4): Add routine to check presence of collection of given usage (cherry picked from commit d51e437669e4ac35ac4be366241ae6ba4a16c378) --- sys/dev/hid/hidbus.c | 19 +++++++++++++++++++ sys/dev/hid/hidbus.h | 1 + 2 files changed, 20 insertions(+) diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c index 3064f9999f2f..0de0a9bc1114 100644 --- a/sys/dev/hid/hidbus.c +++ b/sys/dev/hid/hidbus.c @@ -171,6 +171,25 @@ hidbus_locate(const void *desc, hid_size_t size, int32_t u, enum hid_kind k, return (0); } +bool +hidbus_is_collection(const void *desc, hid_size_t size, int32_t usage, + uint8_t tlc_index) +{ + struct hid_data *d; + struct hid_item h; + bool ret = false; + + d = hid_start_parse(desc, size, 0); + HIDBUS_FOREACH_ITEM(d, &h, tlc_index) { + if (h.kind == hid_collection && h.usage == usage) { + ret = true; + break; + } + } + hid_end_parse(d); + return (ret); +} + static device_t hidbus_add_child(device_t dev, u_int order, const char *name, int unit) { diff --git a/sys/dev/hid/hidbus.h b/sys/dev/hid/hidbus.h index 05911fff5732..d4324a2dc394 100644 --- a/sys/dev/hid/hidbus.h +++ b/sys/dev/hid/hidbus.h @@ -152,6 +152,7 @@ int hidbus_locate(const void *desc, hid_size_t size, int32_t u, enum hid_kind k, uint8_t tlc_index, uint8_t index, struct hid_location *loc, uint32_t *flags, uint8_t *id, struct hid_absinfo *ai); +bool hidbus_is_collection(const void *, hid_size_t, int32_t, uint8_t); const struct hid_device_id *hidbus_lookup_id(device_t, const struct hid_device_id *, int);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109212343.18LNhkXs048067>