From fe4bdd889b5d722faa3a66e2c7d9a248e527cdb2 Mon Sep 17 00:00:00 2001 From: Vladimir Kondratyev Date: Sun, 27 Apr 2025 12:07:35 +0300 Subject: [PATCH] hidraw(4): Force switch to hidraw mode on HIDIOCGRDESC ioctl To match documentation. Reported by: Ihor Dutchak PR: 286155 MFC after: 3 days --- sys/dev/hid/hidraw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/hid/hidraw.c b/sys/dev/hid/hidraw.c index c9d29b836d4..9b6f83d34d0 100644 --- a/sys/dev/hid/hidraw.c +++ b/sys/dev/hid/hidraw.c @@ -829,6 +829,9 @@ hidraw_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, */ if (size >= HID_MAX_DESCRIPTOR_SIZE) return (EINVAL); + mtx_lock(&sc->sc_mtx); + sc->sc_state.uhid = false; + mtx_unlock(&sc->sc_mtx); buf = HIDRAW_LOCAL_ALLOC(local_buf, size); error = hid_get_rdesc(sc->sc_dev, buf, size); if (error == 0) {