Author Topic: Send USB Control Tranfer in User-mode  (Read 27029 times)

androjes

  • Member
  • ***
  • Posts: 6
Send USB Control Tranfer in User-mode
« on: January 13, 2011, 01:20:03 pm »
Hello every body.
My goal is to send control transfer (specific command) to the device which is managed by the usbvideo.sys driver (UVC).
After long research, I've saw 2 solutions:
1- Using libusb as upper filter driver. it works well but my problem is how to include libusb-filter in the INF file as the upper filter above the usbvideo.sys?
2- I plan to use DeviceIOControl but I don't really know what code control to use?

Could someone give me one working sample or some help.v

Thanks...

androjes

  • Member
  • ***
  • Posts: 6
Re: Send USB Control Tranfer in User-mode
« Reply #1 on: January 14, 2011, 06:09:14 am »
No answer.

Does someone know how to send URB request (UsbBuildVendorRequest) from user mode with C#.NET.

Thanks

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Send USB Control Tranfer in User-mode
« Reply #2 on: January 14, 2011, 10:34:57 am »
The libusb forum is probably a better place for advice specific to libusb. If you're using a vendor-defined driver, you define the DeviceIoControl codes as allowed by the driver's API.

Jan

androjes

  • Member
  • ***
  • Posts: 6
Re: Send USB Control Tranfer in User-mode
« Reply #3 on: January 14, 2011, 01:23:11 pm »
I'm using the usbvideo.sys video class driver (provided by windows).
So I don't know what control code to use  :'(. I want to use "USBUSER_OP_SEND_RAW_COMMAND" but i's not documented Someone else have a sample of this?

Thanks.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Send USB Control Tranfer in User-mode
« Reply #4 on: January 14, 2011, 05:10:05 pm »
It's documented here:

http://msdn.microsoft.com/en-us/library/ff537344%28VS.85%29.aspx

USBUSER_OP_SEND_RAW_COMMAND
Do not use this request.

What are you trying to accomplish on the video device?

Jan

androjes

  • Member
  • ***
  • Posts: 6
Re: Send USB Control Tranfer in User-mode
« Reply #5 on: January 15, 2011, 03:03:53 pm »
>It's documented here:
>http://msdn.microsoft.com/en-us/library/ff537344%28VS.85%29.aspx
>USBUSER_OP_SEND_RAW_COMMAND
>Do not use this request.


The documentation is not enough. Even Windows don't recommend to use this request. The format of data (after the HEADER) is not defined.

>What are you trying to accomplish on the video device?
I just want to send a control transfer (EP0) through video class driver (usbvideo.sys).

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Send USB Control Tranfer in User-mode
« Reply #6 on: January 15, 2011, 04:52:04 pm »
>I just want to send a control transfer (EP0) through video class driver (usbvideo.sys).

For what purpose? Maybe you can accomplish the same thing at a higher level with DirectShow.

Jan

androjes

  • Member
  • ***
  • Posts: 6
Re: Send USB Control Tranfer in User-mode
« Reply #7 on: January 15, 2011, 06:00:06 pm »
>For what purpose? Maybe you can accomplish the same thing at a higher level with DirectShow.
I want to send vendor command to my device (access to register of sensor). So I don't think that directshow can do that  ???

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Send USB Control Tranfer in User-mode
« Reply #8 on: January 16, 2011, 12:08:50 am »
If it's a vendor-defined command, you need to provide a vendor-defined driver to support it.

Jan

androjes

  • Member
  • ***
  • Posts: 6
Re: Send USB Control Tranfer in User-mode
« Reply #9 on: January 18, 2011, 05:18:00 am »
>If it's a vendor-defined command, you need to provide a vendor-defined driver to support it.
I couldn't develop a driver like usbvideo.sys. I just want to extend its functionality which can allow to send control transfer from user space.
My last solution is installing "libusb-win32" as filter driver of usbvideo.sys and I'll use LibUsBDotNet for sending control transfer from my application.
My problem now is to write the corresponding INF file  ???  ???  ???

Thanks Jan.

xiaofan

  • Member
  • ***
  • Posts: 2
Re: Send USB Control Tranfer in User-mode
« Reply #10 on: January 28, 2011, 02:00:33 am »
If you download the latest libusb-win32 release, you can use the GUI filter wizard to install the filter driver to that specific device. You do not need an inf file.

Take note that libusb-win32 filter may not work with some device and according to some driver experts that it has no future. BTW, I am one of the admins of libusb-win32 project.

The other way is to change the firmware and have one extra interface without any endpoints. Use WinUSB (or libusb-win32 device driver) for that interface for the vendor specific control transfer.