Share via

USBX HOST support customer defined class

jack 1 Reputation point
2021-04-01T03:22:18.663+00:00

I'm working with USBX HOST , need to drive an LTE cellular module who has customer defined class\PID\VID, how could I start with that? I found UX_HOST_CLASS_DPUMP related API which may help but when I register such class and modify following with ours, I get 580 error code.

Can you give me an example how to let it work? Thanks.

(../User/usbx/app_usbx_host.c ux_host_error_callback:580)Enumeration Failure

define UX_HOST_CLASS_DPUMP_CLASS 0x99

define UX_HOST_CLASS_DPUMP_SUBCLASS 0x99

define UX_HOST_CLASS_DPUMP_PROTOCOL 0x99

Eclipse ThreadX
Eclipse ThreadX

An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.


1 answer

Sort by: Most helpful
  1. Scott Azure RTOS 4,051 Reputation points
    2021-04-02T16:28:26.917+00:00

    Hi @jack

    This is from my colleague CQ:

    DPUMP is just a demo class to support our custom class with interface class/subclass/protocol is defined as UX_HOST_CLASS_DPUMP_CLASS/UX_HOST_CLASS_DPUMP_SUBCLASS/UX_HOST_CLASS_DPUMP_PROTOCOL. Try to detect custom device with this class returns enumeration fail since it does not find class/subclass/protocol it expects in query stage.

    Refer to the command dispatch code for command UX_HOST_CLASS_COMMAND_QUERY in ux_host_class_dpump_entry.c for the details.

    If customer want’s VID/PID detect, HUB implement can be referenced, since VID/PID is provided while querying device class driver. Check the UX_HOST_CLASS_COMMAND_QUERY handling in ux_host_class_hub_entry.c.

    If a custom device needs host class driver, you can start from existing dpump/cdc_acm for a interface/function class driver, or from existing hub for a device class driver.

    In an interface/function class driver, in UX_HOST_CLASS_COMMAND_QUERY confirm command usage is UX_HOST_CLASS_COMMAND_USAGE_CSP and check class/subclass/protocol to see if the driver should be linked to the interface.

    In a device class driver, in UX_HOST_CLASS_COMMAND_QUERY confirm command usage is UX_HOST_CLASS_COMMAND_USAGE_DCSP and check VID/PID to see if the driver should be linked to the entire device.

    After the driver is linked when runs to final step of enumeration, UX_HOST_CLASS_COMMAND_ACTIVATE is sent to driver to activate the interface/function driver or device driver. Check the implement of activate and deactivate functions for more details.

    For new customer-defined class a new driver should be created any way:

    1. Implement a _entry(UX_HOST_CLASS_COMMAND *) function.
    2. Inside _entry function handle at least following requests
      a. UX_HOST_CLASS_COMMAND_QUERY: link the driver so it will be called for activate and deactivate on enumeration end or disconnection.
      b. UX_HOST_CLASS_COMMAND_ACTIVATE: allocate driver instance and do activation.
      c. UX_HOST_CLASS_COMMAND_DEACTIVATE: free driver instance
      Refer to existing DPUMP, CDC_ACM or HUB implement for more details.
    3. The class can be registered with ux_host_stack_class_register(custom_class_name, _entry)

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.