From 0787741fe8492165892443714065d96cdafd644e Mon Sep 17 00:00:00 2001 From: monte-monte <6649967+monte-monte@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:13:39 +0200 Subject: [PATCH] Deal with 'Issue with hid_send_feature_report' errors on linux --- minichlink/pgm-b003fun.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/minichlink/pgm-b003fun.c b/minichlink/pgm-b003fun.c index 1c7c5c5c..435f7aea 100644 --- a/minichlink/pgm-b003fun.c +++ b/minichlink/pgm-b003fun.c @@ -160,11 +160,16 @@ static int CommitOp( struct B003FunProgrammerStruct * eps ) #endif if( r < 0 ) { - fprintf( stderr, "Warning: Issue with hid_send_feature_report. Retrying: %d\n", retries ); + if( retries ) fprintf( stderr, "Warning: Issue with hid_send_feature_report. Retrying: %d\n", retries ); if( retries++ > 10 ) + { return r; + } else + { + MCF.DelayUS( eps, 5000 ); goto resend; + } } if (eps->no_get_report) return r; @@ -219,11 +224,11 @@ static int B003FunWaitForDoneOp( void * dev, int ignore ) return 0; } -static int B003FunDelayUS( void * dev, int microseconds ) -{ - usleep( microseconds ); - return 0; -} +// static int B003FunDelayUS( void * dev, int microseconds ) +// { +// usleep( microseconds ); +// return 0; +// } // Does not handle erasing static int InternalB003FunWriteBinaryBlob( void * dev, uint32_t address_to_write_to, uint32_t write_size, const uint8_t * blob ) @@ -557,7 +562,7 @@ void * TryInit_B003Fun() MCF.WriteReg32 = 0; MCF.ReadReg32 = 0; MCF.FlushLLCommands = B003FunFlushLLCommands; - MCF.DelayUS = B003FunDelayUS; + // MCF.DelayUS = B003FunDelayUS; MCF.Control3v3 = 0; MCF.SetupInterface = B003FunSetupInterface; MCF.Exit = B003FunExit;