I think I have it worked out now. For those interested here is what I have
found:
The Garmin USB GPSRs provide their own device driver, but they do not fall
within the predefined categories of USB devices such as camera,
HumanInterfaceDevice etc. They exposes the data communication through
standard ReadFile and WriteFile communication (which Garmin refers to as the
Bulk In and Bulk Out pipes) and some communication through the
DeviceIOControl command (which Garmin refers to as the Interrupt pipe).
The device(s) can be discovered using the SetupAPI routines (I downloaded
the Delphi wrappers from the Jedi site). The key methods, in order are:
SetupDiCreateDeviceInfoList {get a DeviceSet restricted with the GUID
provided by Garmin}
SetupDiGetClassDevsEx {get the device information for the DeviceSet}
SetupDiEnumDeviceInfo {iterate through the found devices}
SetupDiEnumDeviceInterfaces {iterate throught the interfaces for each
device}
SetupDiGetDeviceInterfaceDetail {get the detail for the interface}
The last one is the crucial routine that gives you the path to use with
CreateFile. I get the feeling that this may be able to be shortcutted
somehow
I've just been playing up till now but I imagine that the tasks to implement
USB support will be to:
1) Create a threaded Link layer object that will handle the Bulk IN and OUT
pipes. The data being sent still conforms to the Garmin protocol apart from
the bits specifically removed by the USB spec (DLE stuffing etc). This
thread will also have to discover if there is a device available on the USB
bus.
2) Create a second thread object that contintually monitors the Interrupt
pipe by calling DeviceIOControl with the IOCTL_GARMIN_USB_INTERRUPT_IN
control code. The first thread will monitor this thread when it needs to
discover if data is waiting in the bulk in pipe.
3) Make sure that the Link Layer thread monitors for a DeviceChange
notification and checks the bus again to see if the device is available.
Alan, I hope that's useful. You are probably the only other person on the
list that this may apply to.
Cheers,
Phil.
----- Original Message -----
From: "Phil Middlemiss" <[EMAIL PROTECTED]>
To: "NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]>
Sent: Monday, June 28, 2004 4:10 PM
Subject: Re: [DUG] USB communication
> OK,
>
> I've figured out how to identify the garmin device and retrieve the path
to
> use in CreateFile. The specification details the command values for the
> DeviceIOControl command, but it refers to Bulk in and out pipes, and the
> interupt pipes. Are these set up using CreateFile for each one?
>
> Cheers,
> Phil.
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, June 25, 2004 4:02 PM
> Subject: RE: [DUG] USB communication
>
>
> > >
> > > I forgot to mention originally that I have a GUID for the device.
> >
> > Yes that would help a lot and yes the HID list is only good for devices
> that
> > use a common usb interface protocol or subclass as I read.
> > Heres another handy link that details in code usb I/O programming.
> > http://www.delcom-eng.com/downloads/USBPRGMNL.pdf
> >
> > Hmmm now I'm getting itchy feet. Just might have to go to Dicksmith this
> > weekend and get that usb gps receiver. ;)
> > I'd be keen to know later if you have success.
> >
> > _______________________________________________
> > Delphi mailing list
> > [EMAIL PROTECTED]
> > http://ns3.123.co.nz/mailman/listinfo/delphi
> >
>
> _______________________________________________
> Delphi mailing list
> [EMAIL PROTECTED]
> http://ns3.123.co.nz/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi