Wed Feb 16 14:36:12 2022 UTC ()
Pull up following revision(s) (requested by jakllsch in ticket #1428):

	sys/dev/usb/uhidev.c: revision 1.82

Do not explicitly set the HID Report Protocol upon attach, some devices
don't like it and should be in Report Protocol after enumeration/reset
anyway.

May address PR kern/55019.


(martin)
diff -r1.75.2.1 -r1.75.2.2 src/sys/dev/usb/uhidev.c

cvs diff -r1.75.2.1 -r1.75.2.2 src/sys/dev/usb/uhidev.c (expand / switch to unified diff)

--- src/sys/dev/usb/uhidev.c 2021/02/04 19:16:01 1.75.2.1
+++ src/sys/dev/usb/uhidev.c 2022/02/16 14:36:12 1.75.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uhidev.c,v 1.75.2.1 2021/02/04 19:16:01 martin Exp $ */ 1/* $NetBSD: uhidev.c,v 1.75.2.2 2022/02/16 14:36:12 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc. 4 * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Lennart Augustsson (lennart@augustsson.net) at 8 * by Lennart Augustsson (lennart@augustsson.net) at
9 * Carlstedt Research & Technology and Matthew R. Green (mrg@eterna.com.au). 9 * Carlstedt Research & Technology and Matthew R. Green (mrg@eterna.com.au).
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE. 30 * POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33/* 33/*
34 * HID spec: http://www.usb.org/developers/devclass_docs/HID1_11.pdf 34 * HID spec: http://www.usb.org/developers/devclass_docs/HID1_11.pdf
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.75.2.1 2021/02/04 19:16:01 martin Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.75.2.2 2022/02/16 14:36:12 martin Exp $");
39 39
40#ifdef _KERNEL_OPT 40#ifdef _KERNEL_OPT
41#include "opt_usb.h" 41#include "opt_usb.h"
42#endif 42#endif
43 43
44#include <sys/param.h> 44#include <sys/param.h>
45#include <sys/types.h> 45#include <sys/types.h>
46 46
47#include <sys/conf.h> 47#include <sys/conf.h>
48#include <sys/device.h> 48#include <sys/device.h>
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/kernel.h> 50#include <sys/kernel.h>
51#include <sys/kmem.h> 51#include <sys/kmem.h>
@@ -159,28 +159,36 @@ uhidev_attach(device_t parent, device_t  @@ -159,28 +159,36 @@ uhidev_attach(device_t parent, device_t
159 aprint_error_dev(self, "couldn't establish power handler\n"); 159 aprint_error_dev(self, "couldn't establish power handler\n");
160 160
161 if (uiaa->uiaa_vendor == USB_VENDOR_WACOM) { 161 if (uiaa->uiaa_vendor == USB_VENDOR_WACOM) {
162 if (uiaa->uiaa_product == USB_PRODUCT_WACOM_XD0912U) { 162 if (uiaa->uiaa_product == USB_PRODUCT_WACOM_XD0912U) {
163 /* 163 /*
164 * Wacom Intuos2 (XD-0912-U) requires longer idle time to 164 * Wacom Intuos2 (XD-0912-U) requires longer idle time to
165 * initialize the device with 0x0202. 165 * initialize the device with 0x0202.
166 */ 166 */
167 DELAY(500000); 167 DELAY(500000);
168 } 168 }
169 } 169 }
170 (void)usbd_set_idle(iface, 0, 0); 170 (void)usbd_set_idle(iface, 0, 0);
171 171
172 if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0) 172#if 0
 173 /*
 174 * HID 1.11 says we should do this, but the device firmware is
 175 * supposed to come up in Report Protocol after reset anyway, and
 176 * apparently explicitly requesting it confuses some devices.
 177 */
 178 if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0 &&
 179 id->bInterfaceSubClass == UISUBCLASS_BOOT)
173 (void)usbd_set_protocol(iface, 1); 180 (void)usbd_set_protocol(iface, 1);
 181#endif
174 182
175 maxinpktsize = 0; 183 maxinpktsize = 0;
176 sc->sc_iep_addr = sc->sc_oep_addr = -1; 184 sc->sc_iep_addr = sc->sc_oep_addr = -1;
177 for (i = 0; i < id->bNumEndpoints; i++) { 185 for (i = 0; i < id->bNumEndpoints; i++) {
178 ed = usbd_interface2endpoint_descriptor(iface, i); 186 ed = usbd_interface2endpoint_descriptor(iface, i);
179 if (ed == NULL) { 187 if (ed == NULL) {
180 aprint_error_dev(self, 188 aprint_error_dev(self,
181 "could not read endpoint descriptor\n"); 189 "could not read endpoint descriptor\n");
182 sc->sc_dying = 1; 190 sc->sc_dying = 1;
183 return; 191 return;
184 } 192 }
185 193
186 DPRINTFN(10,("uhidev_attach: bLength=%d bDescriptorType=%d " 194 DPRINTFN(10,("uhidev_attach: bLength=%d bDescriptorType=%d "