An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
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:
- Implement a _entry(UX_HOST_CLASS_COMMAND *) function.
- 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. - The class can be registered with ux_host_stack_class_register(custom_class_name, _entry)