linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Allen Blaylock <AllenB@epiloglaser.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Manu Gautam <mgautam@codeaurora.org>,
	Peter Chen <peter.chen@nxp.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: RE: EHSET with hub and PCIe root hub
Date: Thu, 12 Sep 2019 20:32:41 +0000	[thread overview]
Message-ID: <BYAPR20MB2501A4FBEDBBC6353B6EC585CCB00@BYAPR20MB2501.namprd20.prod.outlook.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1909121023190.1440-100000@iolanthe.rowland.org>

>I should add that the USB 2.0 spec includes the following text (from section 11.24.2.13):
>
>        Test mode of a downstream facing port can only be used in
>        a well defined sequence of hub states. This sequence is
>        defined as follows:
>
>        1)  All enabled downstream facing ports of the hub containing
>            the port to be tested must be (selectively) suspended via
>            the SetPortFeature(PORT_SUSPEND) request.  Each downstream
>            facing port of the hub must be in the disabled,
>            disconnected, or suspended state (see Figure 11-9).
>
>So you can see the hub probably failed the request because a non-suspended device was connected to port 3.  (And who knows what was attached to the other ports -- the usbmon trace doesn't say.)
>
>Alan Stern

This was very helpful.

I was able to get the USB3503 to generate test packets by adding a SetPortFeature(PORT_SUSPEND) request to suspend the port before setting the PORT_TEST feature. Is there a way to tell that a device is a hub but not a root hub so ports on root hub ports aren't suspended prior to calling SetPortFeature(PORT_TEST)?

I tried to use hub_udev->maxchild to determine if something was a hub but this appears misguided since root hubs can have multiple children, nothing else in the usb_device structure jumped out as being directly related to a hub.

--- a/drivers/usb/misc/ehset.c
+++ b/drivers/usb/misc/ehset.c
@@ -62,6 +62,16 @@ static int ehset_probe(struct usb_interface *intf,
                                        NULL, 0, 1000);
                break;
        case TEST_PACKET_PID:
+               if(hub_udev->maxchild)
+               {
+                       ret = usb_control_msg(hub_udev, usb_sndctrlpipe(hub_udev, 0),
+                                               USB_REQ_SET_FEATURE, USB_RT_PORT,
+                                               USB_PORT_FEAT_SUSPEND, portnum,
+                                               NULL, 0, 1000);
+                       if (ret < 0)
+                               break;
+
+               }
                ret = usb_control_msg(hub_udev, usb_sndctrlpipe(hub_udev, 0),
                                        USB_REQ_SET_FEATURE, USB_RT_PORT,
                                        USB_PORT_FEAT_TEST,

  reply	other threads:[~2019-09-12 20:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-10 22:01 EHSET with hub and PCIe root hub Allen Blaylock
2019-09-11  2:57 ` Peter Chen
2019-09-11  3:54   ` Manu Gautam
2019-09-11 20:34     ` Allen Blaylock
2019-09-12  0:49       ` Peter Chen
2019-09-12 14:20       ` Alan Stern
2019-09-12 14:28         ` Alan Stern
2019-09-12 20:32           ` Allen Blaylock [this message]
2019-09-12 20:51             ` Alan Stern
2019-09-16  1:11               ` Peter Chen
2019-09-12 14:29         ` Allen Blaylock

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=BYAPR20MB2501A4FBEDBBC6353B6EC585CCB00@BYAPR20MB2501.namprd20.prod.outlook.com \
    --to=allenb@epiloglaser.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mgautam@codeaurora.org \
    --cc=peter.chen@nxp.com \
    --cc=stern@rowland.harvard.edu \
    /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;
as well as URLs for NNTP newsgroup(s).