[issue] usbip: vhci-hcd: Device unable to get work after reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am trying to implement a virtual USB device using usbip. But I get a trouble.

When a running port on vhci_hcd is resetted (by setting USB_PORT_FEAT_RESET), it will never be enabled again.

The kernel version is 5.5.0-rc1-00012-g6794862a16ef.
In the source file drivers/usb/usbip/vhci_hcd.c:

 565         case USB_PORT_FEAT_RESET:
...
 572             /* if it's already enabled, disable */
 573             if (hcd->speed == HCD_USB3) {
 574                 vhci_hcd->port_status[rhport] = 0;
 575                 vhci_hcd->port_status[rhport] =
 576                     (USB_SS_PORT_STAT_POWER |
 577                      USB_PORT_STAT_CONNECTION |
 578                      USB_PORT_STAT_RESET);
 579             } else if (vhci_hcd->port_status[rhport] & USB_PORT_STAT_ENABLE) {
 580                 vhci_hcd->port_status[rhport] &= ~(USB_PORT_STAT_ENABLE
 581                     | USB_PORT_STAT_LOW_SPEED
 582                     | USB_PORT_STAT_HIGH_SPEED);
 583             }
 584

The USB_PORT_STAT_ENABLE is cleard. And it should be set later.
But, the GetPortStatus only set the USB_PORT_STAT_ENABLE for not-assigned ports.

 430     case GetPortStatus:
...
 456             if (vhci_hcd->vdev[rhport].ud.status ==
 457                 VDEV_ST_NOTASSIGNED) {
 458                 usbip_dbg_vhci_rh(
 459                     " enable rhport %d (status %u)\n",
 460                     rhport,
 461                     vhci_hcd->vdev[rhport].ud.status);
 462                 vhci_hcd->port_status[rhport] |=
 463                     USB_PORT_STAT_ENABLE;
 464             }

The used port (status == VDEV_ST_USED) will be disabled after USB_PORT_FEAT_RESET, and unable to be enabled again.

Should VDEV_ST_USED be added to line 457?
And if it shouldn't, how can I enable a port after USB_PORT_FEAT_RESET?


Thanks,
Zhai Zhaoxuan




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux