static int tweak_reset_device_cmd(struct urb *urb) { struct usb_ctrlrequest *req; __u16 value; __u16 index; int ret; req = (struct usb_ctrlrequest *) urb->setup_packet; value = le16_to_cpu(req->wValue); index = le16_to_cpu(req->wIndex); #if 0 /* hided by tf, for reason that "bus_id" isn't supported in kernel2.6.31 */ uinfo("reset_device (port %d) to %s\n", index, urb->dev->dev.bus_id); #endif /* all interfaces should be owned by usbip driver, so just reset it. */ ret = usb_lock_device_for_reset(urb->dev, NULL); if (ret < 0) { uerr("lock for reset\n"); return ret; } #if 0 /* hided it temporarily */ /* try to reset the device */ ret = usb_reset_composite_device(urb->dev, NULL); if (ret < 0) uerr("device reset\n"); #endif usb_unlock_device(urb->dev); return ret; }
static int tweak_reset_device_cmd(struct urb *urb) { struct usb_ctrlrequest *req; __u16 value; __u16 index; int ret; req = (struct usb_ctrlrequest *) urb->setup_packet; value = le16_to_cpu(req->wValue); index = le16_to_cpu(req->wIndex); uinfo("reset_device (port %d) to %s\n", index, urb->dev->dev.bus_id); /* all interfaces should be owned by usbip driver, so just reset it. */ ret = usb_lock_device_for_reset(urb->dev, NULL); if (ret < 0) { uerr("lock for reset\n"); return ret; } /* try to reset the device */ ret = usb_reset_composite_device(urb->dev, NULL); if (ret < 0) uerr("device reset\n"); usb_unlock_device(urb->dev); return ret; }
/* Issue a USB port reset to the device. The caller must not hold * us->dev_mutex. */ int usb_stor_port_reset(struct us_data *us) { int result, rc_lock; result = rc_lock = usb_lock_device_for_reset(us->pusb_dev, us->pusb_intf); if (result < 0) US_DEBUGP("unable to lock device for reset: %d\n", result); else { /* Were we disconnected while waiting for the lock? */ if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { result = -EIO; US_DEBUGP("No reset during disconnect\n"); } else { result = usb_reset_composite_device( us->pusb_dev, us->pusb_intf); US_DEBUGP("usb_reset_composite_device returns %d\n", result); } if (rc_lock) usb_unlock_device(us->pusb_dev); } return result; }