On 02/15/2014 06:12 PM, Scott Talbert wrote:
> Hmm.  Maybe try adding a printf() in hidapi when it drops a packet to 
> ensure that that's the problem we're really seeing?  That should help 
> narrow it down.

We're not dropping packets there... and in fact, with some extra
instrumentation we seem to have more than one distinct problem. So here's a
missing sequence number... all messages starring with "PHIL" are from hidapi:

DEBUG (ReadFlash): Expected seq BC
DEBUG (ReadFlash): Next expected seq CD
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash): Expected seq CD
DEBUG (ReadFlash): Next expected seq DE
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash): Expected seq DE
DEBUG (ReadFlash): Next expected seq EF
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash): Expected seq EF
DEBUG (ReadFlash): Invalid sequence want: EF got: 11
Failed to dump config: Error while reading from the remote
Failed with error 3


Scrolling up, you can see that hid_report_callback never queued more than 3
packets:

PHIL: hid_report_callback: 3th pckt
PHIL: hid_report_callback: sending pthread signal
PHIL: hid_report_callback: unlocking
PHIL: hid_report_callback: returning
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash):
Expected seq BC


Now, if I run a bunch more times, eventually I get:

DEBUG (ReadFlash): Expected seq EF
DEBUG (ReadFlash): Next expected seq 00
PHIL: hid_read_timeout: no data.
PHIL: hid_read_timeout: non-blocking 60
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 0
DEBUG (HID_ReadReport): USB read timed out
Failed to dump config: Error while reading from the remote
Failed with error 3


Note the USB timeout! That's with the timeout bumped to 1s, from 500ms. Hmmm.
If I bring it up to 5s it's VERY rare (I can sometimes trigger it, but only
after lots of times in a loop). Either way, the next time:

PHIL: hid_report_callback: 5th pckt
PHIL: hid_report_callback: sending pthread signal
PHIL: hid_report_callback: unlocking
PHIL: hid_report_callback: returning
...
DEBUG (ReadFlash): Expected seq 89
DEBUG (ReadFlash): Next expected seq 9A
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash): Expected seq 9A
DEBUG (ReadFlash): Invalid sequence want: 9A got: bc
Failed to dump config: Error while reading from the remote
Failed with error 3


What's really strange is, in theory we queue 5 packets, and then read 6
packets when we hit the missing ones:

PHIL: hid_report_callback: 5th pckt
PHIL: hid_report_callback: sending pthread signal
PHIL: hid_report_callback: unlocking
PHIL: hid_report_callback: returning
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash): Expected seq 34
DEBUG (ReadFlash): Next expected seq 45
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash): Expected seq 45
DEBUG (ReadFlash): Next expected seq 56
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash): Expected seq 56
DEBUG (ReadFlash): Next expected seq 67
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash): Expected seq 67
DEBUG (ReadFlash): Next expected seq 78
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash): Expected seq 78
DEBUG (ReadFlash): Next expected seq 89
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash): Expected seq 89
DEBUG (ReadFlash): Next expected seq 9A
PHIL: hid_read_timeout: calling return_data().
PHIL: hid_read_timeout: unlocking...
PHIL: hid_read_timeout: returning 64
DEBUG (ReadFlash): Expected seq 9A
DEBUG (ReadFlash): Invalid sequence want: 9A got: cd
Failed to dump config: Error while reading from the remote
Failed with error 3


I'm lost.

-- 
Phil Dibowitz                             p...@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Be who you are and say what you feel, because those who mind don't matter
 and those who matter don't mind."
 - Dr. Seuss


Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel

Reply via email to