util:nanotool: use delay while executing SelfTest immediatly after DisableSensor
Most of drivers complete enable/disable after SPI/I2C callback
transaction return. Since enable/disable functions return immediatly
before it, some time ensure entire process is completed.
Change-Id: Iba41a2820b01367f880ac1f4c559680e538ca1b4
Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
diff --git a/util/nanotool/nanotool.cpp b/util/nanotool/nanotool.cpp
index 71251a5..0491f65 100644
--- a/util/nanotool/nanotool.cpp
+++ b/util/nanotool/nanotool.cpp
@@ -16,6 +16,7 @@
#include <getopt.h>
#include <signal.h>
+#include <unistd.h>
#include <cstdlib>
#include <cstring>
@@ -466,6 +467,12 @@
}
case NanotoolCommand::Test: {
hub->DisableSensors(args->sensors);
+
+ /* Most of drivers complete enable/disable after SPI/I2C callback
+ transaction return. Since enable/disable functions return immediatly
+ before it, some time ensure entire process is completed. */
+ usleep(100000);
+
success = hub->TestSensors(args->sensors);
break;
}