On Sun, Dec 13, 2020 at 03:30:45PM +0300, Mike Banon wrote:
Each try takes about ~3300 ticks of a timer (got this info by some inserts of u32 cur = timer_read(); dprintf(1, "tries %d=%d\n", tries, cur);). A bit unsure how it translates to seconds (the CPU frequency of my laptop fluctuates between 1.4GHz and 2.5GHz), so I did some stopwatch tests and can't notice anything. It's an extra ~0.3 seconds delay if I plug this USB drive at all, but no delay difference between a normal and "write protect" mode (only in "write protect" it behaves erroneously).
I've looked through a lot of logs and this USB in a "write protect" mode always works on a 2nd try, even if I insert "msleep(5000);" before the 1st try, so I guess it's a try based. As this code is only for blockcmd, I'm not getting any extra delay if i.e. a DVD disc isn't present in a DVD drive. And to be honest I haven't encountered any cases where a 3rd try was needed, I put one more just in case and to make my fix more universal.
Thanks. I committed this change.
-Kevin