]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/conrad-digi-35-cpu/protocol.c
uni-t-ut181a: silence compiler warning, use of uninitialized variable
[libsigrok.git] / src / hardware / conrad-digi-35-cpu / protocol.c
index 7657b319bc2d59a4e2d4555203794689673a1e2f..78f7d1c34c0f7136db9396f374b590fd45c440de 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/**
- * @file
- * <em>Conrad DIGI 35 CPU</em> power supply driver
- * @internal
- */
-
+#include <config.h>
 #include "protocol.h"
 
 /**
@@ -48,8 +43,9 @@ SR_PRIV int send_msg1(const struct sr_dev_inst *sdi, char cmd, int param)
 
        sr_spew("send_msg1(): %c%c%c%c\\r", buf[0], buf[1], buf[2], buf[3]);
 
-       if (serial_write(serial, buf, sizeof(buf)) == -1) {
-               sr_err("Write error for cmd=%c: %d %s", cmd, errno, strerror(errno));
+       if (serial_write_blocking(serial, buf, sizeof(buf),
+                       serial_timeout(serial, sizeof(buf))) < (int)sizeof(buf)) {
+               sr_err("Write error for cmd=%c", cmd);
                return SR_ERR;
        }
 
@@ -57,7 +53,7 @@ SR_PRIV int send_msg1(const struct sr_dev_inst *sdi, char cmd, int param)
         * Wait 50ms to ensure that the device does not swallow any of the
         * following commands.
         */
-       g_usleep(50000);
+       g_usleep(50 * 1000);
 
        return SR_OK;
 }