This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to return error on setup request Device Qualifier Descriptor

Hi
while implementing/testing MTP on Linux Wireshark captured setup requests asking for "Device Qualifier Descriptor" according to section "9.6.2 Device_Qualifier" in the USB specification.

I find a definition
APP_USBD_DESCRIPTOR_DEVICE_QUALIFIER  =  6, /**< @note Not supported - used only in HighSpeed capable devices. */
in
nRF5_SDK_17.0.2_d674dde/components/libraries/usbd/app_usbd_descriptor.h

The USB specification tells me:
"...If a full-speed only device (with a device descriptor version number equal to 0200H) receives a
GetDescriptor() request for a device_qualifier, it must respond with a request error...."

So I tried the 2 variants commented out below

static ret_code_t setup_std_req_device_in(app_usbd_class_inst_t const * p_inst,
                                      app_usbd_setup_evt_t const *  p_setup_ev) {
    ret_code_t retCode = NRF_ERROR_NOT_SUPPORTED;

    nrf_drv_usbd_setup_t setup;
    nrf_drv_usbd_setup_get(&setup);

    if (setup.bRequest == APP_USBD_DESCRIPTOR_DEVICE_QUALIFIER) {
        SEGGER_RTT_WriteString(0, "detected std request DEVICE_QUALIFIER\n");
        // nrf_drv_usbd_setup_stall();
        // nrf_drv_usbd_ep_stall(NRF_DRV_USBD_EPOUT0);
    }
    return retCode;
}

I see my SEGGER output as expected but Wireshark shows me my code has not the desired effect.

My understanding is, that nRF52840 is capable of full speed, but not of high speed.

question 1)
I should report an error - what's the correct way to do this?

question 2)
does/should the nRF52 library handle this standard request?
To me it feels a bit weird to handle "Device Qualifier Descriptor" in the application when the hardware is not capable of handling high speed anyway.
Searching the whole SDK nRF5_SDK_17.0.2_d674dde for APP_USBD_DESCRIPTOR_DEVICE_QUALIFIER just reveals the definition but it doesn't seem to be used anywhere.
(did I miss something?)


best regards
Peter

EDIT: thanks for your quick answer.
the Linux box I'm testing with uses libusb-1.0-0:amd64  version  1.0.21-1
and I attach a short Wireshark capture which could be useful to see what happens.
Linux sends 3 requests and then gives up. I don't see any consequences for my device.
getDeviceQualifier.pcapng

Related