@@ -32,6 +32,7 @@ static int dusbr_verbose = 0;
3232static int rnt_readSupportedFeatures (rnt_hdl_t hdl , struct rnt_dyn_features * dst_dynfeat );
3333
3434#define IS_VERBOSE () (dusbr_verbose)
35+ #define IS_VERY_VERBOSE () (dusbr_verbose>1)
3536
3637struct supported_adapter {
3738 uint16_t vid , pid ;
@@ -536,6 +537,7 @@ int rnt_send_cmd(rnt_hdl_t hdl, const unsigned char *cmd, int cmdlen)
536537 buffer [0 ] = 0x00 ; // report ID set to 0 (device has only one)
537538 memcpy (buffer + 1 , cmd , cmdlen );
538539
540+
539541 while (attempts_left -- ) {
540542 n = hid_send_feature_report (hdev , buffer , sizeof (buffer ));
541543 if (n >= 0 ) {
@@ -596,6 +598,9 @@ int rnt_exchange(rnt_hdl_t hdl, unsigned char *outcmd, int outlen, unsigned char
596598 int n ;
597599 uint64_t time_start , time_now ;
598600
601+ if (IS_VERY_VERBOSE ()) {
602+ printf ("Sending command." ); fflush (stdout );
603+ }
599604 n = rnt_send_cmd (hdl , outcmd , outlen );
600605 if (n < 0 ) {
601606 // only complain when this fails on non-legacy devices
@@ -605,6 +610,7 @@ int rnt_exchange(rnt_hdl_t hdl, unsigned char *outcmd, int outlen, unsigned char
605610 }
606611
607612 time_start = getMilliseconds ();
613+ time_now = time_start ;
608614
609615 /* Answer to the command comes later. For now, this is polled, but in
610616 * the future an interrupt-in transfer could be used. */
@@ -615,7 +621,9 @@ int rnt_exchange(rnt_hdl_t hdl, unsigned char *outcmd, int outlen, unsigned char
615621 break ;
616622 }
617623 if (n == 0 ) {
618- // printf("."); fflush(stdout);
624+ // if (IS_VERY_VERBOSE()) {
625+ // printf("*"); fflush(stdout);
626+ // }
619627 }
620628
621629 time_now = getMilliseconds ();
@@ -626,6 +634,10 @@ int rnt_exchange(rnt_hdl_t hdl, unsigned char *outcmd, int outlen, unsigned char
626634
627635 } while (n == 0 );
628636
637+ if (IS_VERY_VERBOSE ()) {
638+ printf ("Done (%d ms)\n" , (int )(time_now - time_start ));
639+ }
640+
629641 return n ;
630642}
631643
0 commit comments