Replies: 1 comment 3 replies
-
|
As best I can tell, the ITF_NUM_CDC* values are used to identify CDC interfaces in communications with the USB host (control transfers). They are not used as an index into the _cdcd_itf[]. The 'itf' variable, limited to the range 0 - (CFG_TUD_CDC - 1), identifies a specific CDC instance to firmware running on the device. Take a look at how 'itf' is determined in the cdcd_control_xfer_cb() and cdcd_xfer_cb() functions. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The itf_num is the basic identifier passed around in callbacks when there is more than one instance of a class, right?
And it's provided in the
TUD_CONFIG_DESCRIPTORentries that the user program provides?Is this an arbitrary per-class number, or is it intimately tied to endpoint numbers in some way?
Because if you look at the "cdc_dual_ports" example, it seems that the code carefully skips some itf numbers to account for the data + control ports of a CDC:
So ITF_NUM_CDC_1 will be 2. ??
But in class/cdc/cdc_device.c, it looks like the code is expecting one itf per CDC:
where CFG_TUD_CDC is 2 for the dual ports, and the subsequent references to
_cdcd_itf[itf]will be referencing past the end of the array when itf is not 0...What am I missing?
A supposedly working example https://github.com/Noltari/pico-uart-bridge has similar non-contiguous itf values for the dual CDC ports, where the largest itf used is greater than CFG_TUD_CDC...
Beta Was this translation helpful? Give feedback.
All reactions