NetBSD Problem Report #50415

From itohy@netbsd.org  Mon Nov  9 02:05:05 2015
Return-Path: <itohy@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id AC317A5864
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  9 Nov 2015 02:05:05 +0000 (UTC)
Message-Id: <20151109020500.D8AE521C38@p655505.mie-ff01.ap.so-net.ne.jp>
Date: Mon,  9 Nov 2015 11:05:00 +0900 (JST)
From: itohy@netbsd.org
Reply-To: itohy@netbsd.org
To: gnats-bugs@gnats.NetBSD.org
Subject: UHID device detaches itself
X-Send-Pr-Version: 3.95

>Number:         50415
>Category:       kern
>Synopsis:       UHID device detaches itself
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 09 02:10:00 +0000 2015
>Originator:     ITOH Yasufumi
>Release:        NetBSD 5.1_RC4
>Organization:
>Environment:
System: NetBSD prom.my.domain 7.0 NetBSD 7.0 (PROM) #2: Fri Oct 9 01:28:55 JST 2015 itohy@prom.my.domain:/w/7/src/sys/arch/amd64/compile/PROM amd64
Architecture: x86_64
Machine: amd64

System: NetBSD mei.my.domain 5.1_RC4 NetBSD 5.1_RC4 (MEI) #20: Thu Dec 5 21:05:24 JST 2013 itohy@mei.my.domain:/usr/src/sys/arch/i386/compile/MEI i386
Architecture: i386
Machine: i386

>Description:
	I have a USB HID device that doesn't work on NetBSD at all.
	I don't see any problems to use this device on Windows or Linux

	NetBSD 7 (amd64):
		Repeat attach and immediate detach forever.

	NetBSD 5 (i386):
		Device attaches, but it gets detached on the first operation.
		Sometimes it reattaches, sometimes doesn't.


	The HID device is implemented by a PIC microcontroller.
	USB HID device descriptors (aquired by usbhid-dump on Linux):

002:004:003:DESCRIPTOR         1444677020.510822
 06 00 FF 09 01 A1 01 19 01 29 40 15 00 26 FF 00
 75 08 95 40 81 00 19 01 29 40 91 00 C0

002:004:002:DESCRIPTOR         1444677020.511439
 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
 75 01 95 08 81 02 95 01 75 08 81 03 95 05 75 01
 05 08 19 01 29 05 91 02 95 01 75 03 91 03 95 06
 75 08 15 00 25 E7 05 07 19 00 29 E7 81 00 C0

002:004:001:DESCRIPTOR         1444677020.512201
 05 0C 09 01 A1 01 15 00 25 01 09 E9 09 EA 75 01
 95 02 81 06 09 E2 95 01 81 06 95 05 81 07 C0

002:004:000:DESCRIPTOR         1444677020.512713
 05 01 09 02 A1 01 09 01 A1 00 05 09 19 01 29 03
 15 00 25 01 95 03 75 01 81 02 95 01 75 05 81 01
 05 01 09 30 09 31 09 38 15 81 25 7F 75 08 95 03
 81 06 C0 C0


	Device descriptors (aquired by lsusb -v on Linux):

Bus 002 Device 004: ID 22ea:003a  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x22ea 
  idProduct          0x003a 
  bcdDevice            0.01
  iManufacturer           1 Bit Trade One, LTD. 
  iProduct                2 USB IR Remote controller Advance
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          123
    bNumInterfaces          4
    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         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      52
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      31
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0001  1x 1 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      63
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      29
          Report Descriptor: (length is 29)
            Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage Minimum, data= [ 0x01 ] 1
                            (null)
            Item(Local ): Usage Maximum, data= [ 0x40 ] 64
                            (null)
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x40 ] 64
            Item(Main  ): Input, data= [ 0x00 ] 0
                            Data Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage Minimum, data= [ 0x01 ] 1
                            (null)
            Item(Local ): Usage Maximum, data= [ 0x40 ] 64
                            (null)
            Item(Main  ): Output, data= [ 0x00 ] 0
                            Data Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)


	USB host controller
	on NetBSD 7 machine:

ehci0 at pci0 dev 26 function 0: vendor 0x8086 product 0x3b3c (rev. 0x05)
ehci0: interrupting at ioapic0 pin 16
ehci0: EHCI version 1.0
usb0 at ehci0: USB revision 2.0
uhub1 at usb1: vendor 0x8086 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub1: 3 ports with 3 removable, self powered
uhub2 at uhub1 port 1: vendor 0x8087 product 0x0020, class 9/0, rev 2.00/0.00, addr 2
uhub2: single transaction translator
uhub2: 8 ports with 8 removable, self powered
uhidev0 at uhub2 port 3 configuration 1 interface 0

	on NetBSD 5 machine:

uhci0 at pci0 dev 29 function 0: Intel 82801FB/FR USB UHCI Controller (rev. 0x04)
uhci0: interrupting at ioapic0 pin 23
usb0 at uhci0: USB revision 1.0
ehci0 at pci0 dev 29 function 7: Intel 82801FB/FR USB EHCI Controller (rev. 0x04)
ehci0: interrupting at ioapic0 pin 23
ehci0: EHCI version 1.0
ehci0: companion controller, 2 ports each: uhci0
uhub0 at usb0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhidev0 at uhub0 port 2 configuration 1 interface 0


