From e5e47efcd4f97089378f2351d16b555b970ba610 Mon Sep 17 00:00:00 2001
From: Alessio Igor Bogani <alessio.bogani@elettra.eu>
Date: Wed, 31 Aug 2022 16:29:38 +0200
Subject: [PATCH] Waiting that device comes up

---
 src/Agilent4uhv.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/Agilent4uhv.cpp b/src/Agilent4uhv.cpp
index 4d08653..3e29734 100644
--- a/src/Agilent4uhv.cpp
+++ b/src/Agilent4uhv.cpp
@@ -249,6 +249,12 @@ void Agilent4uhv::init_device()
 		attr_Model_read[0] = new char[MAX_DEVSTRING_LENGTH];
 		attr_SerialNumber_read[0] = new char[MAX_DEVSTRING_LENGTH];
 
+		// Waiting the device
+		int retries = 0;
+		while(get_state2() == 9 && retries++ < 5) {
+			sleep(1);
+		}
+
 		/* Che if the mBar is pressure unit used */
 		int pressure_unit;
 		read_window(600, pressure_unit);
-- 
GitLab