On Tue, Feb 09, 2021 at 08:28:05AM +0100, Marcus Glocker wrote:

> On Mon, Feb 08, 2021 at 05:03:34PM +0100, Rafael Sadowski wrote:
> 
> > On Mon Feb 08, 2021 at 12:32:54PM +0100, Marcus Glocker wrote:
> > > On Mon, Feb 08, 2021 at 07:20:21AM +0100, Rafael Sadowski wrote:
> > > 
> > > > Since a few days aka. snapshots I see the following error message after
> > > > boot:
> > > > 
> > > > uhidev_clear_iface_eps: clear endpoints failed!
> > > > uhidev_clear_iface_eps: clear endpoints failed!
> > > > uhidev_clear_iface_eps: clear endpoints failed!
> > > > 
> > > > I have a "TESmart 4 Port HDMI KVM Switch 4K@60Hz 4:4:4 Ultra HD" which
> > > > also support switching USB for keyboard and mouse between different
> > > > devices. When I switch it off and on again I see this:
> > > > 
> > > > wsmouse0 detached
> > > > ums0 detached
> > > > uhid0 detached
> > > > uhidev0 detached
> > > > wskbd1: disconnecting from wsdisplay0
> > > > wskbd1 detached
> > > > ukbd0 detached
> > > > uhidev1 detached
> > > > wsmouse1 detached
> > > > ums1 detached
> > > > uhidev2 detached
> > > > uhub2 detached
> > > > uhub2 at uhub0 port 6 configuration 1 interface 0 "Terminus Technology 
> > > > USB 2.0 Hub" rev 2.00/1.11 addr 2
> > > > uhidev0 at uhub2 port 2 configuration 1 interface 0 
> > > > "??\^D??\^A?????????\^A????\^A?6??\^E?? " rev 2.00/0.01 addr 3
> > > > uhidev0: iclass 3/1
> > > > ukbd0 at uhidev0: 8 variable keys, 6 key codes
> > > > wskbd1 at ukbd0 mux 1
> > > > uhidev_clear_iface_eps: clear endpoints failed!
> > > > wskbd1: connecting to wsdisplay0
> > > > uhidev1 at uhub2 port 2 configuration 1 interface 1 
> > > > "??\^D??\^A?????????\^A????\^A?6??\^E?? " rev 2.00/0.01 addr 3
> > > > uhidev1: iclass 3/1, 1 report id
> > > > ums0 at uhidev1 reportid 1: 3 buttons, Z dir
> > > > wsmouse0 at ums0uhidev_clear_iface_eps: clear endpoints failed!
> > > >  mux 0
> > > > uhidev2 at uhub2 port 1 configuration 1 interface 0 "MOSART Semi. 2.4G 
> > > > Wireless Mouse" rev 1.10/81.13 addr 4
> > > > uhidev2: iclass 3/1, 5 report ids
> > > > ums1 at uhidev2 reportid 3: 5 buttons, Z and W dir
> > > > wsmouse1 at ums1 mux 0
> > > > uhid0 at uhidev2 reportid 5: input=5, output=6, feature=0
> > > > 
> > > > My mouse works after connecting but my keyboard is completely dead. (KVM
> > > > ist fine other devices work properly=) I would be happy if I could test
> > > > a diff.
> > > 
> > > Can you please send me an lsusb -v of your failing keyboard?
> > > 
> > 
> > Bus 000 Device 001: ID 8086:0000 Intel Corp. 
> > Bus 000 Device 002: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
> > Bus 000 Device 003: ID 062a:4102 Creative Labs 
> > Bus 000 Device 004: ID 0c45:7403 Microdia Foot Switch
> > Bus 001 Device 001: ID 8086:0000 Intel Corp. 
> > 
> > 
> > Bus 000 Device 002: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
> > Device Descriptor:
> >   bLength                18
> >   bDescriptorType         1
> >   bcdUSB               2.00
> >   bDeviceClass            9 Hub
> >   bDeviceSubClass         0 Unused
> >   bDeviceProtocol         1 Single TT
> >   bMaxPacketSize0        64
> >   idVendor           0x1a40 Terminus Technology Inc.
> >   idProduct          0x0101 4-Port HUB
> >   bcdDevice            1.11
> >   iManufacturer           0 
> >   iProduct                1 USB 2.0 Hub
> >   iSerial                 0 
> >   bNumConfigurations      1
> >   Configuration Descriptor:
> >     bLength                 9
> >     bDescriptorType         2
> >     wTotalLength           25
> >     bNumInterfaces          1
> >     bConfigurationValue     1
> >     iConfiguration          0 
> >     bmAttributes         0xe0
> >       Self Powered
> >       Remote Wakeup
> >     MaxPower              100mA
> >     Interface Descriptor:
> >       bLength                 9
> >       bDescriptorType         4
> >       bInterfaceNumber        0
> >       bAlternateSetting       0
> >       bNumEndpoints           1
> >       bInterfaceClass         9 Hub
> >       bInterfaceSubClass      0 Unused
> >       bInterfaceProtocol      0 Full speed (or root) hub
> >       iInterface              0 
> >       Endpoint Descriptor:
> >         bLength                 7
> >         bDescriptorType         5
> >         bEndpointAddress     0x81  EP 1 IN
> >         bmAttributes            3
> >           Transfer Type            Interrupt
> >           Synch Type               None
> >           Usage Type               Data
> >         wMaxPacketSize     0x0001  1x 1 bytes
> >         bInterval              12
> > Hub Descriptor:
> >   bLength               9
> >   bDescriptorType      41
> >   nNbrPorts             4
> >   wHubCharacteristic 0x0000
> >     Ganged power switching
> >     Ganged overcurrent protection
> >     TT think time 8 FS bits
> >   bPwrOn2PwrGood       50 * 2 milli seconds
> >   bHubContrCurrent    100 milli Ampere
> >   DeviceRemovable    0x00
> >   PortPwrCtrlMask    0xff
> >  Hub Port Status:
> >    Port 1: 0000.0103 power enable connect
> >    Port 2: 0000.0103 power enable connect
> >    Port 3: 0000.0100 power
> >    Port 4: 0000.0100 power
> > Device Qualifier (for other device speed):
> >   bLength                10
> >   bDescriptorType         6
> >   bcdUSB               2.00
> >   bDeviceClass            9 Hub
> >   bDeviceSubClass         0 Unused
> >   bDeviceProtocol         0 Full speed (or root) hub
> >   bMaxPacketSize0        64
> >   bNumConfigurations      1
> > Device Status:     0x0001
> >   Self Powered
> > 
> > > Furthermore, does the keyboard initially work after boot, and only
> > > fails after your KVM Switch restart, or does the keyboard fail
> > > straight away after boot?
> > 
> > Yes the keyboard initially work after a fresh boot and only fails after my
> > KVM Switch restart. When it fails a reboot helps.
> 
> Hmm, I can't see anything obvious.  Though it seems like your mouse
> and keyboard are hidden between the KVM Switch.  When you attach
> the mouse and keyboard directly to that machine, do you still get
> the uhidev_clear_iface_eps() error?

