@@ -69,10 +69,10 @@ static const struct deviceList
69
69
//#define DUMP_BLOCK
70
70
71
71
/* How many transfer buffers from the source to allocate */
72
- #define NUM_RAW_BLOCKS (10 )
72
+ #define NUM_RAW_BLOCKS (3 )
73
73
74
74
/* What time spread to defer them over (less than orbmortem timeout) */
75
- #define BLOCK_TOTAL_SPREAD (400 )
75
+ #define BLOCK_TOTAL_SPREAD (100 )
76
76
77
77
/* Interval between blocks for timeouts */
78
78
#define BLOCK_TIMEOUT_INTERVAL_MS (BLOCK_TOTAL_SPREAD/NUM_RAW_BLOCKS)
@@ -247,6 +247,16 @@ static int _setSerialConfig ( int f, speed_t speed )
247
247
}
248
248
#endif
249
249
// ====================================================================================================
250
+ static void _doExit ( void )
251
+
252
+ {
253
+ _r .ending = true;
254
+
255
+ nwclientShutdown ( _r .n );
256
+ /* Give them a bit of time, then we're leaving anyway */
257
+ usleep ( 200 );
258
+ }
259
+ // ====================================================================================================
250
260
void _printHelp ( char * progName )
251
261
252
262
{
@@ -499,12 +509,14 @@ void *_checkInterval( void *params )
499
509
{
500
510
struct TPIUCommsStats * c = TPIUGetCommsStats ( & r -> t );
501
511
512
+ /* For now we don't transmit this...
502
513
genericsPrintf( C_RESET " LEDS: %s%s%s%s" C_RESET " Frames: "C_DATA "%u" C_RESET,
503
514
c->leds & 1 ? C_DATA_IND "d" : C_RESET "-",
504
515
c->leds & 2 ? C_TX_IND "t" : C_RESET "-",
505
516
c->leds & 0x20 ? C_OVF_IND "O" : C_RESET "-",
506
517
c->leds & 0x80 ? C_HB_IND "h" : C_RESET "-",
507
518
c->totalFrames );
519
+ */
508
520
509
521
genericsReport ( V_INFO , " Pending:%5d Lost:%5d" ,
510
522
c -> pendingCount ,
@@ -671,7 +683,8 @@ static void _usb_callback( struct libusb_transfer *t )
671
683
/* For the USB case the ringbuffer isn't used .. packets are sent directly from this callback */
672
684
673
685
{
674
- if ( t -> status == LIBUSB_TRANSFER_COMPLETED && ( t -> actual_length > 0 ) )
686
+ /* Whatever the status that comes back, there may be data... */
687
+ if ( t -> actual_length > 0 )
675
688
{
676
689
_r .intervalBytes += t -> actual_length ;
677
690
@@ -821,12 +834,24 @@ int usbFeeder( struct RunTime *r )
821
834
BLOCK_TIMEOUT_INTERVAL_MS * ( t + 1 )
822
835
);
823
836
824
- libusb_submit_transfer ( r -> rawBlock [t ].usbtfr );
837
+ int ret = libusb_submit_transfer ( r -> rawBlock [t ].usbtfr );
838
+
839
+ if ( ret )
840
+ {
841
+ genericsReport ( V_ERROR , "Error submitting USB requests %d" EOL , ret );
842
+ _doExit ();
843
+ }
825
844
}
826
845
827
846
while ( !r -> ending )
828
847
{
829
- libusb_handle_events_completed ( NULL , ( int * )& r -> ending );
848
+ int ret = libusb_handle_events_completed ( NULL , ( int * )& r -> ending );
849
+
850
+ if ( ret )
851
+ {
852
+ genericsReport ( V_ERROR , "Error waiting for USB requests to complete %d" EOL , ret );
853
+ _doExit ();
854
+ }
830
855
}
831
856
832
857
libusb_close ( handle );
@@ -1013,16 +1038,6 @@ int fileFeeder( struct RunTime *r )
1013
1038
return true;
1014
1039
}
1015
1040
// ====================================================================================================
1016
- static void _doExit ( void )
1017
-
1018
- {
1019
- _r .ending = true;
1020
-
1021
- nwclientShutdown ( _r .n );
1022
- /* Give them a bit of time, then we're leaving anyway */
1023
- usleep ( 200 );
1024
- }
1025
- // ====================================================================================================
1026
1041
int main ( int argc , char * argv [] )
1027
1042
1028
1043
{
0 commit comments