summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/upd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/usb/upd.c b/sys/dev/usb/upd.c
index cc6a3adf13e..e63cc462117 100644
--- a/sys/dev/usb/upd.c
+++ b/sys/dev/usb/upd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: upd.c,v 1.11 2014/12/11 18:39:27 mpi Exp $ */
+/* $OpenBSD: upd.c,v 1.12 2014/12/11 18:50:32 mpi Exp $ */
/*
* Copyright (c) 2014 Andre de Oliveira <andre@openbsd.org>
@@ -274,11 +274,15 @@ upd_refresh(void *arg)
actlen = uhidev_get_report(sc->sc_hdev.sc_parent,
UHID_FEATURE_REPORT, repid, buf, report->size);
- if (actlen != report->size) {
+ if (actlen == -1) {
DPRINTF(("upd: failed to get report id=%02x\n", repid));
continue;
}
+ /* Deal with buggy firmwares. */
+ if (actlen < report->size)
+ report->size = actlen;
+
upd_update_sensors(sc, buf, report->size, repid);
}
}