git: 8d4d08d571c6 - main - hidraw(4): Return actual length of read data from HIDIOCG* ioctls
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 27 Apr 2025 09:09:06 UTC
The branch main has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=8d4d08d571c64d8f040c2cd1d8f98844251a2238
commit 8d4d08d571c64d8f040c2cd1d8f98844251a2238
Author: Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2025-04-27 09:07:35 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2025-04-27 09:07:35 +0000
hidraw(4): Return actual length of read data from HIDIOCG* ioctls
To match Linux.
MFC after: 3 days
---
sys/dev/hid/hidraw.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/sys/dev/hid/hidraw.c b/sys/dev/hid/hidraw.c
index f573b3db1391..c9d29b836d43 100644
--- a/sys/dev/hid/hidraw.c
+++ b/sys/dev/hid/hidraw.c
@@ -915,8 +915,14 @@ hidraw_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
default:
panic("Invalid report type");
}
- return (hid_get_report(sc->sc_dev, addr, len, NULL,
- reptype, id));
+ error = hid_get_report(sc->sc_dev, addr, len, &actsize,
+ reptype, id);
+ if (error == 0) {
+ if (id == 0)
+ actsize++;
+ td->td_retval[0] = actsize;
+ }
+ return (error);
case HIDIOCGRAWUNIQ(0):
strlcpy(addr, sc->sc_hw->serial, len);