Author Topic: Intercepting a USB Interrupt data packet  (Read 13624 times)

rallysjd

  • Member
  • ***
  • Posts: 21
    • PiXCL Automation Technologies Inc
Intercepting a USB Interrupt data packet
« on: August 09, 2012, 05:34:46 pm »
I'm working with two (rather inadequately supported) composite video camera devices (DirectShow compatible) that both load the usbvideo mini-driver. These cameras have one or two buttons that can be used to trigger operations in the user app. I can capture and examine the interrupt packet (port 81, 4 bytes) with "Usb Port Monitor" which uses a filter driver.

Video display and capture uses DirectShow API calls. The button interrupt I assume is coming via the usbvideo.sys or ks.sys drivers.

What I would like to do is put a thread in my app that watches for the button press event, so I can handle it the way I want. The camera sensor appears in Device Manager "Imaging Devices" but they are also Composite Devices. The buttons don't list in the HID class.

I spent most of today looking at the Ks* API and the MS AVStream Minidrivers Reference, but I feel I'm looking in the wrong place. Do I need a filter driver, or is there an easier way?

Any pointers are appreciated.
SD

Tsuneo

  • Frequent Contributor
  • ****
  • Posts: 145
Re: Intercepting a USB Interrupt data packet
« Reply #1 on: August 09, 2012, 06:59:11 pm »
Quote
I can capture and examine the interrupt packet (port 81, 4 bytes) with "Usb Port Monitor" which uses a filter driver.
Read out the descriptors of the device, and specify the interface, to which the endpoint (0x81) belongs.

a) If it is a Status Interrupt Endpoint of Video Control Interface, the bOriginator fields on the packet tells the unit (terminal) ID.
Refer to "Table 2-1 Status Packet Format" on the UVC spec (USB_Video_Class_1.1.pdf)
http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1_090711.zip

Back to the descriptors again, specify the unit of the ID.
Also, bStatusType on the packet describes more on the event.
These information suggest the way how you catch it on video API.

WDK has utilities to play with.

WDK 7.1.0 (619.8 MB)
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11800
\WINDDK\7600.16385.1\tools\avstream\<platform>\
- UVCview.exe
- KsStudio.exe

UVCview.exe reads out descriptors from the target device.
KsStudio.exe captures video event.

b) If it is a HID interrupt endpoint, capture the input report as usual HID device.

Tsuneo