FreeBSD Bugzilla – Attachment 255207 Details for
Bug 282790
hidraw(4) - Regression in documented behavior of HIDRAW_GET_REPORT.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to hidraw.c correcting the defect.
hidraw.patch (text/plain), 2.41 KB, created by
Matthew.Nygard.Dodd
on 2024-11-15 23:01:07 UTC
(
hide
)
Description:
Patch to hidraw.c correcting the defect.
Filename:
MIME Type:
Creator:
Matthew.Nygard.Dodd
Created:
2024-11-15 23:01:07 UTC
Size:
2.41 KB
patch
obsolete
>diff --git a/sys/dev/hid/hidraw.c b/sys/dev/hid/hidraw.c >index 6a05b633cfc8..08f6da9b1958 100644 >--- a/sys/dev/hid/hidraw.c >+++ b/sys/dev/hid/hidraw.c >@@ -715,85 +715,84 @@ hidraw_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, > sc->sc_state.immed = true; > mtx_unlock(&sc->sc_mtx); > } else { > mtx_lock(&sc->sc_mtx); > sc->sc_state.immed = false; > mtx_unlock(&sc->sc_mtx); > } > return (0); > > case HIDRAW_GET_REPORT: > if (!(sc->sc_fflags & FREAD)) > return (EPERM); > switch (hgd->hgd_report_type) { > case HID_INPUT_REPORT: > size = sc->sc_rdesc->isize; > id = sc->sc_rdesc->iid; > break; > case HID_OUTPUT_REPORT: > size = sc->sc_rdesc->osize; > id = sc->sc_rdesc->oid; > break; > case HID_FEATURE_REPORT: > size = sc->sc_rdesc->fsize; > id = sc->sc_rdesc->fid; > break; > default: > return (EINVAL); > } > if (id != 0) { > error = copyin(hgd->hgd_data, &id, 1); > if (error != 0) > return (error); > } > size = MIN(hgd->hgd_maxlen, size); > buf = HIDRAW_LOCAL_ALLOC(local_buf, size); > error = hid_get_report(sc->sc_dev, buf, size, NULL, > hgd->hgd_report_type, id); > if (!error) > error = copyout(buf, hgd->hgd_data, size); > HIDRAW_LOCAL_FREE(local_buf, buf); >+ hgd->hgd_actlen = size; > #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); > > case HIDRAW_SET_REPORT: > if (!(sc->sc_fflags & FWRITE)) > return (EPERM); > switch (hgd->hgd_report_type) { > case HID_INPUT_REPORT: > size = sc->sc_rdesc->isize; > id = sc->sc_rdesc->iid; > break; > case HID_OUTPUT_REPORT: > size = sc->sc_rdesc->osize; > id = sc->sc_rdesc->oid; > break; > case HID_FEATURE_REPORT: > size = sc->sc_rdesc->fsize; > id = sc->sc_rdesc->fid; > break; > default: > return (EINVAL); > } > size = MIN(hgd->hgd_maxlen, size); > buf = HIDRAW_LOCAL_ALLOC(local_buf, size); > error = copyin(hgd->hgd_data, buf, size); > if (error == 0) { > if (id != 0) > id = *(uint8_t *)buf; > error = hid_set_report(sc->sc_dev, buf, size, > hgd->hgd_report_type, id); > } > HIDRAW_LOCAL_FREE(local_buf, buf); > return (error); > > case HIDRAW_GET_REPORT_ID: > *(int *)addr = 0; /* XXX: we only support reportid 0? */ > return (0); > > case HIDRAW_GET_DEVICEINFO: > hdi = (struct hidraw_device_info *)addr;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 282790
:
255207
|
255223
|
255239