diff options
| author | kkitayam <[email protected]> | 2021-08-01 17:11:43 +0900 |
|---|---|---|
| committer | kkitayam <[email protected]> | 2021-09-29 21:23:15 +0900 |
| commit | d026f174576b0567e2a954292bd4339349e3f139 (patch) | |
| tree | 6161152f9981fef55f2bd8611b0c28cc29f549e3 /examples | |
| parent | 019c1ab09e98517ce5422e9a0e2995928feff027 (diff) | |
fix: configuration descriptor has incorrectly sizes
update some descriptors
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/video_capture/src/usb_descriptors.c | 2 | ||||
| -rw-r--r-- | examples/device/video_capture/src/usb_descriptors.h | 59 |
2 files changed, 38 insertions, 23 deletions
diff --git a/examples/device/video_capture/src/usb_descriptors.c b/examples/device/video_capture/src/usb_descriptors.c index df8c41721..067c1d946 100644 --- a/examples/device/video_capture/src/usb_descriptors.c +++ b/examples/device/video_capture/src/usb_descriptors.c @@ -102,7 +102,7 @@ uint8_t const * tud_descriptor_device_cb(void) uint8_t const desc_fs_configuration[] = { // Config number, interface count, string index, total length, attribute, power in mA - TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100), + TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0, 500), // IAD for Video Control TUD_VIDEO_CAPTURE_DESCRIPTOR(4, EPNUM_VIDEO_IN, 128, 96, 15) }; diff --git a/examples/device/video_capture/src/usb_descriptors.h b/examples/device/video_capture/src/usb_descriptors.h index 6c6c14d35..d37ab1338 100644 --- a/examples/device/video_capture/src/usb_descriptors.h +++ b/examples/device/video_capture/src/usb_descriptors.h @@ -39,18 +39,27 @@ enum { ITF_NUM_TOTAL }; -#define TUD_VIDEO_CAPTURE_DESC_LEN (TUD_VIDEO_DESC_IAD_LEN\ +#define TUD_VIDEO_CAPTURE_DESC_LEN (\ + TUD_VIDEO_DESC_IAD_LEN\ /* control */\ + TUD_VIDEO_DESC_STD_VC_LEN\ - + TUD_VIDEO_DESC_CS_VC_LEN\ + + (TUD_VIDEO_DESC_CS_VC_LEN + 1/*bInCollection*/)\ + TUD_VIDEO_DESC_INPUT_TERM_LEN\ + TUD_VIDEO_DESC_OUTPUT_TERM_LEN\ /* Interface 1, Alternate 0 */\ + TUD_VIDEO_DESC_STD_VS_LEN\ - + TUD_VIDEO_DESC_CS_VS_IN_LEN\ + + (TUD_VIDEO_DESC_CS_VS_IN_LEN + 1/*bNumFormats x bControlSize*/)\ + TUD_VIDEO_DESC_CS_VS_FMT_UNCOMPR_LEN\ - + TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_CONT_LEN) + + TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_CONT_LEN\ + + TUD_VIDEO_DESC_CS_VS_COLOR_MATCHING_LEN\ + ) +#if 0 + /* Interface 1, Alternate 1 */\ + + TUD_VIDEO_DESC_STD_VS_LEN\ + + 7/* Endpoint */\ + +#endif #define TUD_VIDEO_DESC_CS_VS_FMT_YUY2(_fmtidx, _numfmtdesc, _frmidx, _asrx, _asry, _interlace, _cp) \ TUD_VIDEO_DESC_CS_VS_FMT_UNCOMPR(_fmtidx, _numfmtdesc, TUD_VIDEO_GUID_YUY2, 16, _frmidx, _asrx, _asry, _interlace, _cp) @@ -64,34 +73,40 @@ enum { #define TUD_VIDEO_CAPTURE_DESCRIPTOR(_stridx, _epin, _width, _height, _fps) \ TUD_VIDEO_DESC_IAD(ITF_NUM_VIDEO_CONTROL, ITF_NUM_TOTAL, _stridx), \ /* Video control 0 */ \ - TUD_VIDEO_DESC_STD_VC(ITF_NUM_VIDEO_CONTROL, 0, 0), \ + TUD_VIDEO_DESC_STD_VC(ITF_NUM_VIDEO_CONTROL, 0, _stridx), \ TUD_VIDEO_DESC_CS_VC( /* UVC 1.5*/ 0x0150, \ - TUD_VIDEO_DESC_INPUT_TERM_LEN + \ - TUD_VIDEO_DESC_OUTPUT_TERM_LEN, \ + /* wTotalLength - bLength */ \ + TUD_VIDEO_DESC_INPUT_TERM_LEN + TUD_VIDEO_DESC_OUTPUT_TERM_LEN, \ UVC_CLOCK_FREQUENCY, 1, 1), \ TUD_VIDEO_DESC_INPUT_TERM(UVC_ENTITY_CAP_INPUT_TERMINAL,\ VIDEO_TT_COMPOSITE_CONNECTOR, 0, 0), \ TUD_VIDEO_DESC_OUTPUT_TERM(UVC_ENTITY_CAP_OUTPUT_TERMINAL,\ - VIDEO_TT_STREAMING, 0, 1, 0), \ + VIDEO_TT_STREAMING, 0, 1, 0), \ /* Video stream alt. 0 */ \ TUD_VIDEO_DESC_STD_VS( 1, 0, 0, 0), \ /* Video stream header for without still image capture */ \ - TUD_VIDEO_DESC_CS_VS_INPUT(1, \ - TUD_VIDEO_DESC_CS_VS_FMT_UNCOMPR_LEN + \ - TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_CONT_LEN,\ - _epin, /*bmInfo*/ 0, UVC_ENTITY_CAP_OUTPUT_TERMINAL, \ - 0, 2, 0, 0, 0, 1, 0), \ + TUD_VIDEO_DESC_CS_VS_INPUT( /*bNumFormats*/1, \ + /*wTotalLength - bLength */\ + TUD_VIDEO_DESC_CS_VS_FMT_UNCOMPR_LEN\ + + TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_CONT_LEN\ + + TUD_VIDEO_DESC_CS_VS_COLOR_MATCHING_LEN,\ + _epin, /*bmInfo*/0, /*bTerminalLink*/UVC_ENTITY_CAP_OUTPUT_TERMINAL, \ + /*bStillCaptureMethod*/0, /*bTriggerSupport*/0, /*bTriggerUsage*/0, \ + /*bControlSize*/1, /*bmaControls(1)*/0), \ /* Video stream format */ \ - TUD_VIDEO_DESC_CS_VS_FMT_I420(0, 1, 0, 1, 1, 0, 0), \ + TUD_VIDEO_DESC_CS_VS_FMT_I420(/*bFormatIndex*/1, /*bNumFrameDescriptors*/1,\ + /*bDefaultFrameIndex*/1, 1, 1, 0, /*bCopyProtect*/0), \ /* Video stream frame format */ \ - TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_CONT( 1, 0, _width, _height, \ - _width * _height * 12, _width * _height * 12 * _fps, \ - _width * _height * 12, \ - (10000000/_fps), (10000000/1), (10000000/_fps), 166666), \ - /* VS alt 1 */ \ - TUD_VIDEO_DESC_STD_VS( 1, 1, 1, 0), \ - /* EP */ \ - TUD_VIDEO_DESC_EP_ISO(_epin, (_width * _height * 12 / 8) * _fps, 1) + TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_CONT(/*bFrameIndex */1, 0, _width, _height, \ + _width * _height * 12, _width * _height * 12 * _fps, \ + _width * _height * 12, \ + (10000000/_fps), (10000000/1), (10000000/_fps), 166666), \ + TUD_VIDEO_DESC_CS_VS_COLOR_MATCHING(VIDEO_COLOR_PRIMARIES_BT709,\ + VIDEO_COLOR_XFER_CH_BT709, VIDEO_COLOR_COEF_SMPTE170M), \ + /* VS alt 1 */\ + TUD_VIDEO_DESC_STD_VS(1, 1, 1, 0), \ + /* EP */ \ + TUD_VIDEO_DESC_EP_ISO(_epin, (_width * _height * 12 / 8) * _fps, 1) #endif |
