📄 uvcuser.c
字号:
} // end SetupPacket.wValue.WB.H
break;
default:
UVC_ErrorCode = INVALID_UNIT_ERR;
break;
} // end SetupPacket.wIndex.WB.H
break;
case USB_UVC_VSIF_NUM: // Video Streaming Interface
switch (SetupPacket.wValue.WB.H) { // select the selector control
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
default:
UVC_ErrorCode = UNKNOWN_ERR;
break;
} // end SetupPacket.wIndex.WB.L
if (UVC_ErrorCode == NO_ERROR_ERR)
return (TRUE); // we handled the request
else
return (FALSE); // if not handled we stall it
} // end UVC_GetRes
/*----------------------------------------------------------------------------
UVC GetLen Request Callback
Called automatically on UVC GET_LEN Request
Parameters: None (global SetupPacket and EP0Buf)
Return Value: TRUE - Success, FALSE - Error
*---------------------------------------------------------------------------*/
BOOL UVC_GetLen (void) {
switch (SetupPacket.wIndex.WB.L) { // select the Interface
case USB_UVC_VCIF_NUM: // Video Control Interface
switch (SetupPacket.wIndex.WB.H) { // select the Entity
case 5: // ProcessingUnit see usbdesc.c
switch (SetupPacket.wValue.WB.H) { // select the selector control
case PU_BRIGHTNESS_CONTROL:
UVC_ErrorCode = INVALID_REQUEST_ERR;
break;
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
default:
UVC_ErrorCode = INVALID_UNIT_ERR;
break;
} // end SetupPacket.wIndex.WB.H
break;
case USB_UVC_VSIF_NUM: // Video Streaming Interface
switch (SetupPacket.wValue.WB.H) { // select the selector control
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
default:
UVC_ErrorCode = UNKNOWN_ERR;
break;
} // end SetupPacket.wIndex.WB.L
if (UVC_ErrorCode == NO_ERROR_ERR)
return (TRUE); // we handled the request
else
return (FALSE); // if not handled we stall it
} // end UVC_GetLen
/*----------------------------------------------------------------------------
UVC GetInfo Request Callback
Called automatically on UVC GET_INFO Request
Parameters: None (global SetupPacket and EP0Buf)
Return Value: TRUE - Success, FALSE - Error
*---------------------------------------------------------------------------*/
BOOL UVC_GetInfo (void) {
switch (SetupPacket.wIndex.WB.L) { // select the Interface
case USB_UVC_VCIF_NUM: // Video Control Interface
switch (SetupPacket.wIndex.WB.H) { // select the Entity
case 0: // interface control requests
switch (SetupPacket.wValue.WB.H) { // select the selector control
case VC_VIDEO_POWER_MODE_CONTROL:
EP0Buf[0] = (SUPPORTS_GET | SUPPORTS_SET);
UVC_ErrorCode = NO_ERROR_ERR;
break;
case VC_REQUEST_ERROR_CODE_CONTROL:
EP0Buf[0] = (SUPPORTS_GET);
UVC_ErrorCode = NO_ERROR_ERR;
break;
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
case 1: // InputTerminal (camera) see usbdesc.c
switch (SetupPacket.wValue.WB.H) { // select the selector control
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
case 2: // InputTerminal (composite) see usbdesc.c
switch (SetupPacket.wValue.WB.H) { // select the selector control
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
case 3: // OutputTerminal see usbdesc.c
switch (SetupPacket.wValue.WB.H) { // select the selector control
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
case 4: // SelectorUnit see usbdesc.c
switch (SetupPacket.wValue.WB.H) { // select the selector control
case SU_INPUT_SELECT_CONTROL:
EP0Buf[0] = (SUPPORTS_GET | SUPPORTS_SET);
UVC_ErrorCode = NO_ERROR_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
case 5: // ProcessingUnit see usbdesc.c
switch (SetupPacket.wValue.WB.H) { // select the selector control
case PU_BRIGHTNESS_CONTROL:
EP0Buf[0] = (SUPPORTS_GET | SUPPORTS_SET);
UVC_ErrorCode = NO_ERROR_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
default:
UVC_ErrorCode = INVALID_UNIT_ERR;
break;
} // end SetupPacket.wIndex.WB.H
break;
case USB_UVC_VSIF_NUM: // Video Streaming Interface
switch (SetupPacket.wValue.WB.H) { // select the selector control
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
default:
UVC_ErrorCode = UNKNOWN_ERR;
break;
} // end SetupPacket.wIndex.WB.L
if (UVC_ErrorCode == NO_ERROR_ERR)
return (TRUE); // we handled the request
else
return (FALSE); // if not handled we stall it
} // end UVC_GetInfo
/*----------------------------------------------------------------------------
UVC GetDef Request Callback
Called automatically on UVC GET_DEF Request
Parameters: None (global SetupPacket and EP0Buf)
Return Value: TRUE - Success, FALSE - Error
*---------------------------------------------------------------------------*/
BOOL UVC_GetDef (void) {
switch (SetupPacket.wIndex.WB.L) { // select the Interface
case USB_UVC_VCIF_NUM: // Video Control Interface
switch (SetupPacket.wIndex.WB.H) { // select the Entity
case 1: // InputTerminal (camera) see usbdesc.c
switch (SetupPacket.wValue.WB.H) { // select the selector control
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
case 2: // InputTerminal (composite) see usbdesc.c
switch (SetupPacket.wValue.WB.H) { // select the selector control
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
case 3: // OutputTerminal see usbdesc.c
switch (SetupPacket.wValue.WB.H) { // select the selector control
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
case 4: // SelectorUnit see usbdesc.c
switch (SetupPacket.wValue.WB.H) { // select the selector control
case SU_INPUT_SELECT_CONTROL:
EP0Buf[0] = UVC_suSelectedInputPin;
UVC_ErrorCode = NO_ERROR_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
case 5: // ProcessingUnit see usbdesc.c
switch (SetupPacket.wValue.WB.H) { // select the selector control
case PU_BRIGHTNESS_CONTROL:
*((__packed WORD *)EP0Buf) = UVC_puBrightnessDef;
UVC_ErrorCode = NO_ERROR_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
default:
UVC_ErrorCode = INVALID_UNIT_ERR;
break;
} // end SetupPacket.wIndex.WB.H
break;
case USB_UVC_VSIF_NUM: // Video Streaming Interface
switch (SetupPacket.wValue.WB.H) { // select the selector control
default:
UVC_ErrorCode = INVALID_CONTROL_ERR;
break;
} // end SetupPacket.wValue.WB.H
break;
default:
UVC_ErrorCode = UNKNOWN_ERR;
break;
} // end SetupPacket.wIndex.WB.L
if (UVC_ErrorCode == NO_ERROR_ERR)
return (TRUE); // we handled the request
else
return (FALSE); // if not handled we stall it
} // end UVC_GetDef
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -