USB NEXT loopback class with linux testusb util

HI all,

I'm trying to run the USB next stack-based loopback class with Linux testusb. and only very few of them been passed and everything else been timed out.

I confirmed that device descriptor is correct and I replaced the loopback.c that been shipped with ncs 2.9 to the latest.

Parents
  • Hi bb_elaDial,

    I would like to confirm a few details to figure out a direction with this.

    1. Are you running the USB CDC-ACM sample with usbd_next_prj.conf?
      On the Linux end, by testusb, do you mean this? linux/tools/usb/testusb.c at master · torvalds/linux
      Could you describe the test in more details?

    2. When you say that only a few of them passed, how are you testing here? Are you testing one nRF device against multiple PCs, or are you testing multiple nRF devices against one PC?

    3. Do you observe this on a Development Kit or on a custom hardware? If it's on a custom hardware, can you reproduce the issue on a Development Kit?

    4. Do things work without using the USB Next stack?

    Hieu

  • Hi Hieu, 

    Apiologies for, not properly describing the testing process.

    I'm not using any samples provided with zephyr.

    however, I'm using zephyr\samples\subsys\usb\common as my initiating functions.

    with zephyr\subsys\usb\device_next\class\loopback.c by Enabling the CONFIG_USBD_LOOPBACK_CLASS and CONFIG_USB_DEVICE_STACK_NEXT.

    I did replace the ncs2.9 loopback.c file with one in the mainstream. due to missing functions that needed 

    my main.c is 

     

    static void msg_cb(struct usbd_context *const usbd_ctx,
                       const struct usbd_msg *const msg)
    {
            LOG_INF("USBD message: %s", usbd_msg_type_string(msg->type));
    
            if (usbd_can_detect_vbus(usbd_ctx))
            {
                    if (msg->type == USBD_MSG_VBUS_READY)
                    {
                            if (usbd_enable(usbd_ctx))
                            {
                                    LOG_ERR("Failed to enable device support");
                            }
                    }
    
                    if (msg->type == USBD_MSG_VBUS_REMOVED)
                    {
                            if (usbd_disable(usbd_ctx))
                            {
                                    LOG_ERR("Failed to disable device support");
                            }
                    }
            }
    }
    int main(void)
    {
            struct usbd_context *sample_usbd;
            int ret;
    
            sample_usbd = sample_usbd_init_device(msg_cb);
    
            if (!usbd_can_detect_vbus(sample_usbd))
            {
                    ret = usbd_enable(sample_usbd);
                    {
                            if (ret)
                            {
                                    LOG_ERR("Failed to enable usb support !");
                                    return ret;
                            }
                    }
            }
            return 0;
    }

    Yes, I'm using the test that you mentioned above.  

    even though above test(s) failing ,  I managed to do vender request loopback and blk-out transaction with libusb (lusb-1.0) based application  

    before approaching this method I also ran the zephyr-testusb sample that included with ncs2.9  against linux-testusb and it passes all the tests. which also based on usb next api (If I correctly understand the sample)

    so I'm curious to know, compatibility of loopback class with linux-testusb.

     

    Thank you 

Reply
  • Hi Hieu, 

    Apiologies for, not properly describing the testing process.

    I'm not using any samples provided with zephyr.

    however, I'm using zephyr\samples\subsys\usb\common as my initiating functions.

    with zephyr\subsys\usb\device_next\class\loopback.c by Enabling the CONFIG_USBD_LOOPBACK_CLASS and CONFIG_USB_DEVICE_STACK_NEXT.

    I did replace the ncs2.9 loopback.c file with one in the mainstream. due to missing functions that needed 

    my main.c is 

     

    static void msg_cb(struct usbd_context *const usbd_ctx,
                       const struct usbd_msg *const msg)
    {
            LOG_INF("USBD message: %s", usbd_msg_type_string(msg->type));
    
            if (usbd_can_detect_vbus(usbd_ctx))
            {
                    if (msg->type == USBD_MSG_VBUS_READY)
                    {
                            if (usbd_enable(usbd_ctx))
                            {
                                    LOG_ERR("Failed to enable device support");
                            }
                    }
    
                    if (msg->type == USBD_MSG_VBUS_REMOVED)
                    {
                            if (usbd_disable(usbd_ctx))
                            {
                                    LOG_ERR("Failed to disable device support");
                            }
                    }
            }
    }
    int main(void)
    {
            struct usbd_context *sample_usbd;
            int ret;
    
            sample_usbd = sample_usbd_init_device(msg_cb);
    
            if (!usbd_can_detect_vbus(sample_usbd))
            {
                    ret = usbd_enable(sample_usbd);
                    {
                            if (ret)
                            {
                                    LOG_ERR("Failed to enable usb support !");
                                    return ret;
                            }
                    }
            }
            return 0;
    }

    Yes, I'm using the test that you mentioned above.  

    even though above test(s) failing ,  I managed to do vender request loopback and blk-out transaction with libusb (lusb-1.0) based application  

    before approaching this method I also ran the zephyr-testusb sample that included with ncs2.9  against linux-testusb and it passes all the tests. which also based on usb next api (If I correctly understand the sample)

    so I'm curious to know, compatibility of loopback class with linux-testusb.

     

    Thank you 

Children
Related