Author Topic: winusb_cs: cannot communicate with device  (Read 8977 times)

nikamm

  • Member
  • ***
  • Posts: 4
winusb_cs: cannot communicate with device
« on: December 04, 2013, 01:15:10 am »
hi,

I am in the process of developing a usb device(control & bulk transfer), i am using winusb_cs application thanks to Jan Axelson for a neat application.

i modified my device firmware as per winusb_cs(descriptors,endpoints etc.)
when i run the host application i can see device found message but i cannot communicate with my device(as of now i am just using control read transfer),  when i click control read transfer button, i just get message my device found,my vid pid and all that.

in the device firmware i have not added MS OS descriptors, is it necessary to add OS descriptors to be able to use winusb_cs?
do they(OS descriptors) work with windows 7? as i am using win-7.

i suspect that host application never gets a winusb handle and when i try for control read transfer it cannot establish a connection.

where should i check for possible mistake, any help regarding this is appreciated.
Thank you,

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: winusb_cs: cannot communicate with device
« Reply #1 on: December 04, 2013, 11:55:37 am »
The two options are:

1. Use a vendor-provided INF file with the GUID and Vendor ID and Product ID.

2. Use the Windows winusb.inf with MS OS descriptors in the device.

Use a breakpoint to see if you have a valid handle.

nikamm

  • Member
  • ***
  • Posts: 4
Re: winusb_cs: cannot communicate with device
« Reply #2 on: December 05, 2013, 08:10:33 am »
Thanks Jan for your reply,

1) when i debugged host application (using GetLastError() after SetupDiEnumDeviceInterfaces) to retrieve possible error, i got error ERROR_NO_MORE_ITEMS. so it is obvious that application cannot get handle for device. why it is that my device is not listed in deviceInfoSet even if it gets enumerated successfully.i am using custom inf file with specified interface guid.

please help, i am confused here,

thanks,

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: winusb_cs: cannot communicate with device
« Reply #3 on: December 05, 2013, 10:22:27 am »
Your first message reported that you had "Device Found." If that's the case, the software found the device. If that is no longer true, what did you change?

nikamm

  • Member
  • ***
  • Posts: 4
Re: winusb_cs: cannot communicate with device
« Reply #4 on: December 06, 2013, 02:31:43 am »
hi Jan,

this is the message on output window of pc application

My device ound(WMI):
Caption: USBApplication1 Device
Description: USBApplication1 Device
Manufacturer:
Name: USBApplication1 Device
CompatibleID: System.String[]
PNPDeviceID: USB\VID_0916&PID_2039\6&29E6B3C2&0&3
DeviceID: USB\VID_0916&PID_2039\6&29E6B3C2&0&3
ClassGUID: {ecceff35-146c-4ff3-acd9-8f992d09acdd}
Availability:
------


> as a said in my first post i get message MY Device Found(WMI)

> but i cannot get device handle using guid.

> this means WMI can find device using VID&PID, but the function FindDeviceFromGuid() cannot get a device handle.

what do you suggest?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: winusb_cs: cannot communicate with device
« Reply #5 on: December 06, 2013, 10:14:40 am »
Use breakpoints and single stepping to find the first failure. At that point, examine the failure message and any passed parameters. Post back here if you still have questions.

nikamm

  • Member
  • ***
  • Posts: 4
Re: winusb_cs: cannot communicate with device
« Reply #6 on: December 11, 2013, 04:06:42 am »


I got it working,i changed guid in host application from {ecceff35-146c-4ff3-acd9-8f992d09acdd} to {513d39da-59ac-4adc-8ea1-0676af7770b9}.

but my .inf file(which i used to load winusb driver) still uses {ecceff35-146c-4ff3-acd9-8f992d09acdd}, i dont understand whether these two guid's have some relation in between them.

anyway, thanks Jan for guiding me through the process.

one question- if i were to write the host application in c++ instead of c# what changes i must do in winusb_cs application.

thank you,

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: winusb_cs: cannot communicate with device
« Reply #7 on: December 11, 2013, 10:20:47 am »
Check again; the GUID must match the GUID in a vendor-provided INF file or an MS OS descriptor.

If using C/C++, you can use Microsoft's WinUSB documentation pretty much as-is without having to convert for .NET. You would need to rewrite the user interface code.