Author Topic: WinusbDemo on VS2012  (Read 16190 times)

V64

  • Member
  • ***
  • Posts: 4
WinusbDemo on VS2012
« on: December 11, 2012, 12:33:49 pm »
I am starting life with USB by trying to set up this demo to talk to my Nokia Phone.

I have the GUID,PID,VID, changed to Framework 4.5, but I always get the error report from VS2012:

   could not find 'Sub Main' specified for Main Method in file CSC

I am not sure about anything (even if this demo is good place to start) if I run the 'last valid build' it does not find any devices, I asume I have to give it the PID etc about my Phone and then it should at least find it.

Sorry to be such a nooby.

Thanks in advance

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: WinusbDemo on VS2012
« Reply #1 on: December 11, 2012, 12:46:54 pm »
The WinUSB demo is for devices that use the WinUSB driver.

To find out what USB driver your phone uses, look for it in Windows Device Manager.

What do you want to do with the phone via USB?

V64

  • Member
  • ***
  • Posts: 4
Re: WinusbDemo on VS2012
« Reply #2 on: December 11, 2012, 01:51:24 pm »
I have built the demo using VS2010 Express. Modified the .inf file and the WINUSB_DEMO_GUID_STRING to match my Phone details (found by looking in regedit). Running the demo does not find any USB devices.

So my first problem appears to be VS2012 specific, but if I can use 2010 then that is not a problem

I am running W8 under Parallels which sees my Phone correctly - I cant however find it in Windows Device Manager.

I am using the demo as the first 'learn' prior to using the Phone on a USB link to a Monitor device which I want to send an SMS when an alarm condition arises.

Thank-you


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: WinusbDemo on VS2012
« Reply #3 on: December 11, 2012, 04:59:08 pm »
Every USB communication is between a host and a device.

A PC is a USB host.

The WinUSB example only finds devices that the host has assigned the WinUSB driver to. The host assigns the WinUSB driver when it has an INF file that has the device's Vendor ID and Product ID and specifies the WinUSB driver.

Phones typically attach as mass-storage devices (drives).

To access a monitor device, the phone must have USB host capabilities.

This might help you determine if your phone can function as a USB host.

http://www.xda-developers.com/android/determine-your-phones-usb-host-capabilities-with-usb-host-diagnostics/

If your phone supports the host function, you'll need to determine what USB classes the phone supports and see if any of them will work for communications with your monitor device.

If you're designing the monitor device, another option would be to give the monitor device USB host capabilities, but you'll still need to find a USB class that works for your application.

V64

  • Member
  • ***
  • Posts: 4
Re: WinusbDemo on VS2012
« Reply #4 on: December 12, 2012, 09:03:03 am »
I feel we are not 'in step' ... let me summarize

My PC can see my Phone, so my PC is the Host and the Phone is a device (right?) - I can transfer files to/from my Phone (using my Mac) - I am not looking for Host capabilities on my Phone, I want to run it as a device which I can instruct (using a usb host) to read/send an SMS

e.g    ATE0
   ATE0
   OK
   AT+CMGF=1
   OK
   AT+CMGL="REC READ"
   +CMGL: 823,"REC READ","+44******"
   Hello there
   OK

or    ATE0
   ATE0
   OK
   AT+CMGS="+44**********"
   
   > Hello this is a text

   > Next line
   +CMGS: 249

   OK

My understanding is that Winusbdemo will look for a USB device (any, or only one with a specific GUID (and VID/PID)?), and then exchange messages

I am using winusbdemo as a starting point to demonstrate communication from my VisualStudio IDE

What (if any) changes do I need to make to winubdemo files?

I do feel I am out of my depth/comfort zone, but I have to start somewhere!

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: WinusbDemo on VS2012
« Reply #5 on: December 12, 2012, 09:57:43 am »
The WinUSB example only finds devices that the host has assigned the WinUSB driver to. The host assigns the WinUSB driver when it has an INF file that has the device's Vendor ID and Product ID and specifies the WinUSB driver.

The phone's internal descriptors cause the host to identify the device as a mass-storage device.

See these:

http://www.activexperts.com/mobile-messaging-component/howto/gsm-send/vbnet/

http://sharp-coders.blogspot.in/2011/12/send-sms-using-at-commands-via-gms.html

V64

  • Member
  • ***
  • Posts: 4
Re: WinusbDemo on VS2012
« Reply #6 on: December 12, 2012, 03:18:49 pm »
Thank-you for the references - I used sharp-coders example, got it to compile and run with some (version oriented ) edits it appears to run, but the phone does not send any message, and no error throws.

Any two steps forward and one back - thanks again for your help.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: WinusbDemo on VS2012
« Reply #7 on: December 12, 2012, 09:49:18 pm »
Soundsl like a start - good luck!