hidraw(4): Force switch to hidraw mode on HIDIOCGRDESC ioctl

To match documentation.

Reported by:	Ihor Dutchak <ihor.youw@gmail.com>
PR:		286155
MFC after:	3 days
This commit is contained in:
Vladimir Kondratyev 2025-04-27 12:07:35 +03:00
parent 8d4d08d571
commit fe4bdd889b

View file

@ -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) {