From nivit@libero.it  Thu Aug  1 13:03:12 2002
Return-Path: <nivit@libero.it>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 8AB4037B400
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  1 Aug 2002 13:03:12 -0700 (PDT)
Received: from smtp1.libero.it (smtp1.libero.it [193.70.192.51])
	by mx1.FreeBSD.org (Postfix) with ESMTP id CE65943E3B
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  1 Aug 2002 13:03:11 -0700 (PDT)
	(envelope-from nivit@libero.it)
Received: from coryphantha (151.29.217.37) by smtp1.libero.it (6.5.015)
        id 3CFC3E5B01863EE8 for FreeBSD-gnats-submit@freebsd.org; Thu, 1 Aug 2002 22:03:10 +0200
Received: (qmail 741 invoked by uid 1002); 1 Aug 2002 16:46:09 -0000
Message-Id: <20020801164609.740.qmail@Coryphantha.DOMO.SVA>
Date: 1 Aug 2002 16:46:09 -0000
From: nivit@libero.it (Nicola Vitale)
Reply-To: Nicola Vitale <nivit@libero.it>
To: FreeBSD-gnats-submit@freebsd.org
Subject: USB, getting full desc failed, HID device, STALLED
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         41243
>Category:       kern
>Synopsis:       [patch] [usb] getting full desc failed, HID device, STALLED
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-usb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 01 13:10:01 PDT 2002
>Closed-Date:    Mon Nov 15 18:30:19 GMT 2004
>Last-Modified:  Mon Nov 15 18:30:19 GMT 2004
>Originator:     Nicola Vitale
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
>Environment:

1) System: FreeBSD Coryphantha.DOMO.SVA 4.6-STABLE FreeBSD 4.6-STABLE #58: Thu Aug 1 16:00:40 CEST 2002 stan@Coryphantha.DOMO.SVA:/usr/obj/usr/src/sys/Coryphantha i386

2) Kernel configuration includes these lines:

	device          usb
	device          uhci
	device          ums
	device          uhid
	device          ugen

3) Hardware: USB graphic tablet (HID class)
   (http://www.trust.com/products/frame-product.htm?artnr=12050)

>Description:

	The host can not get the full descriptor from this device
	and so disables the port

uhci0: <Intel 82371AB/EB (PIIX4) USB controller> port 0xe000-0xe01f irq 11 at device 7.2 on pci0
usb0: <Intel 82371AB/EB (PIIX4) USB controller> on uhci0
usb0: USB revision 1.0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
usbd_new_device: addr=2, getting full desc failed
uhub_explore: usb_new_device failed, error=STALLED
uhub0: device problem, disabling port 1

>How-To-Repeat:

>Fix:

	It seems that the device wants to be in Address state,
	before responding to a GET_DESCRIPTOR request;
	
	On the other hand, despite of this comment in

/*      $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.23.2.4 2002/02/24 14:23:15 alfred Exp $

/*
 * Called when a new device has been put in the powered state,
 * but not yet in the addressed state.
 * Get initial descriptor, set the address, get full descriptor,
 * and attach a driver.
 */

	the function usbd_new_device(), which returns error=STALLED,
	executes those tasks in this order:

	1) get initial descriptor
	2) get full descriptor
	3) set address
	4) attach a driver

Inverting the actions 2) and 3), the driver ums is attached to the device:

uhci0: <Intel 82371AB/EB (PIIX4) USB controller> port 0xe000-0xe01f irq 11 at device 7.2 on pci0
usb0: <Intel 82371AB/EB (PIIX4) USB controller> on uhci0
usb0: USB revision 1.0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
ums0: AIPTEK International Inc. USB Tablet Series Version 1.04, rev 1.10/1.03, addr 2, iclass 3/1
ums0: 7 buttons and Z dir.

--- src/sys/dev/usb/usb_subr.c	Thu Mar 28 23:25:06 2002
+++ src/sys/dev/usb/usb_subr.c.new	Wed Jul 31 17:40:27 2002
@@ -1020,14 +1020,6 @@
 
 	USETW(dev->def_ep_desc.wMaxPacketSize, dd->bMaxPacketSize);
 
-	err = usbd_reload_device_desc(dev);
-	if (err) {
-		DPRINTFN(-1, ("usbd_new_device: addr=%d, getting full desc "
-			      "failed\n", addr));
-		usbd_remove_device(dev, up);
-		return (err);
-	}
-
 	/* Set the address */
 	err = usbd_set_address(dev, addr);
 	DPRINTFN(5,("usbd_new_device: setting device address=%d\n", addr));
@@ -1046,6 +1038,14 @@
 	/* Assume 100mA bus powered for now. Changed when configured. */
 	dev->power = USB_MIN_POWER;
 	dev->self_powered = 0;
+
+	err = usbd_reload_device_desc(dev);
+	if (err) {
+		DPRINTFN(-1, ("usbd_new_device: addr=%d, getting full desc "
+			      "failed\n", addr));
+		usbd_remove_device(dev, up);
+		return (err);
+	}
 
 	DPRINTF(("usbd_new_device: new dev (addr %d), dev=%p, parent=%p\n", 
 		 addr, dev, parent));



	


	

	
	
	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->joe 
Responsible-Changed-By: kris 
Responsible-Changed-When: Thu Jul 17 17:35:53 PDT 2003 
Responsible-Changed-Why:  
Assign to USB maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41243 
Responsible-Changed-From-To: joe->freebsd-usb 
Responsible-Changed-By: joe 
Responsible-Changed-When: Wed Nov 10 11:04:44 GMT 2004 
Responsible-Changed-Why:  
Hand this over to the usb mailling list. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41243 
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Mon Nov 15 18:29:59 GMT 2004 
State-Changed-Why:  
Submitter notes that the problem is resolved in more recent versions 
of FreeBSD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41243 
>Unformatted:
