Author Topic: Testing USB detecting code  (Read 10505 times)

pgscannell

  • Member
  • ***
  • Posts: 3
Testing USB detecting code
« on: December 17, 2010, 10:35:20 am »
I am new to USB development.  I just bought the "USB Complete Fourth Edition: The Developer's Guide" by Jan Axelson.

I downloaded the sample program Generic HID Tester.  I was able to successfully compile and run it in VS 2008.

I ran the Microsoft utility USBView and saw a mapping of all my USB connections on my PC to include the Vendor and Product ID's of each.

When I enter those IDs into the HID Tester and click "Find My Device", it always return "Device not found"

Why?

Thanks in advanced,

Paul Scannell

[attachment deleted by admin]

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Testing USB detecting code
« Reply #1 on: December 17, 2010, 10:43:00 am »
My generic HID applications are for generic (not system mouse or keyboard) HID-class devices only. My HID page has links to generic HID firmware that works with the applications.

To communicate with non-HIDs, see the first questions here:

http://www.lvr.com/usbfaq.htm

Jan

pgscannell

  • Member
  • ***
  • Posts: 3
Re: Testing USB detecting code
« Reply #2 on: December 17, 2010, 11:48:30 am »
Would it be a wrong presumption of mine, to assume that a connected document scanner, flash drive, or digital camera, wouldn't be considered an HID device?

If so, then what kind of USB device can I connect to my PC so that program can detect it?

Thanks,
Paul

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Testing USB detecting code
« Reply #3 on: December 17, 2010, 11:52:25 am »
Scanners are still image class. Flash drives and most cameras are mass storage class. My HID page has links to generic HID firmware that works with the generic HID host applications. The generic HID software is meant for communicating with devices that have vendor-defined functions.

Jan

pgscannell

  • Member
  • ***
  • Posts: 3
Re: Testing USB detecting code
« Reply #4 on: December 17, 2010, 12:08:51 pm »
Pardon my ignorance, but this is the very first time I've done this kind of development.  I went to your usbfaq.htm page but don't know what to look for.

The USBView.exe that I downloaded is able to communicate with my USP ports and consequently show all the devices connected.

What kind of demo source code do you have that I can load up into VS 2008 that does that kind of thing so I can run with debug to learn what's going on?

Thanks,
Paul

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Testing USB detecting code
« Reply #5 on: December 17, 2010, 01:13:44 pm »
The WDK includes source code for usbview.

If you want to exchange data with a device, you have to know what driver it's using. From the FAQ:

How an application communicates with a USB device depends on the device driver that Windows has assigned to the device. The choice of driver in turn depends on finding a match between the information in the descriptors that Windows retrieves on device attachment or bootup and the information stored in the PC's INF files. Typically, the application doesn't have to know whether the device uses USB or another interface. For example, applications access files on a drive in the same way whether the drive uses USB, IEEE-1394, SCSI, ATAPI, or another interface. The interface-specific details are handled at a lower level. Some devices use drivers included with Windows. Others use a vendor-specific driver that he user must install.

Jan