]> sigrok.org Git - libsigrok.git/blobdiff - hardware/norma-dmm/api.c
Add struct sr_session parameter to all session source backends.
[libsigrok.git] / hardware / norma-dmm / api.c
index e0397c01d2c4eb416bd46f76763917edceb73685..798b60e151b7082ab8dfc1d1804b0d3db8397edd 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/** @file
+ *  Norma DM9x0/Siemens B102x DMMs driver.
+ *  @internal
+ */
+
 #include "protocol.h"
 
 static const int32_t hwopts[] = {
@@ -122,6 +127,7 @@ static GSList *do_scan(struct sr_dev_driver* drv, GSList *options)
 
        snprintf(req, sizeof(req), "%s\r\n",
                 nmadmm_requests[NMADMM_REQ_IDN].req_str);
+       g_usleep(150 * 1000); /* Wait a little to allow serial port to settle. */
        for (cnt = 0; cnt < 7; cnt++) {
                if (serial_write(serial, req, strlen(req)) == -1) {
                        sr_err("Unable to send identification request: %d %s.",
@@ -129,7 +135,7 @@ static GSList *do_scan(struct sr_dev_driver* drv, GSList *options)
                        return NULL;
                }
                len = BUF_MAX;
-               serial_readline(serial, &buf, &len, 1500);
+               serial_readline(serial, &buf, &len, NMADMM_TIMEOUT_MS);
                if (!len)
                        continue;
                buf[BUF_MAX - 1] = '\0';
@@ -311,8 +317,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
 
        /* Poll every 100ms, or whenever some data comes in. */
        serial = sdi->conn;
-       serial_source_add(serial, G_IO_IN, 100, norma_dmm_receive_data,
-                     (void *)sdi);
+       serial_source_add(sdi->session, serial, G_IO_IN, 100,
+                       norma_dmm_receive_data, (void *)sdi);
 
        return SR_OK;
 }