Author Topic: INF and USB Device GUID detection  (Read 12979 times)

Golgo1972

  • Member
  • ***
  • Posts: 9
INF and USB Device GUID detection
« on: December 29, 2016, 01:58:33 pm »
Jan.

I read the WinUSB section of the site and in the section speaking of the significance of the INF file and how Windows OS (Windows 10 Pro in this case) searches for INF files once I stick the USB device into the PC USB slot. I recall reading that once the USB device is inserted a search for INF files that match the device GUID and/or VID and PID is done and then WinUSB can detect it or not.

If I have a C# project that follows the program directory structure that includes a /drivers directory and in there is a .inf that holds the correct values for the device I have along the the amd64 directory that has the Wdf* and Co*.dll files as per the tutorials I have seen, Windows will scan the entire system for my INF file ?

Does the INF have to be in anywhere specific or does it really matter ?


Thanks

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: INF and USB Device GUID detection
« Reply #1 on: December 29, 2016, 02:22:31 pm »
If the device is using its own INF (not the system WinUSB INF), Windows will look in windows/system32, windows update, and the driver store, and if it doesn't find a match, will ask the user.

https://msdn.microsoft.com/en-us/windows/hardware/drivers/install/where-setup-searches-for-drivers

Golgo1972

  • Member
  • ***
  • Posts: 9
Re: INF and USB Device GUID detection
« Reply #2 on: December 29, 2016, 04:42:08 pm »
I see thank you.

I have a project (C# using MadWizard WinUSB Wrapper that was wrapping your winusb_cs_3.0 project you offer and I now want to call functions on its API to :

1. Use Windows (non-WMI) device attach/detach detection and the attach event handlers to propagate these events to a UI (WPF Windows tray service using NotifyIcon provided as a Nuget package) and on the detection of an inserted device or devices to immediately read off of the inserted USB police body cameras the photos or video data and store (write to a file on the Windows host

Read all photo data from device and write to OS ("@C:\division_100\sessions\<date_timestamp>\photos
\<file.jpg or whatever format>.


In my project structure like your WinUSB_demo, I have a <driver_director> and in here I have a .inf file and one directory called amd64 which has inside if the WinUSBCoInstaller2.dll and WdfCoInstaller01009.dll. I am running Windows 10.

Inside the .inf I have the correct class guid for the device I listed in the device manager and the device guid which I also see in the windows registry. I also have the correct vid and pid values as per the device manager listing. This BTW worked with your WinUSB demo Winforms application. Now I am trying with my application.

What functions in your API would I need to do this ? This would be a Read on the device interface 0 (IN) ?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: INF and USB Device GUID detection
« Reply #3 on: December 29, 2016, 05:50:12 pm »
If the cameras you are reading from are commercial devices (not devices you are developing), they likely belong to a defined USB class. For example, many still-image cameras provide a mass storage interface, and in this case, you would use the file system, not WinUSB, to read the stored images.

WinUSB is for use with devices that do not support a defined class.

If the cameras use WinUSB with a vendor-defined protocol, you need to find out from the vendor how to access the images.

If you are developing the cameras, you define the class or protocols to use in the device firmware.

If this is not what you were asking, please provide more information about the devices and what you are trying to do. For example, I'm not sure what you mean by "This" in "This BTW worked with your WinUSB demo Winforms application."

Golgo1972

  • Member
  • ***
  • Posts: 9
Re: INF and USB Device GUID detection
« Reply #4 on: December 29, 2016, 06:12:51 pm »
I came across this:

https://msdn.microsoft.com/en-us/library/windows/desktop/dn554295(v=vs.85).aspx

And then this:

https://msdn.microsoft.com/en-us/library/windows/hardware/dn303342(v=vs.85).aspx


Looks like the newer WinRT based APIs supported for the Desktop can read/write from the USB mass storage devices or  cameras.

I know like with the Go Pro (digitally signed) or digital film cameras they prompt with a Balloon box on Windows prompting the user to choose an option or they are accessed through File Explorer and the developer can see the drive path to the DCIM media directories timestamped to read from the device and copy the files (if they wanted to) programmatically.

So is it a mistake if if the body cameras I have to use WinUSB ? The original developers used libusb but it's open source and not maintained recently.




Golgo1972

  • Member
  • ***
  • Posts: 9
Re: INF and USB Device GUID detection
« Reply #5 on: December 29, 2016, 06:18:32 pm »
The cameras are developed by third party manufacturer. We are developing an SDK to access the device and do I/O operations on it (transfer data (photos, videos, audio) to respective photos, videos and audios directories on the Windows file system (timestamped).

I did register the body cam as a test as a winusb device by telling windows to update the device's driver using winusb.sys. This is what made your winusbdemo forms app work by seeing its vid/pid, class guid and device guid and spit out data to the textarea that the device is attached or detached.

 

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: INF and USB Device GUID detection
« Reply #6 on: December 29, 2016, 08:43:11 pm »
If you were able to receive data using my example application, you should be able to do the same in an application you write.

If the original developers used libusb, WinUSB should work as well, especially if you only need to support Windows.