Fri Mar 9 00:12:11 2012 UTC ()
Restore parts of uhub_explore() needed to make usb_needs_reattach() work.


(jakllsch)
diff -r1.115 -r1.116 src/sys/dev/usb/uhub.c

cvs diff -r1.115 -r1.116 src/sys/dev/usb/uhub.c (expand / switch to unified diff)

--- src/sys/dev/usb/uhub.c 2012/03/05 16:14:03 1.115
+++ src/sys/dev/usb/uhub.c 2012/03/09 00:12:10 1.116
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uhub.c,v 1.115 2012/03/05 16:14:03 sborrill Exp $ */ 1/* $NetBSD: uhub.c,v 1.116 2012/03/09 00:12:10 jakllsch Exp $ */
2/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */ 2/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. 5 * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (lennart@augustsson.net) at 9 * by Lennart Augustsson (lennart@augustsson.net) at
10 * Carlstedt Research & Technology. 10 * Carlstedt Research & Technology.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE. 31 * POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34/* 34/*
35 * USB spec: http://www.usb.org/developers/docs/usbspec.zip 35 * USB spec: http://www.usb.org/developers/docs/usbspec.zip
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.115 2012/03/05 16:14:03 sborrill Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.116 2012/03/09 00:12:10 jakllsch Exp $");
40 40
41#include "opt_usb.h" 41#include "opt_usb.h"
42 42
43#include <sys/param.h> 43#include <sys/param.h>
44#include <sys/systm.h> 44#include <sys/systm.h>
45#include <sys/kernel.h> 45#include <sys/kernel.h>
46#include <sys/malloc.h> 46#include <sys/malloc.h>
47#include <sys/device.h> 47#include <sys/device.h>
48#include <sys/proc.h> 48#include <sys/proc.h>
49 49
50#include <sys/bus.h> 50#include <sys/bus.h>
51 51
52#include <dev/usb/usb.h> 52#include <dev/usb/usb.h>
@@ -454,28 +454,32 @@ uhub_explore(usbd_device_handle dev) @@ -454,28 +454,32 @@ uhub_explore(usbd_device_handle dev)
454 port); 454 port);
455 455
456 if (up->restartcnt++ < USBD_RESTART_MAX) 456 if (up->restartcnt++ < USBD_RESTART_MAX)
457 goto disco; 457 goto disco;
458 else 458 else
459 aprint_error_dev(sc->sc_dev, 459 aprint_error_dev(sc->sc_dev,
460 "port error, giving up port %d\n", 460 "port error, giving up port %d\n",
461 port); 461 port);
462 } 462 }
463 } 463 }
464 464
465 /* XXX handle overcurrent and resume events! */ 465 /* XXX handle overcurrent and resume events! */
466 466
467 if (!(change & UPS_C_CONNECT_STATUS)) 467 if (!reconnect && !(change & UPS_C_CONNECT_STATUS)) {
 468 /* No status change, just do recursive explore. */
 469 if (up->device != NULL && up->device->hub != NULL)
 470 up->device->hub->explore(up->device);
468 continue; 471 continue;
 472 }
469 473
470 /* We have a connect status change, handle it. */ 474 /* We have a connect status change, handle it. */
471 475
472 DPRINTF(("uhub_explore: status change hub=%d port=%d\n", 476 DPRINTF(("uhub_explore: status change hub=%d port=%d\n",
473 dev->address, port)); 477 dev->address, port));
474 usbd_clear_port_feature(dev, port, UHF_C_PORT_CONNECTION); 478 usbd_clear_port_feature(dev, port, UHF_C_PORT_CONNECTION);
475 /* 479 /*
476 * If there is already a device on the port the change status 480 * If there is already a device on the port the change status
477 * must mean that is has disconnected. Looking at the 481 * must mean that is has disconnected. Looking at the
478 * current connect status is not enough to figure this out 482 * current connect status is not enough to figure this out
479 * since a new unit may have been connected before we handle 483 * since a new unit may have been connected before we handle
480 * the disconnect. 484 * the disconnect.
481 */ 485 */