>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,