Author Topic: deploying Winusb application in C++  (Read 5053 times)

ADB

  • Member
  • ***
  • Posts: 26
deploying Winusb application in C++
« on: November 15, 2019, 05:55:58 am »
Hi Jan,

I've developed a C++ console program to communicate with a microcontroller board using a Winusb template in Visual Studio 2017. My program is in 2 parts, a USB application using WindowsApplicationForDrivers10.0 platform which is a dll. The 2nd part is an exe application which calls the aforementioned dll and also uses WindowsApplicationForDrivers10.0 platform. The program works fine from within Visual Studio. I followed the procedure here to deploy:
https://docs.microsoft.com/en-us/cpp/windows/walkthrough-deploying-a-visual-cpp-application-by-using-a-setup-project?view=vs-2019
Unfortunately the deployed program is unable to communicate over USB.

Do you have any experience with this?

Regards,

Alan

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: deploying Winusb application in C++
« Reply #1 on: November 15, 2019, 12:33:45 pm »
Hard to say without more information. What do you mean by "unable to communicate over USB"? What happens when you run the application? Where does it fail?

ADB

  • Member
  • ***
  • Posts: 26
Re: deploying Winusb application in C++
« Reply #2 on: November 20, 2019, 07:55:24 am »
Hi Jan,

Thank you for getting back to me. I have been doing my development on Windows 10 with Visual Studio 2017. I've been able to get my hands on a laptop with a fresh installation of Windows 10. I was able to add debug comments to my application and compare them to what I was seeing on my development machine.

My USB device has 2 interfaces. I've used Microsoft OS descriptors to specify that I want to use winusb. My USB device's 2 interfaces were coming up correctly in Windows' device manager as using winusb. Upon closer examination of the registry here:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_1FC9&PID_008A&MI_03\6&2ccef474&36&0003\Device Parameters
I noticed that neither of my USB interfaces had DeviceInterfaceGUIDs. Once I created these keys manually, my PC application worked ok.

Does this mean that I haven't implemented my Microsoft OS descriptors correctly?

Thanks in advance for your comments,

Regards,

Alan

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: deploying Winusb application in C++
« Reply #3 on: November 21, 2019, 10:32:48 am »
That could explain it.

If you make any changes to the descriptors, to keep Windows from using previous descriptors, with the device attached, open Windows Device Manager and uninstall the device (under Driver). Then reattach.

bpaddock

  • Frequent Contributor
  • ****
  • Posts: 66
Re: deploying Winusb application in C++
« Reply #4 on: November 22, 2019, 08:09:39 am »
Is upping the descriptors version number sufficient to get around Windows descriptor caching?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: deploying Winusb application in C++
« Reply #5 on: November 22, 2019, 08:23:45 pm »
You can change idProduct or bcdDevice.