Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Garmin GPS/Bulk Reads



Steve Sisak wrote:

> It looks like you are attempting to read an unknown quantity of data 
> into a 1024 byte buffer with a short (64ms) timeout to cause the read 
> to return if the device responds with less data.
> 
> This is a logical approach and you would think that would work as 
> described -- however that's not the case on Mac OS X.

Interesting stuff, Steve.  Thanx.  The part that I've kind of hand-waved
away here is that I'm using libusb ( http://libusb.sf.net ) and it's not
clear if it's supposed to handle this chunking up of smaller reads and
failing to do so or if this really is my problem to handle.  Since the
identical call to usb_bulk_read works on Linux, I have a feeling that
this may reflect a problem with the OSX backend in libusb.  I suppose
I'll pull the rope from that end for a while...

> (For a high speed device, maxPacketSize is almost always going to be 
> 64 bytes, so for the rest of this conversation, assume that "64" 

Do you perhaps mean "full speed" here to be strictly parlance conforming? 

> BulkRead() will hang until the transfer is aborted by the USB stack 
> which, IIRC, is something like 3 seconds, and therefore not useful.

I was seeing it hang forever-ish.  I waited several minutes before I got
bored and killed it.

> A well designed protocol dealing with sending arbitrarily sized 
> transactions over bulk USB will require that the packet of the 

This one has a length field fairly early in the header that we could
use.   But let's not confuse Garmin protocol with either well designed
OR well implemented. ;-)

> So, the simplest thing is to reduce your buffer size to 64 bytes -- I 
> suspect that the GPS is sending so little data that this will work 
> fine and the lost performance will not be an issue.

Likely so.  I just need to figure out which side of libusb that chunk
reassembly belongs in - my code or in libusb.

> P.S. Sorry this was long, but this seems to be almost an FAQ and I 
> haven't seen a clear answer posted in a long time.


I like it.   Thanx!

RJL
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden

References: 
 >Re: Does Mac OS X 10.3.8 update include USB stack update which may help Mac OS X communicate with Ga (From: Robert Lipe <email@hidden>)
 >Re: Garmin GPS/Bulk Reads (From: Steve Sisak <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.