aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Nygard Dodd <Matthew.Nygard.Dodd@gmail.com>2024-11-18 04:25:10 +0000
committerVladimir Kondratyev <wulf@FreeBSD.org>2024-12-22 03:49:07 +0000
commitca6cd0e57cca4a39a2947c35b9e5f0ef11979fb5 (patch)
tree520ea9fcc6fc70f757c302381318fcbb0a280101
parent05abe2c9076e35c353c755702e6cf4a6ea59eab7 (diff)
hidraw(4): update hgd_actlen in HIDRAW_GET_REPORT ioctl
HIDRAW_GET_REPORT ioctl is documented to update hgd_actlen on return with the number of bytes copied. It does not do this. Reviewed by: wulf PR: 282790 MFC after: 1 week (cherry picked from commit f4f46a2eef3be6d19c65a4ca4ee70f365dd5be4f)
-rw-r--r--sys/dev/hid/hidraw.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/dev/hid/hidraw.c b/sys/dev/hid/hidraw.c
index 703e16d8bf8f..bd5f99bd4eba 100644
--- a/sys/dev/hid/hidraw.c
+++ b/sys/dev/hid/hidraw.c
@@ -570,6 +570,7 @@ hidraw_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
struct hidraw_devinfo *hd;
const char *devname;
uint32_t size;
+ hid_size_t actsize;
int id, len;
int error = 0;
@@ -748,16 +749,16 @@ hidraw_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
}
size = MIN(hgd->hgd_maxlen, size);
buf = HIDRAW_LOCAL_ALLOC(local_buf, size);
- error = hid_get_report(sc->sc_dev, buf, size, NULL,
+ actsize = 0;
+ error = hid_get_report(sc->sc_dev, buf, size, &actsize,
hgd->hgd_report_type, id);
if (!error)
- error = copyout(buf, hgd->hgd_data, size);
+ error = copyout(buf, hgd->hgd_data, actsize);
HIDRAW_LOCAL_FREE(local_buf, buf);
+ hgd->hgd_actlen = actsize;
#ifdef COMPAT_FREEBSD32
- /*
- * HIDRAW_GET_REPORT is declared _IOWR, but hgd is not written
- * so we don't call update_hgd32().
- */
+ if (hgd32 != NULL)
+ update_hgd32(hgd, hgd32);
#endif
return (error);