summaryrefslogtreecommitdiff
path: root/sys/dev/usb/uhidev.c
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@cvs.openbsd.org>2021-11-11 07:04:46 +0000
committerAnton Lindqvist <anton@cvs.openbsd.org>2021-11-11 07:04:46 +0000
commitd2d4b581940a96e3816bfced32ea21d9a49798d8 (patch)
treeafe3b8a486678dfca2e9e91e53aa73def8908e4b /sys/dev/usb/uhidev.c
parent28e13cda2467d55cb5860c82c6eba49ac4ef365c (diff)
Here we go again, revert the second attempt to resolve the
UHIDEV_CLAIM_MULTIPLE_REPORTID conflict. Breaks fido(4) as reported by gnezdo@
Diffstat (limited to 'sys/dev/usb/uhidev.c')
-rw-r--r--sys/dev/usb/uhidev.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c
index 59e8949abd5..3ce1684893b 100644
--- a/sys/dev/usb/uhidev.c
+++ b/sys/dev/usb/uhidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhidev.c,v 1.98 2021/11/10 06:33:30 anton Exp $ */
+/* $OpenBSD: uhidev.c,v 1.99 2021/11/11 07:04:45 anton Exp $ */
/* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -246,37 +246,30 @@ uhidev_attach(struct device *parent, struct device *self, void *aux)
sc->sc_isize += (nrepid != 1); /* one byte for the report ID */
DPRINTF(("uhidev_attach: isize=%d\n", sc->sc_isize));
- memset(&uha, 0, sizeof(uha));
uha.uaa = uaa;
uha.parent = sc;
+ uha.reportid = UHIDEV_CLAIM_MULTIPLE_REPORTID;
+ uha.nreports = nrepid;
+ uha.claimed = malloc(nrepid, M_TEMP, M_WAITOK|M_ZERO);
/* Look for a driver claiming multiple report IDs first. */
- if (nrepid > 1) {
- uha.reportid = UHIDEV_CLAIM_MULTIPLE_REPORTID;
- uha.nreports = nrepid;
- uha.claimed = malloc(nrepid, M_TEMP, M_WAITOK|M_ZERO);
-
- dev = config_found_sm(self, &uha, NULL, NULL);
- if (dev != NULL) {
- for (repid = 0; repid < nrepid; repid++) {
- /*
- * Could already be assigned by
- * uhidev_set_report_dev().
- */
- if (sc->sc_subdevs[repid] != NULL)
- continue;
-
- if (!uha.claimed[repid])
- continue;
+ dev = config_found_sm(self, &uha, NULL, NULL);
+ if (dev != NULL) {
+ for (repid = 0; repid < nrepid; repid++) {
+ /*
+ * Could already be assigned by uhidev_set_report_dev().
+ */
+ if (sc->sc_subdevs[repid] != NULL)
+ continue;
+
+ if (uha.claimed[repid])
sc->sc_subdevs[repid] = (struct uhidev *)dev;
- }
}
-
- free(uha.claimed, M_TEMP, nrepid);
- uha.nreports = 0;
- uha.claimed = NULL;
}
+ free(uha.claimed, M_TEMP, nrepid);
+ uha.claimed = NULL;
+
for (repid = 0; repid < nrepid; repid++) {
DPRINTF(("%s: try repid=%d\n", __func__, repid));
if (hid_report_size(desc, size, hid_input, repid) == 0 &&