From owner-freebsd-usb@FreeBSD.ORG Sun May 8 13:42:34 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4DBFB16A4E2 for ; Sun, 8 May 2005 13:42:34 +0000 (GMT) Received: from swip.net (mailfe09.swipnet.se [212.247.155.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8AC0743D7D for ; Sun, 8 May 2005 13:42:33 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: Y1QAsIk9O44SO+J/q9KNyQ== Received: from mp-217-229-50.daxnet.no ([193.217.229.50] verified) by mailfe09.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 149585222 for usb@freebsd.org; Sun, 08 May 2005 15:42:31 +0200 From: Hans Petter Selasky To: usb@freebsd.org Date: Sun, 8 May 2005 15:43:16 +0200 User-Agent: KMail/1.7 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200505081543.16671.hselasky@c2i.net> Subject: usbd.conf and devd.conf X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2005 13:42:34 -0000 Hi, Will "/etc/devd.conf" become a replacement for "/etc/usbd.conf" ? --HPS From owner-freebsd-usb@FreeBSD.ORG Sun May 8 13:50:02 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9CA3216A4E2 for ; Sun, 8 May 2005 13:50:02 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6542243D73 for ; Sun, 8 May 2005 13:50:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j48Do25X004221 for ; Sun, 8 May 2005 13:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j48Do2J3004220; Sun, 8 May 2005 13:50:02 GMT (envelope-from gnats) Resent-Date: Sun, 8 May 2005 13:50:02 GMT Resent-Message-Id: <200505081350.j48Do2J3004220@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, hselasky@c2i.net Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9E44D16A4E7 for ; Sun, 8 May 2005 13:43:06 +0000 (GMT) Received: from swip.net (mailfe04.swip.net [212.247.154.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 104C443D8F for ; Sun, 8 May 2005 13:43:06 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from mp-217-229-50.daxnet.no ([193.217.229.50] verified) by mailfe04.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 360867270 for FreeBSD-gnats-submit@freebsd.org; Sun, 08 May 2005 15:43:02 +0200 Message-Id: <200505081543.47765.hselasky@c2i.net> Date: Sun, 8 May 2005 15:43:46 +0200 From: Hans Petter Selasky To: FreeBSD-gnats-submit@FreeBSD.org Subject: usb/80773: "usbd_get_string()" could have taken a length parameter X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2005 13:50:02 -0000 >Number: 80773 >Category: usb >Synopsis: "usbd_get_string()" could have taken a length parameter >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 08 13:50:01 GMT 2005 >Closed-Date: >Last-Modified: >Originator: HPS >Release: FreeBSD 6.0-CURRENT i386 >Organization: >Environment: System: FreeBSD 6.0-CURRENT FreeBSD 6.0-CURRENT #45: Mon Mar 21 15:40:17 CET 2005 root@:/usr/obj/usr/src/sys/custom i386 >Description: >How-To-Repeat: >Fix: example + extra comments: /* Use "usbd_get_string_any()" instead of * "usbd_get_string_desc()", when the language id is not known. The * maximum length of the string, "len", includes the terminating zero. * "usbd_get_string_any()" will always write a terminating zero to "buf", * also on error. */ usbd_status usbd_get_string(struct usbd_device *udev, int si, char *buf, int len) { ... if(len == 0) { return (USBD_NORMAL_COMPLETION); } buf[0] = 0; /* subtract the terminating zero */ len--; ... for(i = 0; (i < n) && len; i++, len--) { ... } >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-usb@FreeBSD.ORG Sun May 8 13:50:03 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 166B216A4E2 for ; Sun, 8 May 2005 13:50:03 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D37DC43D73 for ; Sun, 8 May 2005 13:50:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j48Do2R4004279 for ; Sun, 8 May 2005 13:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j48Do2ip004278; Sun, 8 May 2005 13:50:02 GMT (envelope-from gnats) Resent-Date: Sun, 8 May 2005 13:50:02 GMT Resent-Message-Id: <200505081350.j48Do2ip004278@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, hselasky@c2i.net Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2B62E16A4E2 for ; Sun, 8 May 2005 13:43:58 +0000 (GMT) Received: from swip.net (mailfe05.swip.net [212.247.154.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F0B843DAA for ; Sun, 8 May 2005 13:43:57 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from mp-217-229-50.daxnet.no ([193.217.229.50] verified) by mailfe05.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 163787790 for FreeBSD-gnats-submit@freebsd.org; Sun, 08 May 2005 15:43:53 +0200 Message-Id: <200505081544.37993.hselasky@c2i.net> Date: Sun, 8 May 2005 15:44:37 +0200 From: Hans Petter Selasky To: FreeBSD-gnats-submit@FreeBSD.org Subject: usb/80774: have "usbd_find_desc" in line with the other "usbd_find_xxx" X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2005 13:50:03 -0000 >Number: 80774 >Category: usb >Synopsis: have "usbd_find_desc" in line with the other "usbd_find_xxx" >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 08 13:50:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: HPS >Release: FreeBSD 6.0-CURRENT i386 >Organization: >Environment: System: FreeBSD 6.0-CURRENT FreeBSD 6.0-CURRENT #45: Mon Mar 21 15:40:17 CET 2005 root@:/usr/obj/usr/src/sys/custom i386 >Description: "usbd_find_desc()" was put into the wrong file. The function belongs together with "usbd_find_edesc()" and "usbd_find_idesc()" and should take "usb_config_descriptor_t *" as argument. >How-To-Repeat: >Fix: const usb_descriptor_t *usb_find_desc(usbd_device_handle dev, int type, int subtype); #define USBD_SUBTYPE_ANY (~0) /* XXX mixing signed and unsigned types is not good */ changed into: usb_descriptor_t *usb_find_desc(usb_config_descriptor_t *, int type, int subtype); #define USBD_SUBTYPE_ANY (-1) Usage: "usb_find_desc(usbd_get_config_descriptor(udev), ... );" >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-usb@FreeBSD.ORG Sun May 8 13:50:07 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 74DE916A520 for ; Sun, 8 May 2005 13:50:07 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 26FCB43D88 for ; Sun, 8 May 2005 13:50:07 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j48Do6Ve004314 for ; Sun, 8 May 2005 13:50:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j48Do6Y4004310; Sun, 8 May 2005 13:50:06 GMT (envelope-from gnats) Resent-Date: Sun, 8 May 2005 13:50:06 GMT Resent-Message-Id: <200505081350.j48Do6Y4004310@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, hselasky@c2i.net Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA80C16A4E2 for ; Sun, 8 May 2005 13:45:10 +0000 (GMT) Received: from swip.net (mailfe02.swip.net [212.247.154.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id D835543D5E for ; Sun, 8 May 2005 13:45:09 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from mp-217-229-50.daxnet.no ([193.217.229.50] verified) by mailfe02.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 361074698 for FreeBSD-gnats-submit@freebsd.org; Sun, 08 May 2005 15:45:08 +0200 Message-Id: <200505081545.53293.hselasky@c2i.net> Date: Sun, 8 May 2005 15:45:52 +0200 From: Hans Petter Selasky To: FreeBSD-gnats-submit@FreeBSD.org Subject: usb/80776: UDAV device driver shouldn't use usb_add_task X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2005 13:50:07 -0000 >Number: 80776 >Category: usb >Synopsis: UDAV device driver shouldn't use usb_add_task >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 08 13:50:05 GMT 2005 >Closed-Date: >Last-Modified: >Originator: HPS >Release: FreeBSD 6.0-CURRENT i386 >Organization: >Environment: System: FreeBSD 6.0-CURRENT FreeBSD 6.0-CURRENT #45: Mon Mar 21 15:40:17 CET 2005 root@:/usr/obj/usr/src/sys/custom i386 >Description: The UDAV USB device driver shouldn't use "usb_add_task()", but rather the functions defined in /sys/sys/taskqueue.h, like the other USB device drivers. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-usb@FreeBSD.ORG Sun May 8 13:50:09 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 50B7916A4FE for ; Sun, 8 May 2005 13:50:09 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1028143D90 for ; Sun, 8 May 2005 13:50:09 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j48Do82c004344 for ; Sun, 8 May 2005 13:50:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j48Do86K004343; Sun, 8 May 2005 13:50:08 GMT (envelope-from gnats) Resent-Date: Sun, 8 May 2005 13:50:08 GMT Resent-Message-Id: <200505081350.j48Do86K004343@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, hselasky@c2i.net Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0F23716A4E2 for ; Sun, 8 May 2005 13:45:39 +0000 (GMT) Received: from swip.net (mailfe05.swip.net [212.247.154.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CD8F43D69 for ; Sun, 8 May 2005 13:45:38 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from mp-217-229-50.daxnet.no ([193.217.229.50] verified) by mailfe05.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 163789677 for FreeBSD-gnats-submit@freebsd.org; Sun, 08 May 2005 15:45:37 +0200 Message-Id: <200505081546.21939.hselasky@c2i.net> Date: Sun, 8 May 2005 15:46:20 +0200 From: Hans Petter Selasky To: FreeBSD-gnats-submit@FreeBSD.org Subject: usb/80777: usb_rem_task() should wait for callback to complete X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2005 13:50:09 -0000 >Number: 80777 >Category: usb >Synopsis: usb_rem_task() should wait for callback to complete? >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 08 13:50:07 GMT 2005 >Closed-Date: >Last-Modified: >Originator: HPS >Release: FreeBSD 6.0-CURRENT i386 >Organization: >Environment: System: FreeBSD 6.0-CURRENT FreeBSD 6.0-CURRENT #45: Mon Mar 21 15:40:17 CET 2005 root@:/usr/obj/usr/src/sys/custom i386 >Description: In the file "/sys/dev/usb/usb.c", the function "usb_rem_task" should wait for the "usb_task_thread()" to finish execution of the callback function. Though this might be impossible due to the contexts from which this function is called. At least one place (see if_udav.c) "usb_rem_task" is called from detach, and the code expects that the callback has returned or is not called, after that "usb_rem_task" returns. Else the callback will access freed memory. >How-To-Repeat: >Fix: Maybe "usb_xxxx_task" should not be used by if_udav.c, like suggested in another PR? >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-usb@FreeBSD.ORG Sun May 8 16:34:37 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B4E016A4E4 for ; Sun, 8 May 2005 16:34:37 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6280D43D80 for ; Sun, 8 May 2005 16:34:35 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.13.3/8.13.1) with ESMTP id j48GXODX038238; Sun, 8 May 2005 10:33:25 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 08 May 2005 10:34:23 -0600 (MDT) Message-Id: <20050508.103423.118460955.imp@bsdimp.com> To: hselasky@c2i.net From: "M. Warner Losh" In-Reply-To: <200505081543.16671.hselasky@c2i.net> References: <200505081543.16671.hselasky@c2i.net> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: usb@freebsd.org Subject: Re: usbd.conf and devd.conf X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2005 16:34:37 -0000 In message: <200505081543.16671.hselasky@c2i.net> Hans Petter Selasky writes: : Hi, : : Will "/etc/devd.conf" become a replacement for "/etc/usbd.conf" ? Yes. Warner From owner-freebsd-usb@FreeBSD.ORG Sun May 8 17:17:28 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7FBED16A511 for ; Sun, 8 May 2005 17:17:28 +0000 (GMT) Received: from smtp.andrew.cmu.edu (smtp.andrew.cmu.edu [128.2.10.81]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B20B43DAC for ; Sun, 8 May 2005 17:17:27 +0000 (GMT) (envelope-from dga+@cs.cmu.edu) Received: from [192.168.15.105] (dsl093-060-134.pit1.dsl.speakeasy.net [66.93.60.134]) (user=dga2 mech=PLAIN (0 bits)) by smtp.andrew.cmu.edu (8.12.10/8.12.10) with ESMTP id j48HHRLG032576 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Sun, 8 May 2005 13:17:27 -0400 Mime-Version: 1.0 (Apple Message framework v622) Content-Transfer-Encoding: 7bit Message-Id: <8135ada3a231cf3a2ba2d2458050334e@cs.cmu.edu> Content-Type: text/plain; charset=US-ASCII; format=flowed To: freebsd-usb@freebsd.org From: David Andersen Date: Sun, 8 May 2005 13:17:24 -0400 X-Mailer: Apple Mail (2.622) Subject: Better way for EVDO PC5220 wireless modem? X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2005 17:17:28 -0000 I'm not in the slightest familiar with USB or the USB driver code, so I'm convinced there's a better way to do this. :-) A clue would be appreciated. I'm trying to get my AirPrime PC5220 CDMA wireless modem (verizon EVDO/1xRTT) to work under FreeBSD. The device presents itself as two USB serial devices, but doesn't seem to mention this via its interfaces. To work around its lack of cooperation, I stripped some of the PL-specific functions from the uplcom driver (e.g., reset() and the rtscts set function), and added the airprime to the products[] list in uplcom.c. But this seems like a rather ugly way to do it - does anyone more familiar with the framework have a suggestion for the "right" way to do it? The card isn't very complex - the first serial port is the data port: May 8 07:01:02 deep kernel: ucom0: AirPrime, Incorporated AirPrime CDMA Wireless PC Card, rev 1.10/0.01, addr 2 May 8 07:01:02 deep kernel: uplcom attach: sc = 0xc23b6400 May 8 07:01:02 deep kernel: uplcom_attach: chiptype 2303 May 8 07:01:02 deep kernel: ucom0: Found 2 interfaces May 8 07:01:02 deep kernel: ucom0: uplcom_reset: STALLED May 8 07:01:02 deep kernel: uplcom: in = 0x82, out = 0x5, intr = 0x81 May 8 07:01:02 deep kernel: ucom_attach: tty_attach tp = 0xc2180c00 May 8 07:01:02 deep kernel: ucom_attach: make_dev: ucom0 May 8 07:01:02 deep kernel: ucom0: at uhub3 port 1 (addr 2) disconnected May 8 07:01:02 deep kernel: uplcom_detach: sc = 0xc23b6400 May 8 07:01:02 deep kernel: ucom_detach: sc = 0xc23b6400, tp = 0xc2180c00 (so I also ripped out the "select second port" code from uplcom). Which basically makes me think that I've turned the uplcom driver into just a shim that forces the ucom driver to believe that the 5220 is, in fact, a serial device. So is there a "right" way to actually accomplish that? (As it is, it works; I've got PPP running over it, though I haven't tested the megabit data rates since Verizon hasn't upgraded to EVDO in Pittsburgh yet). Removing the card results in a kernel panic with or without my hacked up driver, so there's some work left to do. -Dave From owner-freebsd-usb@FreeBSD.ORG Sun May 8 21:28:19 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A0FF316A4E6 for ; Sun, 8 May 2005 21:28:19 +0000 (GMT) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id D7D2F43DA6 for ; Sun, 8 May 2005 21:28:18 +0000 (GMT) (envelope-from gofdu-freebsd-usb@m.gmane.org) Received: from root by ciao.gmane.org with local (Exim 4.43) id 1DUtC0-0007Hc-Uc for freebsd-usb@freebsd.org; Sun, 08 May 2005 23:20:05 +0200 Received: from kvip88.kvi.nl ([129.125.15.152]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 08 May 2005 23:20:04 +0200 Received: from A.S.Usov by kvip88.kvi.nl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 08 May 2005 23:20:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-usb@freebsd.org From: "Alexander S. Usov" Date: Sun, 08 May 2005 23:14:55 +0200 Organization: KVI Lines: 13 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: kvip88.kvi.nl User-Agent: KNode/0.9.0 Sender: news Subject: USB2 umass not working in 5.4-RELEASE X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2005 21:28:19 -0000 Hi! It looks that relatively recently (not more than a month I tnink) something was broken in ehci. Trying to write to msdosfs/ext3fs mounted from external usb2 drive blocks quite qickly. Writing process gets stuck in wdrain state, and disk seems unresponsive -- it just lights up the lamp and does nothing. Any suggestions what what to check to make a usefull bug report? -- Best regards, Alexander. From owner-freebsd-usb@FreeBSD.ORG Mon May 9 11:01:55 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7179C16A506 for ; Mon, 9 May 2005 11:01:52 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3D47043D9F for ; Mon, 9 May 2005 11:01:52 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j49B1qOR097788 for ; Mon, 9 May 2005 11:01:52 GMT (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j49B1pe4097780 for freebsd-usb@freebsd.org; Mon, 9 May 2005 11:01:51 GMT (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 9 May 2005 11:01:51 GMT Message-Id: <200505091101.j49B1pe4097780@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: freebsd-usb@FreeBSD.org Subject: Current problem reports assigned to you X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2005 11:01:56 -0000 Current FreeBSD problem reports Critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2005/05/06] usb/80685 usb panic in usb_cold_explore() at begining o [2005/05/08] usb/80773 usb "usbd_get_string()" could have taken a le o [2005/05/08] usb/80774 usb have "usbd_find_desc" in line with the ot o [2005/05/08] usb/80776 usb UDAV device driver shouldn't use usb_add_ o [2005/05/08] usb/80777 usb usb_rem_task() should wait for callback t 5 problems total. Serious problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2002/07/19] kern/40792 usb signals lead to data loss on device ugen o [2002/12/10] kern/46176 usb umass causes kernel panic if device remov o [2002/12/19] i386/46371 usb USB controller cannot be initialized on I f [2003/02/17] kern/48359 usb SiS 5597/8 USB + uscanner breakage f [2003/03/05] kern/48952 usb uscanner0 hangs o [2003/09/26] bin/57255 usb usbd and multi-function devices f [2003/12/11] kern/60131 usb [usb] Page fault on disconnect of USB dev s [2003/12/15] kern/60276 usb [usb] Kernel panic when plugging in USB ( f [2004/01/11] kern/61191 usb [usb] panic: USB vs. Serial problems o [2004/01/20] kern/61627 usb [usb] [patch] New USB printer not support o [2004/01/24] kern/61841 usb [boot] 5.2 Boot freeze if memorybird (USB f [2004/01/30] kern/62088 usb [usb] Logitech Cordless/Optical Mouse not f [2004/01/30] kern/62123 usb [usb] LaCie 160GB USB drive umass: BBB re f [2004/02/23] i386/63251 usb [usb] USB stops working after 2nd APM sus f [2004/03/01] kern/63621 usb [usb] USB MemoryStick Reader stalls/crash f [2004/04/07] kern/65292 usb [panic] random page faults (usb-related?) o [2004/07/13] kern/69006 usb [patch] Apple Cinema Display hangs USB po o [2004/08/30] kern/71155 usb [usb] misbehaving usb-printer hangs proce o [2004/10/30] kern/73307 usb Kernel panics on USB disconnect f [2004/11/18] kern/74088 usb ohci ehci uhub: port disabled on connecti o [2005/01/13] usb/76204 usb panic while using usb attached modem o [2005/01/18] usb/76395 usb USB printer does not work, usbdevs says " o [2005/01/21] usb/76554 usb Panram "yoyo" USB MP3 player causes panic f [2005/01/25] usb/76684 usb Toshiba PDR-M4 camera connected via USB h f [2005/01/26] usb/76727 usb usb printing locks machine f [2005/01/30] usb/76847 usb ukbd panics on boot o [2005/02/06] usb/77184 usb kernel panic on USB device disconnect o [2005/02/09] usb/77294 usb ucom + ulpcom panic o [2005/02/16] usb/77604 usb Sluggish Logitch LX700 USB Mouse o [2005/03/18] usb/78989 usb please add USB keyboard support to instal o [2005/03/22] usb/79140 usb WD Firewire/USB Combo hangs under load on o [2005/03/27] usb/79287 usb UHCI hang after interrupt transfer o [2005/04/02] usb/79436 usb Panic: ohci_abort_xfer: not in process co o [2005/04/04] usb/79524 usb printing to Minolta PagePro 1[23]xxW via o [2005/04/07] usb/79656 usb [usb] RHSC interrupts lost o [2005/04/09] usb/79722 usb [usb] wrong alignments in ehci.h o [2005/04/17] usb/80040 usb [hang] Use of sound mixer causes system f o [2005/04/22] usb/80260 usb Travan USB tape drive fails to write o [2005/04/26] usb/80361 usb mounting of usb-stick fails o [2005/04/26] usb/80373 usb usb keyboard does not respond 40 problems total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2001/09/30] conf/30929 usb [patch] use usbd to initialize USB ADSL m o [2001/12/09] kern/32652 usb [patch] A new ioctl to uscanner s [2001/12/09] ports/32653 usb Added patches to improve USB scanner supp f [2002/07/24] kern/40948 usb [usb] USB HP CDW8200 does not work o [2002/08/07] kern/41415 usb [usb] [patch] Some USB scanners cannot ta o [2003/02/16] bin/48342 usb [PATCH] usbd dynamic device list. f [2003/03/19] kern/50110 usb [usb] Astra 2100U scanner being detected o [2003/05/08] kern/51958 usb [usb] [patch] update for urio driver o [2003/05/10] kern/52026 usb [usb] feature request: umass driver suppo f [2003/05/19] bin/52432 usb [sysinstall] drivers.flp won't load with o [2003/06/08] kern/53025 usb [PATCH] ugen does not allow O_NONBLOCK fo f [2003/09/19] kern/56999 usb FreeCom USB CD/RW problem on FreeBSD 5.1 f [2003/11/10] i386/59147 usb [usb] USB active extension cable not reco o [2003/11/11] kern/59169 usb [patch] ulpt is missing read operation o [2003/12/15] kern/60248 usb [patch] Problem with USB printer HP Laser o [2004/01/12] bin/61234 usb [usb] [patch] usbhidaction doesn't suppor f [2004/02/13] kern/62788 usb need quirks for Super Talent Flash USB 2. f [2004/03/04] kern/63779 usb [usb] USB-mass storage (USB to IDE Conver o [2004/03/06] kern/63837 usb [patch] USB: hid_is_collection() only loo o [2004/04/11] kern/65436 usb QUIRK: [patch] to add support for PNY Att o [2004/04/19] kern/65769 usb [usb] Call to tcflush(x, TCIFLUSH) stops f [2004/05/11] kern/66547 usb [usb] Palm Tungsten T USB does not initia o [2004/06/27] kern/68412 usb [usb] [patch] QUIRK: Philips KEY013 USB M o [2004/07/06] i386/68719 usb [usb] USB 2.0 mobil rack+ fat32 performan o [2004/08/16] kern/70523 usb [usb] [patch] umct sending/receiving wron o [2004/08/25] kern/70942 usb [usb] Genius Wireless USB mouse: moused d o [2004/09/06] kern/71416 usb [usb] Cryptoflex e-gate USB token (ugen0) o [2004/09/06] kern/71417 usb [usb] Cryptoflex e-gate USB token (ugen0) o [2004/09/07] kern/71455 usb [usb] Slow USB umass performance of 5.3 o [2004/09/11] kern/71605 usb [usb] [patch] umass doesn't recognize mul o [2004/10/05] kern/72344 usb [usb] [patch] QUIRK: Dane-Elec zMate 512 f [2004/10/06] i386/72380 usb [usb] USB does not work [dual Celeron Abi o [2004/10/23] i386/73056 usb [usb] Sun Microsystems Type 6 USB mouse n f [2004/11/02] i386/73421 usb [usb] USB not recgnized/working on Toshib o [2004/11/30] usb/74557 usb imation 500mb usb key can only be written o [2004/12/12] usb/74989 usb (regression) Lost USB support between 5.2 o [2004/12/28] usb/75578 usb [patch] QUIRK: PNY USB flash key o [2005/01/07] usb/75928 usb Cytronix SmartMedia card (SMC) reader has o [2005/01/19] usb/76461 usb disklabel of umass(4)-CAM(4)-da(4) not us o [2005/01/27] usb/76732 usb Mouse problems with USB KVM Switch f [2005/03/03] usb/78371 usb Philips Wearable Audio Player (128) fails o [2005/03/07] usb/78543 usb [patch] Support for Trip-Lite USB 2 Seria o [2005/03/18] usb/78984 usb Creative MUVO umass failure o [2005/04/09] usb/79723 usb [usb] prepare for high speed isochronous o [2005/04/09] usb/79725 usb [patch] [usb] USB device speed is not dou o [2005/04/16] usb/80010 usb Add support for the AEI USB to LAN adapte o [2005/04/27] usb/80383 usb [PATCH] Add quirk for uhid to ignore cert o [2005/04/27] usb/80420 usb atapicam stops iPod functionality 48 problems total. From owner-freebsd-usb@FreeBSD.ORG Mon May 9 16:50:09 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3AD1716A501 for ; Mon, 9 May 2005 16:50:09 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E34BC43D79 for ; Mon, 9 May 2005 16:50:08 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j49Go8Yt049285 for ; Mon, 9 May 2005 16:50:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j49Go8Hl049269; Mon, 9 May 2005 16:50:08 GMT (envelope-from gnats) Resent-Date: Mon, 9 May 2005 16:50:08 GMT Resent-Message-Id: <200505091650.j49Go8Hl049269@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, hselasky@c2i.net Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B4BAD16A4E9 for ; Mon, 9 May 2005 16:48:33 +0000 (GMT) Received: from swip.net (mailfe09.swipnet.se [212.247.155.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id E0F8343D41 for ; Mon, 9 May 2005 16:48:32 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from mp-217-230-116.daxnet.no ([193.217.230.116] verified) by mailfe09.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 150625421 for FreeBSD-gnats-submit@freebsd.org; Mon, 09 May 2005 18:48:31 +0200 Message-Id: <200505091849.15420.hselasky@c2i.net> Date: Mon, 9 May 2005 18:49:14 +0200 From: Hans Petter Selasky To: FreeBSD-gnats-submit@FreeBSD.org Subject: usb/80829: possible panic when loading USB-modules X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2005 16:50:09 -0000 >Number: 80829 >Category: usb >Synopsis: possible panic when loading USB-modules >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon May 09 16:50:07 GMT 2005 >Closed-Date: >Last-Modified: >Originator: HPS >Release: FreeBSD 6.0-CURRENT i386 >Organization: >Environment: System: FreeBSD 6.0-CURRENT FreeBSD 6.0-CURRENT #45: Mon Mar 21 15:40:17 CET 2005 root@:/usr/obj/usr/src/sys/custom i386 >Description: There is a special mechanism where probe/attach can clear an entry in the array pointed to by "uaa->ifaces". The existing USB-driver allocates the "uaa" in memory, but the "uaa->ifaces" is still on the stack ! This is going to cause a panic for some devices when loaded as a module. usbd_status usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev, int port, int addr) ... usbd_interface_handle ifaces[256]; /* 256 is the absolute max */ ... uaa.ifaces = ifaces; >How-To-Repeat: >Fix: Allocate "ifaces" structure in memory, and make sure it gets freed, or revert everything back to stack, which is way simpler! >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-usb@FreeBSD.ORG Mon May 9 17:20:06 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A8D2D16A4E9 for ; Mon, 9 May 2005 17:20:06 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 92A2443D80 for ; Mon, 9 May 2005 17:20:06 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j49HK6Xn054196 for ; Mon, 9 May 2005 17:20:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j49HK6oh054195; Mon, 9 May 2005 17:20:06 GMT (envelope-from gnats) Date: Mon, 9 May 2005 17:20:06 GMT Message-Id: <200505091720.j49HK6oh054195@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Warner Losh Subject: Re: usb/80829: possible panic when loading USB-modules X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Warner Losh List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2005 17:20:06 -0000 The following reply was made to PR usb/80829; it has been noted by GNATS. From: Warner Losh To: hselasky@c2i.net Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: usb/80829: possible panic when loading USB-modules Date: Mon, 09 May 2005 11:01:53 -0600 (MDT) > There is a special mechanism where probe/attach can clear an entry in the > array pointed to by "uaa->ifaces". The existing USB-driver allocates the > "uaa" in memory, but the "uaa->ifaces" is still on the stack ! This is going > to cause a panic for some devices when loaded as a module. > > usbd_status > usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev, > int port, int addr) > > ... > usbd_interface_handle ifaces[256]; /* 256 is the absolute max */ > > ... > uaa.ifaces = ifaces; Good catch! > Allocate "ifaces" structure in memory, and make sure it gets freed, or revert > everything back to stack, which is way simpler! Can't go back to the stack method. It doesn't work. Since we can retain devices past the function call to usbd_probe_and_attach, we can't rely on anything on the stack. The problem here I believe is an oversight on my part when I did that code. Warner From owner-freebsd-usb@FreeBSD.ORG Mon May 9 20:20:08 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 32F5516A4EB for ; Mon, 9 May 2005 20:20:08 +0000 (GMT) Received: from swip.net (mailfe07.swip.net [212.247.154.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2EC0543D7B for ; Mon, 9 May 2005 20:20:07 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: Y1QAsIk9O44SO+J/q9KNyQ== Received: from mp-216-36-231.daxnet.no ([193.216.36.231] verified) by mailfe07.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 164817822; Mon, 09 May 2005 22:20:03 +0200 From: Hans Petter Selasky To: Warner Losh , freebsd-usb@freebsd.org Date: Mon, 9 May 2005 22:20:40 +0200 User-Agent: KMail/1.7 References: <200505091849.15420.hselasky@c2i.net> <20050509.110153.78761402.imp@bsdimp.com> In-Reply-To: <20050509.110153.78761402.imp@bsdimp.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200505092220.42970.hselasky@c2i.net> Subject: Re: usb/80829: possible panic when loading USB-modules X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2005 20:20:08 -0000 On Monday 09 May 2005 19:01, you wrote: > > There is a special mechanism where probe/attach can clear an entry in the > > array pointed to by "uaa->ifaces". The existing USB-driver allocates the > > "uaa" in memory, but the "uaa->ifaces" is still on the stack ! This is > > going to cause a panic for some devices when loaded as a module. > > > > usbd_status > > usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev, > > int port, int addr) > > > > ... > > usbd_interface_handle ifaces[256]; /* 256 is the absolute max */ > > > > ... > > uaa.ifaces = ifaces; > > Good catch! > > > Allocate "ifaces" structure in memory, and make sure it gets freed, or > > revert everything back to stack, which is way simpler! > > Can't go back to the stack method. I'm planning to use the stack method and have usbd_probe_and_attach() called again from uhub_explore() via a call similar to usb_explore(). Leaving devices after usbd_probe_and_attach() has returned, will _not_ work, except for generic or specific USB drivers. It will not work for "ums", "ukbd" and so on, because a device can have more than one configuration, and it is not sure that the right configuration index is set when usbd_probe_and_attach() returns after the generic probe. Have a look at this (almost finished): Implement a new state-variable "udev->probed" and a refcount in "usbd_port" to limit the calling of "usbd_probe_and_attach()". Any comments? -- HPS /* "usbd_probe_and_attach()" is called * from "usbd_new_device()" and "uhub_explore()" */ usbd_status usbd_probe_and_attach(struct device *parent, int port, struct usbd_port *up) { struct usb_attach_arg uaa; struct usbd_device *udev = up->device; struct device *bdev = NULL; usbd_status err = 0; int config; int i; #if 0 up->refcount = usb_driver_added_refcount; #endif if(udev == NULL) { PRINTF(("%s: port %d has no device\n", device_get_nameunit(parent), port)); return (USBD_INVAL); } /* probe and attach */ uaa.device = udev; uaa.port = port; uaa.configno = UHUB_UNK_CONFIGURATION; uaa.vendor = UGETW(udev->ddesc.idVendor); uaa.product = UGETW(udev->ddesc.idProduct); uaa.release = UGETW(udev->ddesc.bcdDevice); /* "udev->probed" has four states: * * 0: nothing found (default value) * 1: probed specific and found * 2: probed iface and found * 3: probed generic and found */ if((udev->probed == 1) || (udev->probed == 3)) { /* nothing more to probe */ goto done; } bdev = device_add_child(parent, NULL, -1); if(!bdev) { device_printf(udev->bus->bdev, "Device creation failed\n"); err = USBD_INVAL; goto done; } device_set_ivars(bdev, &uaa); device_quiet(bdev); if(udev->probed == 0) { /* first try with device specific drivers */ PRINTF(("trying device specific drivers\n")); if(device_probe_and_attach(bdev) == 0) { device_set_ivars(bdev, NULL); /* no longer accessible */ udev->subdevs[0] = bdev; udev->probed = 1; bdev = 0; goto done; } PRINTF(("no device specific driver found; " "looping over %d configurations\n", udev->ddesc.bNumConfigurations)); } /* next try with interface drivers * (in decremental order so * that config 0 is set last, * in case of failure!) */ if((udev->probed == 0) || (udev->probed == 2)) { config = udev->ddesc.bNumConfigurations; while(config--) { struct usbd_interface *iface; /* only set config index the first * time the devices are probed */ if(udev->probed == 0) { err = usbd_set_config_index(udev, config, 1); if(err) { #ifdef USB_DEBUG PRINTF(("%s: port %d, set config at addr %d failed, " "error=%s\n", device_get_nameunit(parent), port, udev->address, usbd_errstr(err))); #else device_printf(parent, "port %d, set config at addr %d failed\n", port, udev->address); #endif goto done; } } /* ``bNumInterface'' is checked by ``usbd_set_config_index()'' */ uaa.configno = udev->cdesc->bConfigurationValue; uaa.ifaces_start = &udev->ifaces[0]; uaa.ifaces_end = &udev->ifaces[udev->cdesc->bNumInterface]; #ifdef USB_COMPAT_OLD uaa.nifaces = udev->cdesc->bNumInterface; for(i = 0; i < uaa.nifaces; i++) { if(udev->ifaces_probed[i / 8] & (1 << (i % 8))) uaa.ifaces[i] = NULL; else uaa.ifaces[i] = &udev->ifaces[i]; } #endif for(iface = uaa.ifaces_start; iface < uaa.ifaces_end; iface++) { uaa.iface = iface; uaa.iface_index = (i = (iface - &udev->ifaces[0])); if(uaa.iface_index >= (sizeof(udev->subdevs)/ sizeof(udev->subdevs[0]))) { device_printf(udev->bus->bdev, "Too many subdevices\n"); break; } #ifdef USB_COMPAT_OLD if(uaa.ifaces[i]) #endif if((udev->subdevs[i] == NULL) && (device_probe_and_attach(bdev) == 0)) { device_set_ivars(bdev, NULL); /* no longer accessible */ udev->subdevs[i] = bdev; udev->probed = 2; bdev = 0; /* create another child for the next iface [if any] */ bdev = device_add_child(parent, NULL, -1); if(!bdev) { device_printf(udev->bus->bdev, "Device creation failed\n"); break; /* need to update "iface_probed" */ } device_set_ivars(bdev, &uaa); device_quiet(bdev); } } if(udev->probed == 2) { #ifdef USB_COMPAT_OLD uaa.nifaces = udev->cdesc->bNumInterface; for(i = 0; i < uaa.nifaces; i++) { /* mark ifaces that should * not be probed */ if(uaa.ifaces[i] == NULL) { udev->ifaces_probed[i / 8] |= (1 << (i % 8)); } } #endif break; } } } if(udev->probed == 0) { /* config index 0 should be set */ PRINTF(("no interface drivers found\n")); /* finally try the generic driver */ uaa.iface = NULL; uaa.iface_index = 0; uaa.ifaces_start = NULL; uaa.ifaces_end = NULL; uaa.usegeneric = 1; uaa.configno = UHUB_UNK_CONFIGURATION; if(device_probe_and_attach(bdev) == 0) { device_set_ivars(bdev, NULL); /* no longer accessible */ udev->subdevs[0] = bdev; udev->probed = 3; bdev = 0; goto done; } /* * Generic attach failed. * The device is left as it is. * It has no driver, but is fully operational. */ PRINTF(("generic attach failed\n")); } done: if(bdev) { /* remove the last created child; it is unused */ device_delete_child(parent, bdev); } return err; } From owner-freebsd-usb@FreeBSD.ORG Mon May 9 20:47:12 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 60D9D16A4EB for ; Mon, 9 May 2005 20:47:12 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id E6F1143D6E for ; Mon, 9 May 2005 20:47:11 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1]) by harmony.village.org (8.13.3/8.13.1) with ESMTP id j49KjkuH056175; Mon, 9 May 2005 14:45:46 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 09 May 2005 14:45:46 -0600 (MDT) Message-Id: <20050509.144546.74694206.imp@bsdimp.com> To: hselasky@c2i.net From: Warner Losh In-Reply-To: <200505092220.42970.hselasky@c2i.net> References: <200505091849.15420.hselasky@c2i.net> <20050509.110153.78761402.imp@bsdimp.com> <200505092220.42970.hselasky@c2i.net> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-usb@freebsd.org Subject: Re: usb/80829: possible panic when loading USB-modules X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2005 20:47:12 -0000 > I'm planning to use the stack method and have usbd_probe_and_attach() called > again from uhub_explore() via a call similar to usb_explore(). Leaving > devices after usbd_probe_and_attach() has returned, will _not_ work, except > for generic or specific USB drivers. It will not work for "ums", "ukbd" and > so on, because a device can have more than one configuration, and it is not > sure that the right configuration index is set when usbd_probe_and_attach() > returns after the generic probe. Have a look at this (almost finished): > > Implement a new state-variable "udev->probed" and a refcount in "usbd_port" to > limit the calling of "usbd_probe_and_attach()". > > Any comments? That can't work. The problem is that if there's no driver loaded, the device_t sticks around (and must stick around). When the driver is then loaded, we look at all the unattached devices again and at that point the memory that's reference has to be stable. That's why I made the change in the first place. Warner From owner-freebsd-usb@FreeBSD.ORG Mon May 9 21:35:04 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DDACF16A4EA for ; Mon, 9 May 2005 21:35:04 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5F28A43D6D for ; Mon, 9 May 2005 21:35:04 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1]) by harmony.village.org (8.13.3/8.13.1) with ESMTP id j49LWV5P056591; Mon, 9 May 2005 15:32:31 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 09 May 2005 15:32:31 -0600 (MDT) Message-Id: <20050509.153231.41689623.imp@bsdimp.com> To: hselasky@c2i.net From: Warner Losh In-Reply-To: <200505092220.42970.hselasky@c2i.net> References: <200505091849.15420.hselasky@c2i.net> <20050509.110153.78761402.imp@bsdimp.com> <200505092220.42970.hselasky@c2i.net> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-usb@freebsd.org Subject: Re: usb/80829: possible panic when loading USB-modules X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2005 21:35:05 -0000 > I'm planning to use the stack method and have usbd_probe_and_attach() called > again from uhub_explore() via a call similar to usb_explore(). Leaving > devices after usbd_probe_and_attach() has returned, will _not_ work, except > for generic or specific USB drivers. It will not work for "ums", "ukbd" and > so on, because a device can have more than one configuration, and it is not > sure that the right configuration index is set when usbd_probe_and_attach() > returns after the generic probe. Have a look at this (almost finished): > > Implement a new state-variable "udev->probed" and a refcount in "usbd_port" to > limit the calling of "usbd_probe_and_attach()". > > Any comments? I see why you are doing the reference count... I also see some of the problems involved. The main reason that I went from the stack method to the other method was so that the driver_added stuff would still work. That's the goal. Part of the problem is that the NetBSD device model ill fits newbus, for reasons that you're discovering... Warner From owner-freebsd-usb@FreeBSD.ORG Tue May 10 01:10:05 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D486C16A4EB for ; Tue, 10 May 2005 01:10:05 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BE02143D7B for ; Tue, 10 May 2005 01:10:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4A1A56r018604 for ; Tue, 10 May 2005 01:10:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4A1A50q018603; Tue, 10 May 2005 01:10:05 GMT (envelope-from gnats) Date: Tue, 10 May 2005 01:10:05 GMT Message-Id: <200505100110.j4A1A50q018603@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Ian Dowse Subject: Re: usb/80829: possible panic when loading USB-modules X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Ian Dowse List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 01:10:05 -0000 The following reply was made to PR usb/80829; it has been noted by GNATS. From: Ian Dowse To: hselasky@c2i.net Cc: FreeBSD-gnats-submit@FreeBSD.org Subject: Re: usb/80829: possible panic when loading USB-modules Date: Tue, 10 May 2005 02:07:20 +0100 In message <200505091849.15420.hselasky@c2i.net>, Hans Petter Selasky writes: > >There is a special mechanism where probe/attach can clear an entry in the >array pointed to by "uaa->ifaces". The existing USB-driver allocates the >"uaa" in memory, but the "uaa->ifaces" is still on the stack ! This is going >to cause a panic for some devices when loaded as a module. > >usbd_status >usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev, > int port, int addr) > >... > usbd_interface_handle ifaces[256]; /* 256 is the absolute max */ > >... > uaa.ifaces = ifaces; Hi, Is there actually problem with any current usage of uaa.ifaces? I can see that the pointer to the ifaces[] array on the stack can get stored in the malloc'd `uaap' structure, but I couldn't see anywhere that actually references the ifaces[] array after usbd_probe_and_attach() returns - I'm probably missing something simple though. If nothing needs to use uaap->ifaces[] then I guess just setting it to NULL at the end of usbd_probe_and_attach() would make it clear that it is no longer valid? If there is some case where the stack array is referenced after usbd_probe_and_attach() returns, then it would be very helpful if you could post a quick description of how that can happen. Thanks, Ian From owner-freebsd-usb@FreeBSD.ORG Tue May 10 09:33:31 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C4ECB16A4EE for ; Tue, 10 May 2005 09:33:31 +0000 (GMT) Received: from swip.net (mailfe06.swip.net [212.247.154.161]) by mx1.FreeBSD.org (Postfix) with ESMTP id D19C643D6B for ; Tue, 10 May 2005 09:33:30 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: Y1QAsIk9O44SO+J/q9KNyQ== Received: from mp-217-207-132.daxnet.no ([193.217.207.132] verified) by mailfe06.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 351522853; Tue, 10 May 2005 11:33:28 +0200 From: Hans Petter Selasky To: Warner Losh Date: Tue, 10 May 2005 11:34:13 +0200 User-Agent: KMail/1.7 References: <200505091849.15420.hselasky@c2i.net> <200505092220.42970.hselasky@c2i.net> <20050509.144546.74694206.imp@bsdimp.com> In-Reply-To: <20050509.144546.74694206.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200505101134.14381.hselasky@c2i.net> cc: freebsd-usb@freebsd.org Subject: Re: usb/80829: possible panic when loading USB-modules X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 09:33:31 -0000 On Monday 09 May 2005 22:45, Warner Losh wrote: > > I'm planning to use the stack method and have usbd_probe_and_attach() > > called again from uhub_explore() via a call similar to usb_explore(). > > Leaving devices after usbd_probe_and_attach() has returned, will _not_ > > work, except for generic or specific USB drivers. It will not work for > > "ums", "ukbd" and so on, because a device can have more than one > > configuration, and it is not sure that the right configuration index is > > set when usbd_probe_and_attach() returns after the generic probe. Have a > > look at this (almost finished): > > > > Implement a new state-variable "udev->probed" and a refcount in > > "usbd_port" to limit the calling of "usbd_probe_and_attach()". > > > > Any comments? > > That can't work. The problem is that if there's no driver loaded, the > device_t sticks around (and must stick around). My idea is to not have any device_t stick around. The only reason that the device_t must stick around, in the existing driver, is that they will get probed via "bus_generic_driver_added" when a new driver is added. So change: DEVMETHOD(bus_driver_added, bus_generic_driver_added), back into: DEVMETHOD(bus_driver_added, uhub_driver_added), And have "uhub_driver_added" call , say, "usbd_probe_and_attach_all()", that will create device_t again and probe/attach, through "uhub_explore" and "usb_event_thread", and free if no device present. And if this is done right, it will not conflict with device removal! If you use "bus_generic_driver_added", won't there be a race condition where a device can be probed/attached at the same time it is detached, because probe/attach can call USB-functions that can sleep, like usbd_do_request()? When sleeping no lock is held. > When the driver is > then loaded, we look at all the unattached devices again and at that > point the memory that's reference has to be stable. That's why I made > the change in the first place. > > Is there actually problem with any current usage of uaa.ifaces? I > can see that the pointer to the ifaces[] array on the stack can get > stored in the malloc'd `uaap' structure, but I couldn't see anywhere > that actually references the ifaces[] array after usbd_probe_and_attach() > returns - I'm probably missing something simple though. When you are loading an USB-module, because device_t is still sticking around, probe/attach can be called outside of "usbd_probe_and_attach()", actually from "bus_generic_driver_added". But in my opinion the uaaxxx structures should not be available after probe/attach, and that probe/attach should not be called outside of "usbd_probe_and_attach()". --HPS From owner-freebsd-usb@FreeBSD.ORG Tue May 10 11:50:03 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8064E16A4CE for ; Tue, 10 May 2005 11:50:03 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 330B243D31 for ; Tue, 10 May 2005 11:50:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4ABo2bl035953 for ; Tue, 10 May 2005 11:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4ABo2rg035952; Tue, 10 May 2005 11:50:02 GMT (envelope-from gnats) Resent-Date: Tue, 10 May 2005 11:50:02 GMT Resent-Message-Id: <200505101150.j4ABo2rg035952@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, hselasky@c2i.net Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D165D16A4D5 for ; Tue, 10 May 2005 11:47:50 +0000 (GMT) Received: from swip.net (mailfe07.swip.net [212.247.154.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C07143D54 for ; Tue, 10 May 2005 11:47:50 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from mp-216-45-130.daxnet.no ([193.216.45.130] verified) by mailfe07.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 165339775 for FreeBSD-gnats-submit@freebsd.org; Tue, 10 May 2005 13:47:47 +0200 Message-Id: <200505101348.32720.hselasky@c2i.net> Date: Tue, 10 May 2005 13:48:31 +0200 From: Hans Petter Selasky To: FreeBSD-gnats-submit@FreeBSD.org Subject: usb/80854: suggestion for new iface-no-probe mechanism X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 11:50:03 -0000 >Number: 80854 >Category: usb >Synopsis: suggestion for new iface-no-probe mechanism >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue May 10 11:50:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: HPS >Release: FreeBSD 6.0-CURRENT i386 >Organization: >Environment: System: FreeBSD 6.0-CURRENT FreeBSD 6.0-CURRENT #45: Mon Mar 21 15:40:17 CET 2005 root@:/usr/obj/usr/src/sys/custom i386 >Description: There is a special mechanism where probe/attach can clear an entry in the array pointed to by "uaa->ifaces". I have a suggestion to replace this mechanism, that will save some memory allocation: >How-To-Repeat: >Fix: New library function: struct usbd_interface * usbd_get_iface(struct usbd_device *udev, u_int8_t iface_index) { struct usbd_interface *iface = &udev->ifaces[iface_index]; if((iface < &udev->ifaces[0]) || (iface >= &udev->ifaces_end[0]) || (udev->cdesc == NULL) || (iface_index >= udev->cdesc->bNumInterface)) { return NULL; } return iface; } New structure fields: struct usbd_device { ... u_int8_t ifaces_no_probe[(USB_MAX_ENDPOINTS + 7) / 8]; #define USBD_SET_IFACE_NO_PROBE(udev, ii) \ { (udev)->ifaces_no_probe[(ii) >> 3] |= (1 << ((ii) & 7)); } #define USBD_CLR_IFACE_NO_PROBE(udev, ii) \ { (udev)->ifaces_no_probe[(ii) >> 3] &= ~(1 << ((ii) & 7)); } #define USBD_GET_IFACE_NO_PROBE(udev, ii) \ ((udev)->ifaces_no_probe[(ii) >> 3] & (1 << ((ii) & 7))) ... } Re-initialization in case a new configuration index is selected: usbd_status usbd_fill_iface_data(struct usbd_device *udev, int iface_index, int alt_index) { ... USBD_CLR_IFACE_NO_PROBE(udev, iface_index); ... } Make sure new variable is checked: usbd_status usbd_probe_and_attach(struct device *parent, int port, struct usbd_port *up) { ... if((USBD_GET_IFACE_NO_PROBE(udev, i) == 0) && (udev->subdevs[i] == NULL) && (device_probe_and_attach(bdev) == 0)) { ... } Update existing code, that uses old mechanism: for (i = 0; i < uaa->nifaces; i++) { if (uaa->ifaces[i] != NULL) { id = usbd_get_interface_descriptor( uaa->ifaces[i]); if (id != NULL && id->bInterfaceNumber == data_ifcno) { sc->cdce_data_iface = uaa->ifaces[i]; uaa->ifaces[i] = NULL; } } } New code: for(i = 0;; i++) { iface = usbd_get_iface(udev, i); if(iface == NULL) { break; } id = usbd_get_interface_descriptor(iface); if(id && (id->bInterfaceNumber == data_ifcno)) { sc->cdce_data_iface = iface; USBD_SET_IFACE_NO_PROBE(udev, i); } } Then remove "nifaces" and "ifaces" from "struct usb_attach_arg". >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-usb@FreeBSD.ORG Tue May 10 12:00:35 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9331A16A4D3 for ; Tue, 10 May 2005 12:00:35 +0000 (GMT) Received: from n2.nomadiclab.com (n2.nomadiclab.com [193.234.219.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 11F2B43D6A for ; Tue, 10 May 2005 12:00:35 +0000 (GMT) (envelope-from teemu@rinta-aho.org) Received: from [193.234.219.42] (n42.nomadiclab.com [193.234.219.42]) by n2.nomadiclab.com (Postfix) with ESMTP id 38170212CB0 for ; Tue, 10 May 2005 15:00:33 +0300 (EEST) Message-ID: <4280A261.40705@rinta-aho.org> Date: Tue, 10 May 2005 15:00:33 +0300 From: Teemu Rinta-aho User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-usb@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Patches for Option Globetrotter 3G/GPRS PC card X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 12:00:35 -0000 Hi all, I patched ubsa.c and usbdevs slightly to support my Option Globetrotter 3G/GPRS PC card, which uses the ubsa driver. The card works fine, tested with both GPRS and UMTS. The kernel will crash, however, if the card is removed. I don't know a solution to that problem (yet). Patches can be found at: http://www.rinta-aho.org/docs/option3g/option.html I'm currently working on NetBSD 3.99.3, it crashes already when inserting the card... BR, Teemu -- teemu@rinta-aho.org -+- http://www.rinta-aho.org From owner-freebsd-usb@FreeBSD.ORG Tue May 10 12:45:42 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B6CEF16A4CE; Tue, 10 May 2005 12:45:42 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9091443D49; Tue, 10 May 2005 12:45:42 +0000 (GMT) (envelope-from arved@FreeBSD.org) Received: from freefall.freebsd.org (arved@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4ACjgXN045760; Tue, 10 May 2005 12:45:42 GMT (envelope-from arved@freefall.freebsd.org) Received: (from arved@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4ACjghH045756; Tue, 10 May 2005 12:45:42 GMT (envelope-from arved) Date: Tue, 10 May 2005 12:45:42 GMT From: Tilman Linneweh Message-Id: <200505101245.j4ACjghH045756@freefall.freebsd.org> To: arved@FreeBSD.org, freebsd-i386@FreeBSD.org, freebsd-usb@FreeBSD.org Subject: Re: usb/80628: recent USB MFCs cause panics X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 12:45:42 -0000 Synopsis: recent USB MFCs cause panics Responsible-Changed-From-To: freebsd-i386->freebsd-usb Responsible-Changed-By: arved Responsible-Changed-When: Tue May 10 12:45:16 GMT 2005 Responsible-Changed-Why: Over to usb mailinglist http://www.freebsd.org/cgi/query-pr.cgi?pr=80628 From owner-freebsd-usb@FreeBSD.ORG Tue May 10 13:00:23 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 539AE16A4D0 for ; Tue, 10 May 2005 13:00:23 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 214C243D88 for ; Tue, 10 May 2005 13:00:23 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4AD0N0I046457 for ; Tue, 10 May 2005 13:00:23 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4AD0MPj046456; Tue, 10 May 2005 13:00:22 GMT (envelope-from gnats) Date: Tue, 10 May 2005 13:00:22 GMT Message-Id: <200505101300.j4AD0MPj046456@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Julian Elischer Subject: Re: usb/80685: panic in usb_cold_explore() at begining X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Julian Elischer List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 13:00:23 -0000 The following reply was made to PR usb/80685; it has been noted by GNATS. From: Julian Elischer To: "Richard S. Conto" Cc: freebsd-gnats-submit@freebsd.org Subject: Re: usb/80685: panic in usb_cold_explore() at begining Date: Tue, 10 May 2005 06:00:08 -0700 Richard S. Conto wrote: >>Number: 80685 >>Category: usb >>Synopsis: panic in usb_cold_explore() at begining >>Confidential: no >>Severity: critical >>Priority: low >>Responsible: freebsd-usb >>State: open >>Quarter: >>Keywords: >>Date-Required: >>Class: sw-bug >>Submitter-Id: current-users >>Arrival-Date: Fri May 06 01:50:09 GMT 2005 >>Closed-Date: >>Last-Modified: >>Originator: Richard S. Conto >>Release: 4.11-STABLE i386 >>Organization: >>Environment: > > FreeBSD toolbox.family 4.11-STABLE FreeBSD 4.11-STABLE #0: Sun Jan 23 12:14:05 EST 2005 root@toolbox.family:/usr/src/sys/compile/TOOLBOX i386 > > >>Description: > > During boot, I get a panic in "usb_cold_explore". > > IP packet filtering initialized, divert disabled, rule-based forwarding enabled, > default to accept, logging limited to 100 packets/entry by default > panic: usb_cold_explore: busses to explore when !cold > > A "boot -v" doesn't show any more detail to me, and I can't capture the output in any event. > > This machine is rather old and slow. I suspect timing issues. > I think "dmesg" explains my machine best: > > Timecounter "i8254" frequency 1193182 Hz > CPU: Pentium/P54C (119.75-MHz 586-class CPU) > Origin = "GenuineIntel" Id = 0x526 Stepping = 6 > Features=0x1bf > real memory = 100663296 (98304K bytes) > avail memory = 92835840 (90660K bytes) > > I recently "cvsup"'d this system, so the "uname -a" for Environment is > somewhat misleading. This happens with a version as recently updated as May 3. > > I haven't tried removing the USB card. If I could disable the usb support > and probing with /boot/loader.conf, I would. > > >>How-To-Repeat: > > Boot my old and creaky system > >>Fix: > > > >>Release-Note: >>Audit-Trail: >>Unformatted: I have seen this and can duplicate it. I will try figure out a fix in the next few days.. it does work correctly ifyou plug the device in after boot. I do know the reason but not yet the fix. > > _______________________________________________ > freebsd-usb@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-usb > To unsubscribe, send any mail to "freebsd-usb-unsubscribe@freebsd.org" From owner-freebsd-usb@FreeBSD.ORG Tue May 10 13:03:55 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B4B6016A4CE; Tue, 10 May 2005 13:03:55 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 84BEE43D70; Tue, 10 May 2005 13:03:55 +0000 (GMT) (envelope-from arved@FreeBSD.org) Received: from freefall.freebsd.org (arved@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4AD3tGn046647; Tue, 10 May 2005 13:03:55 GMT (envelope-from arved@freefall.freebsd.org) Received: (from arved@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4AD3tx2046643; Tue, 10 May 2005 13:03:55 GMT (envelope-from arved) Date: Tue, 10 May 2005 13:03:55 GMT From: Tilman Linneweh Message-Id: <200505101303.j4AD3tx2046643@freefall.freebsd.org> To: arved@FreeBSD.org, freebsd-i386@FreeBSD.org, freebsd-usb@FreeBSD.org Subject: Re: usb/79269: USB ohci da0 plug/unplug causes crashes and lockups. X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 13:03:55 -0000 Synopsis: USB ohci da0 plug/unplug causes crashes and lockups. Responsible-Changed-From-To: freebsd-i386->freebsd-usb Responsible-Changed-By: arved Responsible-Changed-When: Tue May 10 13:03:37 GMT 2005 Responsible-Changed-Why: Over to usb Mailinglist http://www.freebsd.org/cgi/query-pr.cgi?pr=79269 From owner-freebsd-usb@FreeBSD.ORG Tue May 10 13:16:16 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8450B16A4CE; Tue, 10 May 2005 13:16:16 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5DBF143D66; Tue, 10 May 2005 13:16:16 +0000 (GMT) (envelope-from arved@FreeBSD.org) Received: from freefall.freebsd.org (arved@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4ADGGIP051306; Tue, 10 May 2005 13:16:16 GMT (envelope-from arved@freefall.freebsd.org) Received: (from arved@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4ADGG4M051302; Tue, 10 May 2005 13:16:16 GMT (envelope-from arved) Date: Tue, 10 May 2005 13:16:16 GMT From: Tilman Linneweh Message-Id: <200505101316.j4ADGG4M051302@freefall.freebsd.org> To: arved@FreeBSD.org, freebsd-bugs@FreeBSD.org, freebsd-usb@FreeBSD.org Subject: Re: kern/79893: New usbdevs/umass quirks derived from Linux X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 13:16:16 -0000 Synopsis: New usbdevs/umass quirks derived from Linux Responsible-Changed-From-To: freebsd-bugs->freebsd-usb Responsible-Changed-By: arved Responsible-Changed-When: Tue May 10 13:16:03 GMT 2005 Responsible-Changed-Why: over to USB Mailinglist http://www.freebsd.org/cgi/query-pr.cgi?pr=79893 From owner-freebsd-usb@FreeBSD.ORG Tue May 10 18:00:25 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ADCCF16A4E8 for ; Tue, 10 May 2005 18:00:25 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 718EC43DB2 for ; Tue, 10 May 2005 18:00:25 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4AI0OPY087780 for ; Tue, 10 May 2005 18:00:24 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4AI0O3F087777; Tue, 10 May 2005 18:00:24 GMT (envelope-from gnats) Resent-Date: Tue, 10 May 2005 18:00:24 GMT Resent-Message-Id: <200505101800.j4AI0O3F087777@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, hselasky@c2i.net Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 824F016A4CE for ; Tue, 10 May 2005 17:51:11 +0000 (GMT) Received: from swip.net (mailfe08.swip.net [212.247.154.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4980243D60 for ; Tue, 10 May 2005 17:51:10 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from mp-217-228-222.daxnet.no ([193.217.228.222] verified) by mailfe08.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 164624815 for FreeBSD-gnats-submit@freebsd.org; Tue, 10 May 2005 19:51:08 +0200 Message-Id: <200505101951.52740.hselasky@c2i.net> Date: Tue, 10 May 2005 19:51:51 +0200 From: Hans Petter Selasky To: FreeBSD-gnats-submit@FreeBSD.org Subject: usb/80862: USB locking issues X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 18:00:25 -0000 >Number: 80862 >Category: usb >Synopsis: USB locking issues >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue May 10 18:00:24 GMT 2005 >Closed-Date: >Last-Modified: >Originator: HPS >Release: FreeBSD 6.0-CURRENT i386 >Organization: >Environment: System: FreeBSD 6.0-CURRENT FreeBSD 6.0-CURRENT #45: Mon Mar 21 15:40:17 CET 2005 root@:/usr/obj/usr/src/sys/custom i386 >Description: I'm not sure if "sysctl" calls are under Giant, but "uhub_child_xxxx()" are called from sysctl context, and should lock Giant or assert Giant. Secondly these calls should not sleep, because then Giant will be exited, and the "usb_event_thread()" can detach the USB-device meanwhile. >How-To-Repeat: >Fix: In the file "/sys/dev/usb/uhub.c": uhub_child_location_str() { ... mtx_lock(&Giant); /* missing */ ... mtx_unlock(&Giant); } uhub_child_pnpinfo_str() { ... mtx_lock(&Giant); /* missing */ This must be moved into "usbd_new_device()", because it can sleep: serial[0] = '\0'; (void)usbd_get_string(dev, dev->ddesc.iSerialNumber, &serial[0]); Instead something like: strcpy(&serial[0], &dev->serial[0]); must be used. Or just replace "serial" with "dev->serial". ... mtx_unlock(&Giant); } usbd_new_device() { ... udev->serial[0] = '\0'; (void)usbd_get_string(dev, udev->ddesc.iSerialNumber, &udev->serial[0] /* nice with a length parameter here to limit the length of the serial number */); /* format checking */ for(i = 0;;i++) { if(udev->serial[i] == '\0') break; if(udev->serial[i] == '\"') udev->serial[i] = ' '; if(udev->serial[i] == '\n') udev->serial[i] = ' '; } ... } Something else: Should allow root hub to detach: static driver_t uhubroot_driver = { ... DEVMETHOD(device_detach, uhub_detach), ... } >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-usb@FreeBSD.ORG Tue May 10 20:06:10 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0FEEF16A4CE for ; Tue, 10 May 2005 20:06:10 +0000 (GMT) Received: from sep.oldach.net (sep.oldach.net [194.180.25.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id C6D4643D2F for ; Tue, 10 May 2005 20:06:06 +0000 (GMT) (envelope-from hmo@sep.oldach.net) Received: from sep.oldach.net (localhost [127.0.0.1])j4AK5onq001380 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 May 2005 22:05:51 +0200 (CEST) (envelope-from hmo@sep.oldach.net) Received: (from hmo@localhost) by sep.oldach.net (8.13.3/8.13.3/Submit) id j4AK5iQm001369; Tue, 10 May 2005 22:05:44 +0200 (CEST) (envelope-from hmo) Message-Id: <200505102005.j4AK5iQm001369@sep.oldach.net> In-Reply-To: <427A955E.4070605@elischer.org> from Julian Elischer at "May 5, 2005 2:51:26 pm" To: julian@elischer.org (Julian Elischer) Date: Tue, 10 May 2005 22:05:43 +0200 (CEST) From: usbcrash@oldach.net (Helge Oldach) X-Message-Flag: No HTML mail please MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 0.84, clamav-milter version 0.84e on sep.oldach.net X-Virus-Status: Clean cc: usb@freebsd.org Subject: Re: recent USB MFCs cause panics X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 20:06:10 -0000 Julian, > maybe the answer is to comment out > > DEVMETHOD(bus_child_detached, uhub_child_detached), > > at line 134 of uhub.c > DEVMETHOD(bus_child_detached, uhub_child_detached), > It's kind of hard for me to...... (sudden thought appears) Did comment that line out. Precisely: --- uhub.c.ctm Wed May 4 15:58:48 2005 +++ uhub.c Tue May 10 21:27:38 2005 @@ -131,7 +131,7 @@ #else USB_DECLARE_DRIVER_INIT(uhub, DEVMETHOD(bus_driver_added, uhub_driver_added), - DEVMETHOD(bus_child_detached, uhub_child_detached), + /* DEVMETHOD(bus_child_detached, uhub_child_detached), */ DEVMETHOD(device_suspend, bus_generic_suspend), DEVMETHOD(device_resume, bus_generic_resume), DEVMETHOD(device_shutdown, bus_generic_shutdown) But the result is still the same: umass0: BBB bulk-in clear stall failed, STALLED umass0: BBB bulk-out clear stall failed, STALLED umass0: BBB reset failed, STALLED umass0: BBB bulk-in clear stall failed, STALLED umass0: BBB bulk-out clear stall failed, STALLED umass0: BBB reset failed, STALLED umass0: at uhub1 port 2 (addr 5) disconnected umass0: detached (null): BBB bulk-in clear stall failed, CANCELLED (null): BBB bulk-out clear stall failed, CANCELLED panic: (null): Unknown state 0 > DUH you are running this in a hub aren't you? Yes: uhub1: Cypress Semiconductor Slim Hub, class 9/0, rev 2.00/0.08, addr 3 uhub1: 4 ports with 4 removable, self powered I'm now back to the situation before your MFC. That works reliably. I would suggest to back this out for the time being. Regards, Helge From owner-freebsd-usb@FreeBSD.ORG Tue May 10 22:10:05 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 81FFD16A4CE for ; Tue, 10 May 2005 22:10:05 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4FB0E43D7F for ; Tue, 10 May 2005 22:10:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4AMA5Le026205 for ; Tue, 10 May 2005 22:10:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4AMA55e026204; Tue, 10 May 2005 22:10:05 GMT (envelope-from gnats) Date: Tue, 10 May 2005 22:10:05 GMT Message-Id: <200505102210.j4AMA55e026204@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Dan Olson Subject: Re: usb/80361: mounting of usb-stick fails X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Dan Olson List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 22:10:05 -0000 The following reply was made to PR usb/80361; it has been noted by GNATS. From: Dan Olson To: bug-followup@FreeBSD.org, fbusse@gmx.de Cc: Subject: Re: usb/80361: mounting of usb-stick fails Date: Tue, 10 May 2005 17:01:02 -0500 I may have access to a patch that will fix this. As root with the usb stick in, run usbdev -v. This shows the vendor and product id. A reference email to freebsd-current is at: http://lists.freebsd.org/pipermail/freebsd-current/2005-March/047827.html Thanks Dan From owner-freebsd-usb@FreeBSD.ORG Wed May 11 06:20:50 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0A4C816A4CE for ; Wed, 11 May 2005 06:20:50 +0000 (GMT) Received: from web53602.mail.yahoo.com (web53602.mail.yahoo.com [206.190.37.35]) by mx1.FreeBSD.org (Postfix) with SMTP id 822C243D31 for ; Wed, 11 May 2005 06:20:49 +0000 (GMT) (envelope-from algorist2000@yahoo.com) Received: (qmail 37523 invoked by uid 60001); 11 May 2005 06:20:48 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=0T/GWts/bETdcE+jo0oT2rtrr4fpU4UYIfLo68tUGNTPDvYZPZTufnL/pPnWCI/arY+CuGArgSQHpU/pZKrJQp+SDSOs97G+Ghaw1VR36GvPoh9Wl/F2nwcb4JKuNxIDbPr/ayIAPMO5VOvSYWedgS6YId/kaa8RdfPPnL1ibuw= ; Message-ID: <20050511062048.37521.qmail@web53602.mail.yahoo.com> Received: from [61.48.121.93] by web53602.mail.yahoo.com via HTTP; Tue, 10 May 2005 23:20:48 PDT Date: Tue, 10 May 2005 23:20:48 -0700 (PDT) From: paradox To: freebsd-usb@FreeBSD.org In-Reply-To: 6667 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: a problem about ugen.c X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2005 06:20:50 -0000 Thanks,all problems are solved. The usb key device has two hardware bugs, one is the CLEAR_FEATURE packet problem just like you said, the other is an error in the toggle bit changing. after I change the usb-subr.c, I can use ugen.ko to read and write the device directly. but when I read data from the device(low speed, interrupt pipe),the data length I read must be less than the max packet size,or some data will be lost. The read command only read data in one interval. but I thought the standard read function should read the data till all the data has been read or we got an incomplete packet. Am I right? --- Hans Petter Selasky wrote: > On Saturday 30 April 2005 09:00, paradox wrote: > It might be the CLEAR_FEATURE or clear stall packet > that does it. Some devices > will only work if clear stall is issued as a part of > a reset sequence. This > has been discussed before on this list. > > In the file "/sys/dev/usb/usb_subr.c" in the > function "usbd_setup_pipe" could > you change: > > err = usbd_clear_endpoint_stall(p); > > into > > err = 0; /* usbd_clear_endpoint_stall(p); */ > > Then recompile the USB module: > "make -C/sys/modules/usb depend all install clean" > > Reboot and see if there is any change. > > Yours > HPS > __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ From owner-freebsd-usb@FreeBSD.ORG Wed May 11 11:32:11 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8F81B16A4CE for ; Wed, 11 May 2005 11:32:11 +0000 (GMT) Received: from swip.net (mailfe02.swip.net [212.247.154.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id BFCAF43D60 for ; Wed, 11 May 2005 11:32:10 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: Y1QAsIk9O44SO+J/q9KNyQ== Received: from mp-216-46-26.daxnet.no ([193.216.46.26] verified) by mailfe02.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 363565659; Wed, 11 May 2005 13:32:08 +0200 From: Hans Petter Selasky To: freebsd-usb@freebsd.org, paradox Date: Wed, 11 May 2005 13:32:52 +0200 User-Agent: KMail/1.7 References: <20050511062048.37521.qmail@web53602.mail.yahoo.com> In-Reply-To: <20050511062048.37521.qmail@web53602.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200505111332.53170.hselasky@c2i.net> Subject: Re: a problem about ugen.c X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2005 11:32:11 -0000 On Wednesday 11 May 2005 08:20, paradox wrote: > Thanks,all problems are solved. > > The usb key device has two hardware bugs, one is the > CLEAR_FEATURE packet problem just like you said, the > other is an error in the toggle bit changing. > > after I change the usb-subr.c, I can use ugen.ko to > read and write the device directly. > > but when I read data from the device(low speed, > interrupt pipe),the data length I read must be less > than the max packet size,or some data will be lost. > The read command only read data in one interval. but I > thought the standard read function should read the > data till all the data has been read or we got an > incomplete packet. Am I right? The current ugen implementation for INTERRUPT transfers is going to loose packet synchronization if too many packets arrive at the same time, because it uses a ring-buffer to buffer data. Maybe it should use mbufs instead? You read data from an ugen INTERRUPT endpoint like this: length = read(fd, buf, sizeof(buf)); /* got one packet (should be like this) */ if(length == -1) error; else got length bytes of data (and not sizeof(buf) bytes). buf should have a size greater than maxpacket size, and if (length == sizeof(buf)) packet synchronization will be lost until the buffer drains. This should be fixed in the ugen driver. > > --- Hans Petter Selasky wrote: > > On Saturday 30 April 2005 09:00, paradox wrote: > > > > It might be the CLEAR_FEATURE or clear stall packet > > that does it. Some devices > > will only work if clear stall is issued as a part of > > a reset sequence. This > > has been discussed before on this list. > > > > In the file "/sys/dev/usb/usb_subr.c" in the > > function "usbd_setup_pipe" could > > you change: > > > > err = usbd_clear_endpoint_stall(p); > > > > into > > > > err = 0; /* usbd_clear_endpoint_stall(p); */ I see that the memory allocated is not zeroed, so you might have to add: (p->methods->cleartoggle)(p); after err = 0; > > > > Then recompile the USB module: > > "make -C/sys/modules/usb depend all install clean" > > > > Reboot and see if there is any change. > > --HPS From owner-freebsd-usb@FreeBSD.ORG Wed May 11 23:59:52 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5D58316A515 for ; Wed, 11 May 2005 23:59:52 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 83DA443D7C for ; Wed, 11 May 2005 23:59:51 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.13.3/8.13.1) with ESMTP id j4BNvN9b092520; Wed, 11 May 2005 17:57:23 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 11 May 2005 17:58:30 -0600 (MDT) Message-Id: <20050511.175830.58826830.imp@bsdimp.com> To: hselasky@c2i.net From: "M. Warner Losh" In-Reply-To: <200505120058.51834.hselasky@c2i.net> References: <200505112228.49253.hselasky@c2i.net> <20050511.143322.85324196.imp@bsdimp.com> <200505120058.51834.hselasky@c2i.net> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: usb@freebsd.org cc: dga+@cs.cmu.edu Subject: Re: Panic when removing Airprime PC5220 card (usb hub). X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2005 23:59:52 -0000 In message: <200505120058.51834.hselasky@c2i.net> Hans Petter Selasky writes: : On Wednesday 11 May 2005 22:33, Warner Losh wrote: : > From: Hans Petter Selasky : > Subject: Re: Panic when removing Airprime PC5220 card (usb hub). : > Date: Wed, 11 May 2005 22:28:48 +0200 : > : > > : > > The patch for the free it twice problem, in -current, is just pushing the : > > problem ahead. You need to implement that "free_subdev" argument passed : > > to "usbd_free_device" like I suggested too. Because there is no guarantee : > > that a parent device will call "device_detach()" before : > > "device_delete_child()" on a device with USB-subdevices somewhere, which : > > is the problem! : > : > Actually, there is. newbus requires that device_detach be called : > before device_delete_child(). If something isn't playing by those : > rules, then it will cause problems to other parts of the system that : > rely on that behavior. Children must be in the detache state before : > they can be deleted from the newbus tree. : : If that is so, then "device_delete_child()" must be consequent and post a : warning if there are any children to detach ? Because "device_delete_child()" : will call "device_detach()" too, detaching children before detaching parents. I believe that's a bug. Certainly all drivers I'm aware of assume that they are still in the tree when they are detached, and they assume that detach will be called to free up resources. We should add a warning to catch these sorts of things. : But I think the current USB-code depends on the old behaviour. I just did a : "cat" and found the following in "if_aue.c": : : /* : * Do MII setup. : * NOTE: Doing this causes child devices to be attached to us, : * which we would normally disconnect at in the detach routine : * using device_delete_child(). However the USB code is set up : * such that when this driver is removed, all children devices : * are removed as well. In effect, the USB code ends up detaching : * all of our children for us, so we don't have to do is ourselves : * in aue_detach(). It's important to point this out since if : * we *do* try to detach the child devices ourselves, we will : * end up getting the children deleted twice, which will crash : * the system. : */ : : It is better that the ones writing USB drivers gets used to that subdevices : created are detached by "uhub". That saves code. Now there is a race : condition where the child of "if_aue" can access the softc before it is being : detached. This comment is wrong in some ways. The old usb code deletes the children, so that any dangling references to them will cause a crash. Detaching a detached device is a nop. However, referencing a cached pointer to a child is a crash waiting to happen. Once upon a time, drivers would cache these. It is still done, but less frequently than before. : > I agree that it does push the problem ahead a little. That's why I've : > been working on a more general cleanup that doesn't duplicate : > information in multiple places. The NetBSD code ill fit the newbus : > abstraction and many of the kludges to try to make it fit need to : > die. The whole subdev structure is duplicative and shouldn't be used : > on FreeBSD at all, imho. : : The subdev structure shouldn't be used like it is, but it should be allowed to : cache device pointers. Sure you can put some information into the "uaa" : structure, but that is not going to save memory. Actually, the subdev structure exists because we have a many to one relationship between the usbd_device entries and the device_t entries. Usually, in newbus land, when this happens, an intermediate class is inserted into the mix (see pccard for an example of multi-function devices, which is what the interfaces are, kinda, in usbland). The usb code is special in that drivers are allowed to eat the entire device *OR* individual interfaces (or even a subset of interfaces), while in other parts of the tree the option of eating the entire device is not given. It isn't so much an issue of saving memory, but instead of properly organzing the information. You were correct that this issue dogs attempts to support kldload/unload of drivers since if another device grabs an interface (say because it is a generic modem), you can't then load a device driver that grabs the entire device. ugen is the tip of the iceburg here because other devices may grab things generically too, and that makes it harder to load complex devices... I'm not entirely sure the best way to proceed. : Maybe I mixed up the function names, because I replaced : "usb_disconnect_port()" with "usbd_free_device()" in my USB-driver, but I : counted "usb_disconnect_port()" three times in the existing USB-driver, and : if you add three characters to each call, it is going to be less patching : than if you add "device_detach()", not just one place, but several places, : and not to mention break the existing detach behavior. I'm having trouble understanding the point you are trying to make here. Can you restate it please? : So how is it going to be? I'm not entirely sure. I've been playing around with some changes and have stumbled into understanding why things are the way they are better than I did before. I think that my understanding of the problem is still incomplete, so I'll need to do some more studying and experimenting before I'll have a good idea of how to proceed. # This was a private reply, but I think it is useful to have it on the # list and HPS said it was OK to post. Warner From owner-freebsd-usb@FreeBSD.ORG Thu May 12 09:40:02 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DE0E816A4D0 for ; Thu, 12 May 2005 09:40:02 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B4D4C43D6D for ; Thu, 12 May 2005 09:40:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4C9e2YQ075845 for ; Thu, 12 May 2005 09:40:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4C9e29n075844; Thu, 12 May 2005 09:40:02 GMT (envelope-from gnats) Resent-Date: Thu, 12 May 2005 09:40:02 GMT Resent-Message-Id: <200505120940.j4C9e29n075844@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, KOIE Hidetaka Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 525F716A4CE for ; Thu, 12 May 2005 09:34:11 +0000 (GMT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 241B443D45 for ; Thu, 12 May 2005 09:34:11 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j4C9Y46F061834 for ; Thu, 12 May 2005 09:34:04 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id j4C9Y4I0061833; Thu, 12 May 2005 09:34:04 GMT (envelope-from nobody) Message-Id: <200505120934.j4C9Y4I0061833@www.freebsd.org> Date: Thu, 12 May 2005 09:34:04 GMT From: KOIE Hidetaka To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: usb/80935: uvisor.c is not work with CLIE TH55. X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2005 09:40:03 -0000 >Number: 80935 >Category: usb >Synopsis: uvisor.c is not work with CLIE TH55. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu May 12 09:40:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: KOIE Hidetaka >Release: FreeBSD 6.0-CURRENT >Organization: Surigiken >Environment: FreeBSD sakura.suri.co.jp 6.0-CURRENT FreeBSD 6.0-CURRENT #1: Wed May 11 14:14:01 JST 2005 koie@sakura.suri.co.jp:/usr/obj/usr/src/sys/SAKURA i386 >Description: New uvisor.c (rev 1.24) is not work with TH55. >How-To-Repeat: Add to usbdevs: product SONY CLIE_TH55 0x0144 Sony Clie th55. before try hotsync. >Fix: #define UVISOR_GET_PALM_INFORMATION_LEN 0x14 >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-usb@FreeBSD.ORG Thu May 12 13:47:21 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5261F16A4CE for ; Thu, 12 May 2005 13:47:21 +0000 (GMT) Received: from swip.net (mailfe06.swip.net [212.247.154.161]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5EB7243D75 for ; Thu, 12 May 2005 13:47:20 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: Y1QAsIk9O44SO+J/q9KNyQ== Received: from mp-216-46-97.daxnet.no ([193.216.46.97] verified) by mailfe06.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 353385979; Thu, 12 May 2005 15:47:17 +0200 From: Hans Petter Selasky To: "M. Warner Losh" Date: Thu, 12 May 2005 15:48:01 +0200 User-Agent: KMail/1.7 References: <200505112228.49253.hselasky@c2i.net> <200505120058.51834.hselasky@c2i.net> <20050511.175830.58826830.imp@bsdimp.com> In-Reply-To: <20050511.175830.58826830.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200505121548.02651.hselasky@c2i.net> cc: usb@freebsd.org cc: dga+@cs.cmu.edu Subject: Re: Panic when removing Airprime PC5220 card (usb hub). X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2005 13:47:21 -0000 On Thursday 12 May 2005 01:58, M. Warner Losh wrote: > In message: <200505120058.51834.hselasky@c2i.net> > > Hans Petter Selasky writes: > : On Wednesday 11 May 2005 22:33, Warner Losh wrote: > : > From: Hans Petter Selasky > : > Subject: Re: Panic when removing Airprime PC5220 card (usb hub). > : > Date: Wed, 11 May 2005 22:28:48 +0200 > : > > : > > The patch for the free it twice problem, in -current, is just pushing > : > > the problem ahead. You need to implement that "free_subdev" argument > : > > passed to "usbd_free_device" like I suggested too. Because there is > : > > no guarantee that a parent device will call "device_detach()" before > : > > "device_delete_child()" on a device with USB-subdevices somewhere, > : > > which is the problem! > : > > : > Actually, there is. newbus requires that device_detach be called > : > before device_delete_child(). If something isn't playing by those > : > rules, then it will cause problems to other parts of the system that > : > rely on that behavior. Children must be in the detache state before > : > they can be deleted from the newbus tree. > : > : If that is so, then "device_delete_child()" must be consequent and post a > : warning if there are any children to detach ? Because > : "device_delete_child()" will call "device_detach()" too, detaching > : children before detaching parents. > > I believe that's a bug. Certainly all drivers I'm aware of assume > that they are still in the tree when they are detached, and they > assume that detach will be called to free up resources. We should add > a warning to catch these sorts of things. > > : But I think the current USB-code depends on the old behaviour. I just did > : a "cat" and found the following in "if_aue.c": > : > : /* > : * Do MII setup. > : * NOTE: Doing this causes child devices to be attached to us, > : * which we would normally disconnect at in the detach routine > : * using device_delete_child(). However the USB code is set up > : * such that when this driver is removed, all children devices > : * are removed as well. In effect, the USB code ends up detaching > : * all of our children for us, so we don't have to do is > : ourselves * in aue_detach(). It's important to point this out since if * > : we *do* try to detach the child devices ourselves, we will * end up > : getting the children deleted twice, which will crash * the system. > : */ > : > : It is better that the ones writing USB drivers gets used to that > : subdevices created are detached by "uhub". That saves code. Now there is > : a race condition where the child of "if_aue" can access the softc before > : it is being detached. > > This comment is wrong in some ways. The old usb code deletes the > children, so that any dangling references to them will cause a crash. > Detaching a detached device is a nop. However, referencing a cached > pointer to a child is a crash waiting to happen. Once upon a time, > drivers would cache these. It is still done, but less frequently than > before. One needs a mechanism to invalidate the cache. > > : > I agree that it does push the problem ahead a little. That's why I've > : > been working on a more general cleanup that doesn't duplicate > : > information in multiple places. The NetBSD code ill fit the newbus > : > abstraction and many of the kludges to try to make it fit need to > : > die. The whole subdev structure is duplicative and shouldn't be used > : > on FreeBSD at all, imho. > : > : The subdev structure shouldn't be used like it is, but it should be > : allowed to cache device pointers. Sure you can put some information into > : the "uaa" structure, but that is not going to save memory. > > Actually, the subdev structure exists because we have a many to one > relationship between the usbd_device entries and the device_t entries. > Usually, in newbus land, when this happens, an intermediate class is > inserted into the mix (see pccard for an example of multi-function > devices, which is what the interfaces are, kinda, in usbland). The "pccard" driver will store device_t's in a separate structure (struct pccard_function) too. For example I found "pf->dev = child;". But the difference is that the "pccard" driver will pre-allocate devices for all "interfaces", and then probe those interfaces when a new driver is added. > The > usb code is special in that drivers are allowed to eat the entire > device *OR* individual interfaces (or even a subset of interfaces), > while in other parts of the tree the option of eating the entire > device is not given. It isn't so much an issue of saving memory, but > instead of properly organzing the information. You were correct that > this issue dogs attempts to support kldload/unload of drivers since if > another device grabs an interface (say because it is a generic modem), > you can't then load a device driver that grabs the entire device. > ugen is the tip of the iceburg here because other devices may grab > things generically too, and that makes it harder to load complex > devices... I think this problem can be solved. Here are the three driver types listed: 1. special drivers 2. standard interface drivers 3. the generic driver If a device using "standard interface drivers"(2) or "the generic driver"(3) is present, and a driver of type "special drivers"(1) is loaded, then at the time "usbd_set_config_index()" is called all devices of type "standard interface drivers" or "the generic driver"(3) are deleted. Maybe the device_t that is calling "usbd_set_config_index()" has to be passed as an argument, so that "usbd_set_config_index()" doesn't delete the calling device_t. The reason this will work is that the configuration index has to be set before any pipes can be used. If a device using "the generic driver"(3) is present, and a "standard interface driver"(2) is loaded, this is somewhat more difficult. But one could make some assumptions. For example: The configuration value must be the same as the one currently selected. Then one could loop over the ifaces again, and probe/attach for new devices. What is the problem allowing ugen attached at the same time as "standard interface drivers"(2). This leads to some problems with "usbd_pipe_abort"/"usbd_pipe_close". When two devices attach at the same "usbd_device" they might setup transfers on the same pipe. So the last device calling usbd_pipe_xxxx is going to close all setup transfers. Therefore I suggest, and it is not the only reason, that all "usbd_pipe_xxx" functions be removed. And instead one "setup"/"unsetup" transfers. Then a device will only unsetup its setup transfers. This is going to work fine, because all transfer types ISOC/BULK/INTR/CTRL allow more than one transfer queued at a time. This will also require that the clear-stall mechanism be changed. There is no problem having "the generic driver"(3) and "standard interface drivers"(2) attached at the same time as long as ugen doesn't set a new configuration value during attach unless necessary. Then one can access pipes that have no driver? > > I'm not entirely sure the best way to proceed. > > : Maybe I mixed up the function names, because I replaced > : "usb_disconnect_port()" with "usbd_free_device()" in my USB-driver, but I > : counted "usb_disconnect_port()" three times in the existing USB-driver, > : and if you add three characters to each call, it is going to be less > : patching than if you add "device_detach()", not just one place, but > : several places, and not to mention break the existing detach behavior. > > I'm having trouble understanding the point you are trying to make > here. Can you restate it please? change the existing code so that it looks like this: uhub_explore(usbd_device_handle dev) { ... usb_disconnect_port(up, USBDEV(sc->sc_dev), 1); ... } USB_DETACH(uhub) { ... usb_disconnect_port(rup, self, 0); ... } USB_DETACH(usb) { ... usb_disconnect_port(&sc->sc_port, self, 0); ... } usb_disconnect_port(struct usbd_port *up, device_ptr_t parent, u_int8_t free_subdev) { ... #ifdef __FreeBSD__ if (free_subdev) #endif config_detach(dev->subdevs[i], DETACH_FORCE); ... } #define config_detach(dev, flag) \ do { \ free(device_get_ivars(dev), M_USB); \ device_delete_child(device_get_parent(dev), dev); \ } while (0); device_delete_child(device_t dev, device_t child) { ... if(dev->flags & DF_PRE_DETACH) { if ((error = device_detach(child)) != 0) return (error); } /* remove children first */ while ( (grandchild = TAILQ_FIRST(&child->children)) ) { error = device_delete_child(child, grandchild); if (error) return (error); } if(!(dev->flags & DF_PRE_DETACH)) /* default */ { if ((error = device_detach(child)) != 0) return (error); } ... } device_probe_and_attach(device_t dev) { ... dev->flags &= ~DF_PRE_DETACH; error = device_attach(dev); ... } device_set_pre_detach(device_t dev) { dev->flags |= DF_PRE_DETACH; } Then [USB-]devices that will detach its children, call "device_set_pre_detach()" during attach, and the problem is solved? --HPS From owner-freebsd-usb@FreeBSD.ORG Thu May 12 15:54:50 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0DA8416A4D0 for ; Thu, 12 May 2005 15:54:50 +0000 (GMT) Received: from swip.net (mailfe07.swip.net [212.247.154.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 169A043D86 for ; Thu, 12 May 2005 15:54:49 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: Y1QAsIk9O44SO+J/q9KNyQ== Received: from mp-216-47-40.daxnet.no ([193.216.47.40] verified) by mailfe07.swip.net (CommuniGate Pro SMTP 4.3c5) with ESMTP id 167235006; Thu, 12 May 2005 17:54:47 +0200 From: Hans Petter Selasky To: "M. Warner Losh" , usb@freebsd.org Date: Thu, 12 May 2005 17:55:32 +0200 User-Agent: KMail/1.7 References: <200505112228.49253.hselasky@c2i.net> <20050511.175830.58826830.imp@bsdimp.com> <200505121548.02651.hselasky@c2i.net> In-Reply-To: <200505121548.02651.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200505121755.32810.hselasky@c2i.net> Subject: Re: Panic when removing Airprime PC5220 card (usb hub). X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2005 15:54:50 -0000 On Thursday 12 May 2005 15:48, Hans Petter Selasky wrote: > On Thursday 12 May 2005 01:58, M. Warner Losh wrote: > > In message: <200505120058.51834.hselasky@c2i.net> > > > > Hans Petter Selasky writes: > > : On Wednesday 11 May 2005 22:33, Warner Losh wrote: Maybe something like this is better, so that memory doesn't leak. usb_disconnect_port(struct usbd_port *up, device_ptr_t parent, u_int8_t free_subdev) { ... #ifdef __FreeBSD__ config_detach(dev->subdevs[i], DETACH_FORCE, free_subdev); #else config_detach(dev->subdevs[i], DETACH_FORCE); #endif ... } #define config_detach(dev, flag, free_subdev) \ do { \ free(device_get_ivars(dev), M_USB); \ if(free_subdev) \ device_delete_child(device_get_parent(dev), dev); \ } while (0); --HPS From owner-freebsd-usb@FreeBSD.ORG Thu May 12 16:39:08 2005 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0769E16A4CE for ; Thu, 12 May 2005 16:39:08 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9230543D58 for ; Thu, 12 May 2005 16:39:07 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.13.3/8.13.1) with ESMTP id j4CGcXca005436; Thu, 12 May 2005 10:38:34 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 12 May 2005 10:39:43 -0600 (MDT) Message-Id: <20050512.103943.115908855.imp@bsdimp.com> To: hselasky@c2i.net From: "M. Warner Losh" In-Reply-To: <200505121755.32810.hselasky@c2i.net> References: <20050511.175830.58826830.imp@bsdimp.com> <200505121548.02651.hselasky@c2i.net> <200505121755.32810.hselasky@c2i.net> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: usb@freebsd.org Subject: Re: Panic when removing Airprime PC5220 card (usb hub). X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2005 16:39:08 -0000 In message: <200505121755.32810.hselasky@c2i.net> Hans Petter Selasky writes: : On Thursday 12 May 2005 15:48, Hans Petter Selasky wrote: : > On Thursday 12 May 2005 01:58, M. Warner Losh wrote: : > > In message: <200505120058.51834.hselasky@c2i.net> : > > : > > Hans Petter Selasky writes: : > > : On Wednesday 11 May 2005 22:33, Warner Losh wrote: : : Maybe something like this is better, so that memory doesn't leak. : : usb_disconnect_port(struct usbd_port *up, device_ptr_t parent, : u_int8_t free_subdev) : { : ... : #ifdef __FreeBSD__ : config_detach(dev->subdevs[i], DETACH_FORCE, free_subdev); : #else : config_detach(dev->subdevs[i], DETACH_FORCE); : #endif : ... : } : : #define config_detach(dev, flag, free_subdev) \ : do { \ : free(device_get_ivars(dev), M_USB); \ : if(free_subdev) \ : device_delete_child(device_get_parent(dev), dev); \ : } while (0); Apart from ugly ifdef, that might have some merit. We don't necessarily want to delete devices unless the hardware goes away. Warner From owner-freebsd-usb@FreeBSD.ORG Sat May 14 16:10:06 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 03EAC16A4CE for ; Sat, 14 May 2005 16:10:06 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CD59643D77 for ; Sat, 14 May 2005 16:10:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4EGA5q5045365 for ; Sat, 14 May 2005 16:10:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4EGA5am045364; Sat, 14 May 2005 16:10:05 GMT (envelope-from gnats) Date: Sat, 14 May 2005 16:10:05 GMT Message-Id: <200505141610.j4EGA5am045364@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Fridtjof Busse Subject: Re: usb/80361: mounting of usb-stick fails X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Fridtjof Busse List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2005 16:10:06 -0000 The following reply was made to PR usb/80361; it has been noted by GNATS. From: Fridtjof Busse To: bug-followup@FreeBSD.org, fbusse@gmx.de Cc: Subject: Re: usb/80361: mounting of usb-stick fails Date: Sat, 14 May 2005 18:04:39 +0200 This patch fixes the problem at least for me (Dell Memory Stick). The USB_PORT_POWERUP_DELAY didn't help me, but the patch works just fine. Any chance to get this into stable? From owner-freebsd-usb@FreeBSD.ORG Sat May 14 19:30:07 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5798916A4D0 for ; Sat, 14 May 2005 19:30:07 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3FCBF43D5F for ; Sat, 14 May 2005 19:30:07 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4EJU7JF069311 for ; Sat, 14 May 2005 19:30:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4EJU7ji069310; Sat, 14 May 2005 19:30:07 GMT (envelope-from gnats) Date: Sat, 14 May 2005 19:30:07 GMT Message-Id: <200505141930.j4EJU7ji069310@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: John Milford Subject: Re: usb/80685: panic in usb_cold_explore() at begining X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: John Milford List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2005 19:30:07 -0000 The following reply was made to PR usb/80685; it has been noted by GNATS. From: John Milford To: bug-followup@FreeBSD.org Cc: rsc@merit.edu Subject: Re: usb/80685: panic in usb_cold_explore() at begining Date: Sat, 14 May 2005 12:22:38 -0700 I have hit this too with 4.11-STABLE I cvsup'ed last night. My system is a Dual Athlon. If there is something I can do to help with this I'll take a shot at it. I say Julian had recommended some prints for debugging, and I added those, but without a serial console it is tough for me to see if they are getting printed early on. However the only print I can see is right before the panic, "HEY WE GOT HERE!". printf("HEY WE GOT HERE!\n"); KASSERT(cold || TAILQ_EMPTY(&usb_coldexplist), ("usb_cold_explore: busses to explore when !cold")); while (!TAILQ_EMPTY(&usb_coldexplist)) { sc = TAILQ_FIRST(&usb_coldexplist); TAILQ_REMOVE(&usb_coldexplist, sc, sc_coldexplist); printf("probing a USB 1.1 bus.\n"); With my old kernel (4.11-STABLE from end of Dec.) ohci0: mem 0xf1000000-0xf1000fff irq 10 at device 0.0 on pci2 usb0: OHCI version 1.0, legacy support usb0: on ohci0 usb0: USB revision 1.0 uhub0: AMD OHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 4 ports with 4 removable, self powered ums0: Logitech USB Receiver, rev 1.10/16.00, addr 2, iclass 3/1 ums0: 7 buttons and Z dir.