From: Pei Zhang <pei.zhang@intel.com>
To: linux-kernel@vger.kernel.org, usbip-devel@lists.sourceforge.net
Cc: Pei Zhang <pei.zhang@intel.com>
Subject: [PATCH] usbip: vhci-hcd: return correct port ENABLE status
Date: Wed, 6 Dec 2017 11:41:21 +0800 [thread overview]
Message-ID: <1512531681-10554-1-git-send-email-pei.zhang@intel.com> (raw)
USB system will clear port's ENABLE feature for some USB devices when
vdev is already assigned port address. This cause getPortStatus reports
to system that this device is not enabled, client OS will failed to use
this usb device.
The failure devices include a SAMSUNG SSD storage, and a Logitech webcam.
Signed-off-by: Pei Zhang <pei.zhang@intel.com>
---
drivers/usb/usbip/vhci_hcd.c | 38 +++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index e4cb9f0..7b8cf70 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -350,24 +350,32 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
dum->re_timeout = 0;
}
- if ((dum->port_status[rhport] & (1 << USB_PORT_FEAT_RESET)) !=
- 0 && time_after(jiffies, dum->re_timeout)) {
- dum->port_status[rhport] |=
- (1 << USB_PORT_FEAT_C_RESET);
- dum->port_status[rhport] &=
- ~(1 << USB_PORT_FEAT_RESET);
- dum->re_timeout = 0;
-
- if (dum->vdev[rhport].ud.status ==
- VDEV_ST_NOTASSIGNED) {
- usbip_dbg_vhci_rh(
- " enable rhport %d (status %u)\n",
- rhport,
- dum->vdev[rhport].ud.status);
+ if (dum->port_status[rhport] & (1 << USB_PORT_FEAT_RESET)) {
+ if (time_after(jiffies, dum->re_timeout)) {
dum->port_status[rhport] |=
- USB_PORT_STAT_ENABLE;
+ (1 << USB_PORT_FEAT_C_RESET);
+ dum->port_status[rhport] &=
+ ~(1 << USB_PORT_FEAT_RESET);
+ dum->re_timeout = 0;
+
+ if (dum->vdev[rhport].ud.status ==
+ VDEV_ST_NOTASSIGNED) {
+ usbip_dbg_vhci_rh(
+ " enable rhport %d (status %u)\n",
+ rhport,
+ dum->vdev[rhport].ud.status);
+ dum->port_status[rhport] |=
+ USB_PORT_STAT_ENABLE;
+ }
}
+ } else {
+ /* Port would be disabled by clearing FEAT_ENABLE bit,
+ * make it enabled here. No more thing should be done. */
+ if (dum->vdev[rhport].ud.status == VDEV_ST_USED)
+ dum->port_status[rhport] |=
+ USB_PORT_STAT_ENABLE;
}
+
((__le16 *) buf)[0] = cpu_to_le16(dum->port_status[rhport]);
((__le16 *) buf)[1] =
cpu_to_le16(dum->port_status[rhport] >> 16);
--
2.7.4
next reply other threads:[~2017-12-06 3:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-06 3:41 Pei Zhang [this message]
2017-12-15 8:44 ` Zhang, Pei
2017-12-15 21:33 ` Shuah Khan
-- strict thread matches above, loose matches on Subject: below --
2017-12-06 3:38 Pei Zhang
2017-12-05 5:39 Pei Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1512531681-10554-1-git-send-email-pei.zhang@intel.com \
--to=pei.zhang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=usbip-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®