Read data from USB using C++ on Windows 7 -


i'm trying read output trimble sps-361 gps receiver, connected windows 7 machine via usb, using c++ (preferably) or java. know people have asked similar questions, can't seem find i'm looking for. sounds libusb best bet, true? if so, tutorial/guide/example code?

it sounds need install/write sort of device-specific driver , can read data off device c++ through libusb. general process reading usb or confused?

to summarize think need (i know i'm on place):

  1. an explanation/tutorial of how communicate usb's in general
  2. a more specific tutorial/guide/example code of how read data off usb device on windows 7
  3. what libusb , looking for?

well, if want raw data device, can find in usb device list , literally read file.

start getting devices:

hdevinfo hdevinfo = setupdigetclassdevs( &hidwatch::guid_devinterface_hid, 0, 0, digcf_deviceinterface ); 

enumerate each 1 until find you're looking for:

setupdienuminterfacedevice( hdevinfo, null, &hidwatch::guid_devinterface_hid, index++, &interfaceinfodata ) 

get device detail via setupdigetinterfacedevicedetail... open file handle device path via createfile generic_read access... run deviceiocontrol product string using ioctl_hid_get_product_string. if it's not device, close file closehandle. if yours, sit in loop (preferably on thread) doing readfile , you'll raw records device.

that should going...


Comments