Hello,
I hope I don't get roasted too badly here by real programmers...
Anyhow, I am new to Windows drivers, kernels, and USB standards and am learning everything from scratch to the best of my abilities.
To remove the big question of "why" I am doing this crazy task, it's because I am designing a high-speed object detection system that uses YOLOv8 inference. I found out that there is great latency and overhead in the camera system.
I want to implement a custom driver for an HDMI-USB 3.0 capture card such that it directly loads the camera frames into a pinned-memory location in the system host RAM. Then, the GPU will directly grab those MJPEG frames, decode them, and perform inference on them. This is something in the nature of DMA (Direct Memory Access).
I know I'll need to do some USB header parsing, but right now, I am not able to get data when using WinUSB. When I use UVC drivers, I am able to receive camera data by DirectShow. However, DirectShow is not able to provide the fine-grain control I need.
The camera is connected to a generic HDMI-to-USB 3.0 capture card (I have 5 of them), all are identical, they have the same vendor, hardware, and serial numbers. The capture card is seen as a composite device with usbccgp.sys drivers loaded automatically by Windows.
Each generic HDMI-to-USB 3.0 capture card has two child nodes: one is for video, and the other is for audio and microphone.
I installed WinUSB driver into the child node of the video interface, I used Zadig to install it.
Here is the WinUSB .INF file:
; USB3.0_HD_Video_Capture_(Test_CAM).inf
; Copyright (c) 2010-2023 Pete Batard <pete@akeo.ie> (GNU LGPL)
[Strings]
DeviceName = "USB3.0 HD Video Capture (Test_CAM)"
VendorName = "(Undefined Vendor)"
SourceName = "USB3.0 HD Video Capture (Test_CAM) Install Disk"
DeviceID = "VID_EBA4&PID_7588&MI_02"
DeviceGUID = "{99DA2DEC-C919-4F9D-9384-DAA7EBBD40EC}"
[Version]
Signature = "$Windows NT$"
Class = "USBDevice"
ClassGuid = {88bae032-5a81-49f0-bc3d-a4ff138216d6}
Provider = "libwdi"
CatalogFile = USB3.0_HD_Video_Capture_(Test_CAM).cat
DriverVer = 06/02/2012, 6.1.7600.16385
[ClassInstall32]
Addreg = WinUSBDeviceClassReg
[WinUSBDeviceClassReg]
HKR,,,0,"Universal Serial Bus devices"
HKR,,Icon,,-20
[Manufacturer]
%VendorName% = libusbDevice_WinUSB,NTx86,NTamd64,NTarm64
[libusbDevice_WinUSB.NTx86]
%DeviceName% = USB_Install, USB\%DeviceID%
[libusbDevice_WinUSB.NTamd64]
%DeviceName% = USB_Install, USB\%DeviceID%
[libusbDevice_WinUSB.NTarm64]
%DeviceName% = USB_Install, USB\%DeviceID%
[USB_Install]
Include = winusb.inf
Needs = WINUSB.NT
[USB_Install.Services]
Include = winusb.inf
AddService = WinUSB,0x00000002,WinUSB_ServiceInstall
[WinUSB_ServiceInstall]
DisplayName = "WinUSB - Kernel Driver 06/02/2012 6.1.7600.16385"
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WinUSB.sys
[USB_Install.Wdf]
KmdfService = WINUSB, WinUsb_Install
[WinUSB_Install]
KmdfLibraryVersion = 1.11
[USB_Install.HW]
AddReg = AddDeviceInterfaceGUID
;[NoDeviceInterfaceGUID]
; Avoids adding a DeviceInterfaceGUID for generic driver
[AddDeviceInterfaceGUID]
HKR,,DeviceInterfaceGUIDs,0x10000,%DeviceGUID%
[USB_Install.NTx86.CoInstallers]
AddReg = CoInstallers_AddReg
CopyFiles = CoInstallers_CopyFiles
[USB_Install.NTamd64.CoInstallers]
AddReg = CoInstallers_AddReg
CopyFiles = CoInstallers_CopyFiles
[USB_Install.NTarm64.CoInstallers]
;
[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WdfCoInstaller01011.dll,WdfCoInstaller","WinUSBCoInstaller2.dll"
[CoInstallers_CopyFiles]
WinUSBCoInstaller2.dll
WdfCoInstaller01011.dll
[DestinationDirs]
CoInstallers_CopyFiles = 11
[SourceDisksNames]
1 = %SourceName%
[SourceDisksFiles.x86]
WinUSBCoInstaller2.dll = 1,x86
WdfCoInstaller01011.dll = 1,x86
[SourceDisksFiles.amd64]
WinUSBCoInstaller2.dll = 1,amd64
WdfCoInstaller01011.dll = 1,amd64
[SourceDisksFiles.arm64]
;
Here is the USB Descriptor obtained by usbview.exe:
[Port2] : USB Composite Device
Is Port User Connectable: yes
Is Port Debug Capable: no
Companion Port Number: 0
Companion Hub Symbolic Link Name:
Protocols Supported:
USB 1.1: yes
USB 2.0: yes
USB 3.0: no
Device Power State: PowerDeviceD0
---===>Device Information<===---
English product name: "USB3.0 HD Video Capture"
ConnectionStatus:
Current Config Value: 0x01 -> Device Bus Speed: High (is not SuperSpeed or higher capable)
Device Address: 0x01
Open Pipes: 0
*!*ERROR: No open pipes!
===>Device Descriptor<===
bLength: 0x12
bDescriptorType: 0x01
bcdUSB: 0x0200
bDeviceClass: 0xEF -> This is a Multi-interface Function Code Device
bDeviceSubClass: 0x02 -> This is the Common Class Sub Class
bDeviceProtocol: 0x01 -> This is the Interface Association Descriptor protocol
bMaxPacketSize0: 0x40 = (64) Bytes
idVendor: 0xEBA4 = Vendor ID not listed with USB.org
idProduct: 0x7588
bcdDevice: 0x0328
iManufacturer: 0x01
English (United States) "USB3.0 HD Audio Capture"
iProduct: 0x02
English (United States) "USB3.0 HD Video Capture"
iSerialNumber: 0x06
*!*ERROR: No String Descriptor for index 6!
bNumConfigurations: 0x01
---===>Full Configuration Descriptor<===---
===>Configuration Descriptor<===
bLength: 0x09
bDescriptorType: 0x02
wTotalLength: 0x01B9 -> Validated
bNumInterfaces: 0x04
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0x80 -> Bus Powered
MaxPower: 0x64 = 200 mA
===>IAD Descriptor<===
bLength: 0x08
bDescriptorType: 0x0B
bFirstInterface: 0x00
bInterfaceCount: 0x02
bFunctionClass: 0x01 -> Audio Interface Class
bFunctionSubClass: 0x00
*!*CAUTION: This appears to be an invalid bFunctionSubClass
bFunctionProtocol: 0x00
iFunction: 0x04
English (United States) "USB3.0 HD Audio Capture"
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x00
bInterfaceClass: 0x01 -> Audio Interface Class
bInterfaceSubClass: 0x01 -> Audio Control Interface SubClass
bInterfaceProtocol: 0x00
iInterface: 0x04
English (United States) "USB3.0 HD Audio Capture"
===>Audio Control Interface Header Descriptor<===
bLength: 0x09
bDescriptorType: 0x24 (CS_INTERFACE)
bDescriptorSubtype: 0x01 (HEADER)
bcdADC: 0x0100
wTotalLength: 0x0029
bInCollection: 0x01
baInterfaceNr[1]: 0x01
===>Audio Control Input Terminal Descriptor<===
bLength: 0x0C
bDescriptorType: 0x24 (CS_INTERFACE)
bDescriptorSubtype: 0x02 (INPUT_TERMINAL)
bTerminalID: 0x01
wTerminalType: 0x0201 (Microphone)
bAssocTerminal: 0x00
bNrChannels: 0x02
wChannelConfig: 0x0000
iChannelNames: 0x00
iTerminal: 0x00
===>Audio Control Feature Unit Descriptor<===
bLength: 0x0B
bDescriptorType: 0x24 (CS_INTERFACE)
bDescriptorSubtype: 0x06 (FEATURE_UNIT)
bUnitID: 0x02
bSourceID: 0x01
bControlSize: 0x02
bmaControls[master]: 03 00
bmaControls[channel 0]: 03 00
iFeature: 0x00
===>Audio Control Output Terminal Descriptor<===
bLength: 0x09
bDescriptorType: 0x24 (CS_INTERFACE)
bDescriptorSubtype: 0x03 (OUTPUT_TERMINAL)
bTerminalID: 0x03
wTerminalType: 0x0101 (USB streaming)
bAssocTerminal: 0x00
bSourceID: 0x02
iTerminal: 0x00
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x00
bInterfaceClass: 0x01 -> Audio Interface Class
bInterfaceSubClass: 0x02 -> Audio Streaming Interface SubClass
bInterfaceProtocol: 0x00
iInterface: 0x01
English (United States) "USB3.0 HD Audio Capture"
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x01
bAlternateSetting: 0x01
bNumEndpoints: 0x01
bInterfaceClass: 0x01 -> Audio Interface Class
bInterfaceSubClass: 0x02 -> Audio Streaming Interface SubClass
bInterfaceProtocol: 0x00
iInterface: 0x00
===>Audio Streaming Class Specific Interface Descriptor<===
bLength: 0x07
bDescriptorType: 0x24 (CS_INTERFACE)
bDescriptorSubtype: 0x01 (AS_GENERAL)
bTerminalLink: 0x03
bDelay: 0x01
wFormatTag: 0x0001 (PCM)
===>Audio Streaming Format Type Descriptor<===
bLength: 0x0B
bDescriptorType: 0x24 (CS_INTERFACE)
bDescriptorSubtype: 0x02 (FORMAT_TYPE)
bFormatType: 0x01 (FORMAT_TYPE_I)
bNrChannels: 0x02
bSubframeSize: 0x02
bBitResolution: 0x10 (16)
bSamFreqType: 0x01 (Discrete)
tSamFreq[1]: 0x00BB80 (48000 Hz)
===>Endpoint Descriptor<===
bLength: 0x09
bDescriptorType: 0x05
bEndpointAddress: 0x83 -> Direction: IN - EndpointID: 3
bmAttributes: 0x01 -> Isochronous Transfer Type, Synchronization Type = No Synchronization, Usage Type = Data Endpoint
wMaxPacketSize: 0x01B0 = 1 transactions per microframe, 0x1B0 max bytes
wInterval: 0x0004
bSyncAddress: 0x00
===>Audio Streaming Class Specific Audio Data Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x25 (CS_ENDPOINT)
bDescriptorSubtype: 0x01 (EP_GENERAL)
bmAttributes: 0x00
bLockDelayUnits: 0x00 (Undefined)
wLockDelay: 0x0001
===>IAD Descriptor<===
bLength: 0x08
bDescriptorType: 0x0B
bFirstInterface: 0x02
bInterfaceCount: 0x02
bFunctionClass: 0x0E -> Video Interface Class
bFunctionSubClass: 0x03 -> Video Interface Collection
bFunctionProtocol: 0x00 -> PC_PROTOCOL_UNDEFINED protocol
iFunction: 0x05
*!*ERROR: No String Descriptor for index 5!
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x02
bAlternateSetting: 0x00
bNumEndpoints: 0x00
bInterfaceClass: 0x0E -> Video Interface Class
bInterfaceSubClass: 0x01 -> Video Control Interface SubClass
bInterfaceProtocol: 0x00
iInterface: 0x05
*!*ERROR: No String Descriptor for index 5!
===>Class-Specific Video Control Interface Header Descriptor<===
bLength: 0x0D
bDescriptorType: 0x24
bDescriptorSubtype: 0x01
bcdVDC: 0x0100
wTotalLength: 0x004F -> Validated
dwClockFreq: 0x017D7840 = (25000000) Hz
bInCollection: 0x01
baInterfaceNr[1]: 0x01
USB Video Class device: spec version 1.0
===>Video Control Input Terminal Descriptor<===
bLength: 0x11
bDescriptorType: 0x24
bDescriptorSubtype: 0x02
bTerminalID: 0x01
wTerminalType: 0x0201 = (ITT_CAMERA)
bAssocTerminal: 0x00
iTerminal: 0x00
===>Camera Input Terminal Data
wObjectiveFocalLengthMin: 0x0000
wObjectiveFocalLengthMax: 0x0000
wOcularFocalLength: 0x0000
bControlSize: 0x02
bmControls : 0x00 0x00
D00 = 0 no - Scanning Mode
D01 = 0 no - Auto-Exposure Mode
D02 = 0 no - Auto-Exposure Priority
D03 = 0 no - Exposure Time (Absolute)
D04 = 0 no - Exposure Time (Relative)
D05 = 0 no - Focus (Absolute)
D06 = 0 no - Focus (Relative)
D07 = 0 no - Iris (Absolute)
D08 = 0 no - Iris (Relative)
D09 = 0 no - Zoom (Absolute)
D10 = 0 no - Zoom (Relative)
D11 = 0 no - PanTilt (Absolute)
D12 = 0 no - PanTilt (Relative)
D13 = 0 no - Roll (Absolute)
D14 = 0 no - Roll (Relative)
D15 = 0 no - Reserved
===>Video Control Extension Unit Descriptor<===
bLength: 0x1D
bDescriptorType: 0x24
bDescriptorSubtype: 0x06
bUnitID: 0x02
guidExtensionCode: {46394292-0CD0-4AE3-8783-3133F9EAAA3B}
bNumControls: 0x0A
bNrInPins: 0x01
===>List of Connected Units and Terminal ID's
baSourceID[1]: 0x01
bControlSize: 0x04
bmControls : 0xFF 0x03 0x00 0x00
D00 = 1 yes - Vendor-Specific (Optional)
D01 = 1 yes - Vendor-Specific (Optional)
D02 = 1 yes - Vendor-Specific (Optional)
D03 = 1 yes - Vendor-Specific (Optional)
D04 = 1 yes - Vendor-Specific (Optional)
D05 = 1 yes - Vendor-Specific (Optional)
D06 = 1 yes - Vendor-Specific (Optional)
D07 = 1 yes - Vendor-Specific (Optional)
D08 = 1 yes - Vendor-Specific (Optional)
D09 = 1 yes - Vendor-Specific (Optional)
D10 = 0 no - Vendor-Specific (Optional)
D11 = 0 no - Vendor-Specific (Optional)
D12 = 0 no - Vendor-Specific (Optional)
D13 = 0 no - Vendor-Specific (Optional)
D14 = 0 no - Vendor-Specific (Optional)
D15 = 0 no - Vendor-Specific (Optional)
D16 = 0 no - Vendor-Specific (Optional)
D17 = 0 no - Vendor-Specific (Optional)
D18 = 0 no - Vendor-Specific (Optional)
D19 = 0 no - Vendor-Specific (Optional)
D20 = 0 no - Vendor-Specific (Optional)
D21 = 0 no - Vendor-Specific (Optional)
D22 = 0 no - Vendor-Specific (Optional)
D23 = 0 no - Vendor-Specific (Optional)
D24 = 0 no - Vendor-Specific (Optional)
D25 = 0 no - Vendor-Specific (Optional)
D26 = 0 no - Vendor-Specific (Optional)
D27 = 0 no - Vendor-Specific (Optional)
D28 = 0 no - Vendor-Specific (Optional)
D29 = 0 no - Vendor-Specific (Optional)
D30 = 0 no - Vendor-Specific (Optional)
D31 = 0 no - Vendor-Specific (Optional)
iExtension: 0x00
===>Video Control Processing Unit Descriptor<===
bLength: 0x0B
bDescriptorType: 0x24
bDescriptorSubtype: 0x05
bUnitID: 0x03
bSourceID: 0x02
wMaxMultiplier: 0x0000
bControlSize: 0x02
bmControls : 0x00 0x00
D00 = 0 no - Brightness
D01 = 0 no - Contrast
D02 = 0 no - Hue
D03 = 0 no - Saturation
D04 = 0 no - Sharpness
D05 = 0 no - Gamma
D06 = 0 no - White Balance Temperature
D07 = 0 no - White Balance Component
D08 = 0 no - Backlight Compensation
D09 = 0 no - Gain
D10 = 0 no - Power Line Frequency
D11 = 0 no - Hue, Auto
D12 = 0 no - White Balance Temperature, Auto
D13 = 0 no - White Balance Component, Auto
D14 = 0 no - Digital Multiplier
D15 = 0 no - Digital Multiplier Limit
iProcessing : 0x00
===>Video Control Output Terminal Descriptor<===
bLength: 0x09
bDescriptorType: 0x24
bDescriptorSubtype: 0x03
bTerminalID: 0x04
wTerminalType: 0x0101 = (TT_STREAMING)
bAssocTerminal: 0x00
bSourceID: 0x03
iTerminal: 0x00
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x03
bAlternateSetting: 0x00
bNumEndpoints: 0x00
bInterfaceClass: 0x0E -> Video Interface Class
bInterfaceSubClass: 0x02 -> Video Streaming Interface SubClass
bInterfaceProtocol: 0x00
iInterface: 0x00
===>Video Class-Specific VS Video Input Header Descriptor<===
bLength: 0x0E
bDescriptorType: 0x24
bDescriptorSubtype: 0x01
bNumFormats: 0x01
wTotalLength: 0x00C9 -> Validated
bEndpointAddress: 0x82 -> Direction: IN - EndpointID: 2
bmInfo: 0x00 -> Dynamic Format Change not Supported
bTerminalLink: 0x04
bStillCaptureMethod: 0x01 -> Still Capture Method 1
bTriggerSupport: 0x01 -> Hardware Triggering Support
bTriggerUsage: 0x01 -> Host will notify client application of button event
bControlSize: 0x01
Video Payload Format 1 0x00
D00 = 0 no - Key Frame Rate
D01 = 0 no - P Frame Rate
D02 = 0 no - Compression Quality
D03 = 0 no - Compression Window Size
D04 = 0 no - Generate Key Frame
D05 = 0 no - Update Frame Segment
D06 = 0 no - Reserved
D07 = 0 no - Reserved
===>Video Streaming MJPEG Format Type Descriptor<===
bLength: 0x0B
bDescriptorType: 0x24
bDescriptorSubtype: 0x06
bFormatIndex: 0x01
bNumFrameDescriptors: 0x05
bmFlags: 0x01 -> Sample Size is Fixed
bDefaultFrameIndex: 0x01
bAspectRatioX: 0x00
bAspectRatioY: 0x00
bmInterlaceFlags: 0x02
D00 = 0 non-Interlaced stream or variable
D01 = 1 1 field per frame
D02 = 0 Field 1 not first
D03 = 0 Reserved
D4..5 = 0 Field patterns -> Field 1 only
D6..7 = 0 Display Mode -> Bob only
bCopyProtect: 0x00 -> Duplication Unrestricted
===>Video Streaming MJPEG Frame Type Descriptor<===
--->This is the Default (optimum) Frame index
bLength: 0x22
bDescriptorType: 0x24
bDescriptorSubtype: 0x07
bFrameIndex: 0x01
bmCapabilities: 0x02
wWidth: 0x0780 = 1920
wHeight: 0x0438 = 1080
dwMinBitRate: 0x201DEC00
dwMaxBitRate: 0x201DEC00
dwMaxVideoFrameBufferSize: 0x001FA400
dwDefaultFrameInterval: 0x00028B0A = 16.666600 mSec (60.00 Hz)
bFrameIntervalType: 0x02
===>Additional Discrete Frame TypeData
dwFrameInterval[1]: 0x00028B0A = 16.666600 mSec (60.00 Hz)
dwFrameInterval[2]: 0x00051615 = 33.333300 mSec (30.00 Hz)
===>Video Streaming MJPEG Frame Type Descriptor<===
bLength: 0x22
bDescriptorType: 0x24
bDescriptorSubtype: 0x07
bFrameIndex: 0x02
bmCapabilities: 0x02
wWidth: 0x0500 = 1280
wHeight: 0x02D0 = 720
dwMinBitRate: 0x201DEC00
dwMaxBitRate: 0x201DEC00
dwMaxVideoFrameBufferSize: 0x000E1000
dwDefaultFrameInterval: 0x00028B0A = 16.666600 mSec (60.00 Hz)
bFrameIntervalType: 0x02
===>Additional Discrete Frame TypeData
dwFrameInterval[1]: 0x00028B0A = 16.666600 mSec (60.00 Hz)
dwFrameInterval[2]: 0x00051615 = 33.333300 mSec (30.00 Hz)
===>Video Streaming MJPEG Frame Type Descriptor<===
bLength: 0x22
bDescriptorType: 0x24
bDescriptorSubtype: 0x07
bFrameIndex: 0x03
bmCapabilities: 0x02
wWidth: 0x03C0 = 960
wHeight: 0x021C = 540
dwMinBitRate: 0x201DEC00
dwMaxBitRate: 0x201DEC00
dwMaxVideoFrameBufferSize: 0x0007E900
dwDefaultFrameInterval: 0x00028B0A = 16.666600 mSec (60.00 Hz)
bFrameIntervalType: 0x02
===>Additional Discrete Frame TypeData
dwFrameInterval[1]: 0x00028B0A = 16.666600 mSec (60.00 Hz)
dwFrameInterval[2]: 0x00051615 = 33.333300 mSec (30.00 Hz)
===>Video Streaming MJPEG Frame Type Descriptor<===
bLength: 0x22
bDescriptorType: 0x24
bDescriptorSubtype: 0x07
bFrameIndex: 0x04
bmCapabilities: 0x02
wWidth: 0x0320 = 800
wHeight: 0x01C2 = 450
dwMinBitRate: 0x201DEC00
dwMaxBitRate: 0x201DEC00
dwMaxVideoFrameBufferSize: 0x00057E40
dwDefaultFrameInterval: 0x00028B0A = 16.666600 mSec (60.00 Hz)
bFrameIntervalType: 0x02
===>Additional Discrete Frame TypeData
dwFrameInterval[1]: 0x00028B0A = 16.666600 mSec (60.00 Hz)
dwFrameInterval[2]: 0x00051615 = 33.333300 mSec (30.00 Hz)
===>Video Streaming MJPEG Frame Type Descriptor<===
bLength: 0x22
bDescriptorType: 0x24
bDescriptorSubtype: 0x07
bFrameIndex: 0x05
bmCapabilities: 0x02
wWidth: 0x0280 = 640
wHeight: 0x0168 = 360
dwMinBitRate: 0x201DEC00
dwMaxBitRate: 0x201DEC00
dwMaxVideoFrameBufferSize: 0x00038400
dwDefaultFrameInterval: 0x00028B0A = 16.666600 mSec (60.00 Hz)
bFrameIntervalType: 0x02
===>Additional Discrete Frame TypeData
dwFrameInterval[1]: 0x00028B0A = 16.666600 mSec (60.00 Hz)
dwFrameInterval[2]: 0x00051615 = 33.333300 mSec (30.00 Hz)
===>Color Matching Descriptor<===
bLength: 0x06
bDescriptorType: 0x24
bDescriptorSubtype: 0x0D
bColorPrimaries: 0x01
bTransferCharacteristics: 0x01
bMatrixCoefficients: 0x04
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x03
bAlternateSetting: 0x01
bNumEndpoints: 0x01
bInterfaceClass: 0x0E -> Video Interface Class
bInterfaceSubClass: 0x02 -> Video Streaming Interface SubClass
bInterfaceProtocol: 0x00
iInterface: 0x00
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x82 -> Direction: IN - EndpointID: 2
bmAttributes: 0x01 -> Isochronous Transfer Type, Synchronization Type = No Synchronization, Usage Type = Data Endpoint
wMaxPacketSize: 0x1400 = 3 transactions per microframe, 0x400 max bytes
bInterval: 0x01
===>Additional Error Checking<===
PASS: number of MJPEG frame descriptors (5) == number of frame descriptors (5) specified in MJPEG format descriptor(s)
Here is the issue: I used the USB Visual Studio template and modified it to access the video interface, but the WinUSB C++ API is unable to access the IN-endpoint.
It can never find the alternate settings that lead to the video interface IN-endpoint. It can only find the first alternate video settings at index 0, which shows it has no endpoints. I tried everything I could, but I am not able to make WinUSB access the alternate settings index of the video interface, which contains the endpoint information.
I am unable to provide complete C++ code since the forum says I have reached max character count for the post.
I tried different index values and it only finds index values at 0:
UCHAR buffer[1024];
if (!QueryDeviceEndpointsDirect(deviceData.WinusbHandle, &deviceData.IsochronousInPipe, /*desiredAltSetting*/ 0, /*endpointIndex*/ 0)) {
wprintf(L"Failed to query device endpoints\n");
CloseDevice(&deviceData);
return 0;
}
What am I doing wrong?
Also, I just found out that WinUSB is not able to provide fine control to allocate memory to a specific location, such as a pinned memory location, and dump camera frames there. However, I just want WinUSB to work for what it was made for, just for the sake of it, since I spent a whole week on it.
I hope some guidance can be given.
Thanks.