Also can you please run this debug diff and send me the results?


Index: uhidev.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uhidev.c,v
retrieving revision 1.86
diff -u -p -u -p -r1.86 uhidev.c
--- uhidev.c    4 Feb 2021 16:18:34 -0000       1.86
+++ uhidev.c    9 Feb 2021 12:56:45 -0000
@@ -974,30 +974,38 @@ uhidev_clear_iface_eps(struct uhidev_sof
        uint8_t xfertype;
        int i;
 
+       printf("%s: ENTER\n", __func__);
+
        /* Only clear interface endpoints when none are in use. */
-       if (sc->sc_ipipe || sc->sc_opipe)
+       if (sc->sc_ipipe || sc->sc_opipe) {
+               printf("%s: out0\n", __func__);
                return;
-       DPRINTFN(1,("%s: clear interface eps\n", __func__));
+       }
 
        id = usbd_get_interface_descriptor(iface);
-       if (id == NULL)
-               goto bad;
+       if (id == NULL) {
+               printf("%s: out1\n", __func__);
+               return;
+       }
 
        for (i = 0; i < id->bNumEndpoints; i++) {
                ed = usbd_interface2endpoint_descriptor(iface, i);
-               if (ed == NULL)
-                       goto bad;
+               if (ed == NULL) {
+                       printf("%s: out2\n", __func__);
+                       return;
+               }
 
                xfertype = UE_GET_XFERTYPE(ed->bmAttributes);
                if (xfertype == UE_BULK || xfertype == UE_INTERRUPT) {
                        if (usbd_clear_endpoint_feature(sc->sc_udev,
-                           ed->bEndpointAddress, UF_ENDPOINT_HALT))
-                               goto bad;
+                           ed->bEndpointAddress, UF_ENDPOINT_HALT)) {
+                               printf("%s: clear EP failed on EP=0x%02x\n",
+                                   __func__, ed->bEndpointAddress);
+                       }
                }
        }
-       return;
-bad:
-       printf("%s: clear endpoints failed!\n", __func__);
+
+       printf("%s: EXIT\n", __func__);
 }
 
 int

Reply via email to