>How-To-Repeat:
	NetBSD 7:
		Plug device.

uhidev0 at uhub2 port 3 configuration 1 interface 0
uhidev0: Bit Trade One, LTD. USB IR Remote controller Advance, rev 2.00/0.01, addr 4, iclass 3/1
ums0 at uhidev0: 3 buttons and Z dir
wsmouse1 at ums0 mux 0
uhidev1 at uhub2 port 3 configuration 1 interface 1
uhidev1: Bit Trade One, LTD. USB IR Remote controller Advance, rev 2.00/0.01, addr 4, iclass 3/1
uhid0 at uhidev1: input=1, output=0, feature=0
uhidev2 at uhub2 port 3 configuration 1 interface 2
uhidev2: Bit Trade One, LTD. USB IR Remote controller Advance, rev 2.00/0.01, addr 4, iclass 3/1
ukbd0 at uhidev2
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
uhidev3 at uhub2 port 3 configuration 1 interface 3
uhidev3: vendor 0x22ea product 0x003a, rev 2.00/0.01, addr 4, iclass 3/0
uhidev3: no report descriptor
wsmouse1: detached
ums0: detached
uhidev0: detached
uhidev0: at uhub2 port 3 (addr 4) disconnected
uhid0: detached
uhidev1: detached
uhidev1: at uhub2 port 3 (addr 4) disconnected
wskbd1: disconnecting from wsdisplay0
wskbd1: detached
ukbd0: detached
uhidev2: detached
uhidev2: at uhub2 port 3 (addr 4) disconnected
uhidev3: detached
uhidev3: at uhub2 port 3 (addr 4) disconnected
uhidev0 at uhub2 port 3 configuration 1 interface 0
uhidev0: Bit Trade One, LTD. USB IR Remote controller Advance, rev 2.00/0.01, addr 4, iclass 3/1
ums0 at uhidev0: 3 buttons and Z dir
wsmouse1 at ums0 mux 0
uhidev1 at uhub2 port 3 configuration 1 interface 1
uhidev1: Bit Trade One, LTD. USB IR Remote controller Advance, rev 2.00/0.01, addr 4, iclass 3/1
uhid0 at uhidev1: input=1, output=0, feature=0
uhidev2 at uhub2 port 3 configuration 1 interface 2
uhidev2: Bit Trade One, LTD. USB IR Remote controller Advance, rev 2.00/0.01, addr 4, iclass 3/1
ukbd0 at uhidev2
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
uhidev3 at uhub2 port 3 configuration 1 interface 3
uhidev3: vendor 0x22ea product 0x003a, rev 2.00/0.01, addr 4, iclass 3/0
uhidev3: no report descriptor
wsmouse1: detached
ums0: detached
uhidev0: detached
uhidev0: at uhub2 port 3 (addr 4) disconnected
uhid0: detached
uhidev1: detached
uhidev1: at uhub2 port 3 (addr 4) disconnected
wskbd1: disconnecting from wsdisplay0
wskbd1: detached
ukbd0: detached
uhidev2: detached
uhidev2: at uhub2 port 3 (addr 4) disconnected
uhidev3: detached
uhidev3: at uhub2 port 3 (addr 4) disconnected
... (repeat attach/detach forever)

	NetBSD 5:
		Plug device.
		usbhidctl -f /dev/uhid1 -a

uhidev0 at uhub0 port 2 configuration 1 interface 0
uhidev0: Bit Trade One, LTD. USB IR Remote controller Advance, rev 2.00/0.01, addr 2, iclass 3/1
ums0 at uhidev0: 3 buttons and Z dir
wsmouse1 at ums0 mux 0
uhidev1 at uhub0 port 2 configuration 1 interface 1
uhidev1: Bit Trade One, LTD. USB IR Remote controller Advance, rev 2.00/0.01, addr 2, iclass 3/1
uhid0 at uhidev1: input=1, output=0, feature=0
uhidev2 at uhub0 port 2 configuration 1 interface 2
uhidev2: Bit Trade One, LTD. USB IR Remote controller Advance, rev 2.00/0.01, addr 2, iclass 3/1
ukbd0 at uhidev2
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
uhidev3 at uhub0 port 2 configuration 1 interface 3
uhidev3: Bit Trade One, LTD. USB IR Remote controller Advance, rev 2.00/0.01, addr 2, iclass 3/0
uhid1 at uhidev3: input=64, output=64, feature=0

# usbhidctl -f /dev/uhid1 -a
usbhidctl: USB_GET_REPORT(input) [probably not supported by device]: Input/output error
# uhidev0: at uhub0 port 2 (addr 2) disconnected
wsmouse1: detached
ums0: detached
uhidev0: detached
uhidev1: at uhub0 port 2 (addr 2) disconnected
uhid0: detached
uhidev1: detached
uhidev2: at uhub0 port 2 (addr 2) disconnected
wskbd1: disconnecting from wsdisplay0
wskbd1: detached
ukbd0: detached
uhidev2: detached
uhidev3: at uhub0 port 2 (addr 2) disconnected
uhid1: detached
uhidev3: detached


>Fix:
	Use Linux.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.