summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2013-06-26 07:53:21 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2013-06-26 07:53:21 +0000
commitba5297806bfc5c1dd82da4938c5758e67f90dceb (patch)
treed8ac0c92f7dff4656bb08cf6f0ca9f97c8af8029 /sys/dev/usb
parent8ad81dcd3592bd62acd083d26ce68bc77ecad8e8 (diff)
Flash the LEDs only if the output report size is non null.
This prevent some Logitech Mice, at least G500 and G9x, that contain various HID devices including a keyboard without LEDs to keep disconnecting right after being attached. Problem reported by abieber@ and Damien Couderc, ok miod@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/ukbd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c
index d800cb5a08e..924a9d32b49 100644
--- a/sys/dev/usb/ukbd.c
+++ b/sys/dev/usb/ukbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ukbd.c,v 1.59 2013/04/15 09:23:02 mglocker Exp $ */
+/* $OpenBSD: ukbd.c,v 1.60 2013/06/26 07:53:20 mpi Exp $ */
/* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -126,6 +126,8 @@ const kbd_t ukbd_countrylayout[1 + HCC_MAX] = {
struct ukbd_softc {
struct uhidev sc_hdev;
+#define sc_ledsize sc_hdev.sc_osize
+
struct hidkbd sc_kbd;
int sc_spl;
@@ -373,7 +375,7 @@ ukbd_set_leds(void *v, int leds)
if (sc->sc_dying)
return;
- if (hidkbd_set_leds(kbd, leds, &res) != 0)
+ if (sc->sc_ledsize && hidkbd_set_leds(kbd, leds, &res) != 0)
uhidev_set_report_async(&sc->sc_hdev, UHID_OUTPUT_REPORT,
&res, 1);
}