Deleted Added
full compact
usb_hub.c (217265) usb_hub.c (222786)
1/* $FreeBSD: head/sys/dev/usb/usb_hub.c 217265 2011-01-11 13:59:06Z jhb $ */
1/* $FreeBSD: head/sys/dev/usb/usb_hub.c 222786 2011-06-06 21:45:09Z hselasky $ */
2/*-
3 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
4 * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
5 * Copyright (c) 2008-2010 Hans Petter Selasky. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 227 unchanged lines hidden (view full) ---

237 goto done;
238 }
239
240 /* check if device should be re-enumerated */
241
242 if (child->flags.usb_mode == USB_MODE_HOST) {
243 usbd_enum_lock(child);
244 if (child->re_enumerate_wait) {
2/*-
3 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
4 * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
5 * Copyright (c) 2008-2010 Hans Petter Selasky. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 227 unchanged lines hidden (view full) ---

237 goto done;
238 }
239
240 /* check if device should be re-enumerated */
241
242 if (child->flags.usb_mode == USB_MODE_HOST) {
243 usbd_enum_lock(child);
244 if (child->re_enumerate_wait) {
245 err = usbd_set_config_index(child, USB_UNCONFIG_INDEX);
245 err = usbd_set_config_index(child,
246 USB_UNCONFIG_INDEX);
247 if (err != 0) {
248 DPRINTF("Unconfigure failed: "
249 "%s: Ignored.\n",
250 usbd_errstr(err));
251 }
252 err = usbd_req_re_enumerate(child, NULL);
246 if (err == 0)
253 if (err == 0)
247 err = usbd_req_re_enumerate(child, NULL);
248 if (err == 0)
249 err = usbd_set_config_index(child, 0);
250 if (err == 0) {
251 err = usb_probe_and_attach(child,
252 USB_IFACE_INDEX_ANY);
253 }
254 child->re_enumerate_wait = 0;
255 err = 0;
256 }

--- 2209 unchanged lines hidden (view full) ---

2466
2467 /* check if we should not filter */
2468 if (temp < 0)
2469 return (power_mode);
2470
2471 /* use fixed power mode given by hardware driver */
2472 return (temp);
2473}
254 err = usbd_set_config_index(child, 0);
255 if (err == 0) {
256 err = usb_probe_and_attach(child,
257 USB_IFACE_INDEX_ANY);
258 }
259 child->re_enumerate_wait = 0;
260 err = 0;
261 }

--- 2209 unchanged lines hidden (view full) ---

2471
2472 /* check if we should not filter */
2473 if (temp < 0)
2474 return (power_mode);
2475
2476 /* use fixed power mode given by hardware driver */
2477 return (temp);
2478}
2479
2480/*------------------------------------------------------------------------*
2481 * usbd_start_re_enumerate
2482 *
2483 * This function starts re-enumeration of the given USB device. This
2484 * function does not need to be called BUS-locked. This function does
2485 * not wait until the re-enumeration is completed.
2486 *------------------------------------------------------------------------*/
2487void
2488usbd_start_re_enumerate(struct usb_device *udev)
2489{
2490 if (udev->re_enumerate_wait == 0) {
2491 udev->re_enumerate_wait = 1;
2492 usb_needs_explore(udev->bus, 0);
2493 }
2494}