Author Topic: Question about libusb  (Read 13040 times)

EddieSW

  • Member
  • ***
  • Posts: 10
Question about libusb
« on: January 15, 2020, 01:40:03 am »
Hi Jan,
  May I learn the concept about libusb? After I search and study some articles about USB. I have several noob questions, please guide me.
1). Currently the hierarchy of USB system is listed as below, is it correct?

GUI application <-->WinUSB userspace driver(winusb.dll) <-->winusb kernel driver(winusb.sys) <--> usb interface <--> device usb driver

If we use the LibUSB ,
GUI application <-->LibUsb userspace driver <-->winusb kernel driver(winusb.sys) <--> usb interface <--> device usb driver

2). For LibUsb , there are 2 versions, one is LibUsb , another is LibUsbDotNet
I have downloaded the LibUsb source code from Github and it could be compiled successful and it's fine to run them in windows console. If we want to develop the application tool ( GUI tools or others) by using the Visual Studio C# , should I use the LibUsbDotNet?

thank you in advance
Eddie

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Question about libusb
« Reply #1 on: January 15, 2020, 04:26:32 pm »
Yes, that is the purpose of LibUsbDotNet.

EddieSW

  • Member
  • ***
  • Posts: 10
Re: Question about libusb
« Reply #2 on: January 16, 2020, 10:56:25 am »
Hi Jan,
  Thanks, May I learn another question? The LibUsb calls the kernel code (winusb.sys)? Is it correct? Thanks

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Question about libusb
« Reply #3 on: January 16, 2020, 08:55:09 pm »
Yes, the documentation says

Currently it supports the WinUSB and HID drivers for generic USB device access as well as the libusb-win32 and libusbK drivers.

https://github.com/libusb/libusb/wiki/Windows

EddieSW

  • Member
  • ***
  • Posts: 10
Re: Question about libusb
« Reply #4 on: January 17, 2020, 04:14:31 am »
Hi Jan,
  Thanks again. We are evaluating to capture the data from the USB audio device. It should use  isochronous transfers, right?
After I checked the winusb wiki, there a sentence "Doesn't support isochronous transfers prior to Windows 8.1".
So if I want to use ischronous transfer on windows 7. Do we have another solution? It is possible to use the LibUsb and winusb.sys is able to solve this issue?
According to your experience, have you ever handled any projects which need to implement the windows USB driver of the user and kernel space?

thank you in advance,
Eddie

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Question about libusb
« Reply #5 on: January 17, 2020, 10:51:36 am »
Yes, you will need a different solution to support isochronous previous to Windows 8.1. I would suggest looking into using the USB audio drivers.

https://docs.microsoft.com/en-us/windows/win32/directshow/audio-capture

https://docs.microsoft.com/en-us/windows-hardware/drivers/audio/rendering-and-capturing-audio-content-by-using-the-usbaudio-driver

EddieSW

  • Member
  • ***
  • Posts: 10
Re: Question about libusb
« Reply #6 on: January 20, 2020, 04:46:27 am »
Hi Jan,
  Thank you again. I will study your suggestion. May I learn another question?
There are 3 GUIDs , I  google them from web and try to identify them,
1st: 4d1e55b2-f16f-11cf-88cb-001111000030   for USB HID interface, correct?
2nd: 745A17A0-74D3-11D0-B6FE-00A0C90F57DA  for USB HID Device, correct?
3rd: F72FE0D4-CBCB-407d-8814-9ED673D0DD6B   it looks like a interface GUID, what difference between 1st and 3rd ?

Note: I use your winusb_cs application tool to find my device, the ClassGUID of device information shows  745A17A0-74D3-11D0-B6FE-00A0C90F57DA , so  my device is HID device , correct?

Note2: I think the winusb_cs uses the VID and PID to find the device, the setting of GUID interface won't effect the searching, correct?


thank you in advance,
Eddie
« Last Edit: January 20, 2020, 07:50:35 am by EddieSW »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Question about libusb
« Reply #7 on: January 20, 2020, 09:37:10 am »
F72FE0D4-CBCB-407d-8814-9ED673D0DD6B   it looks like a interface GUID, what difference between 1st and 3rd ?

https://github.com/pbatard/libwdi/issues/17

Also see

https://docs.microsoft.com/en-us/windows-hardware/drivers/install/setup-classes-versus-interface-classes

yes to the others