size_t len;
char buf[128], *b;
- if ((fd = serial_open(conn, O_RDWR|O_NONBLOCK)) == -1) {
+ if ((fd = serial_open(conn, O_RDONLY|O_NONBLOCK)) == -1) {
sr_err("radioshack-dmm: unable to open %s: %s",
conn, strerror(errno));
return NULL;
return NULL;
}
+ sr_info("radioshack-dmm: probing port %s readonly", conn);
+
drvc = di->priv;
b = buf;
retry = 0;
if (good_packets == 0)
continue;
+ sr_info("radioshack-dmm: found RS 22-812 on port %s", conn);
+
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Radioshack",
"22-812", "")))
return NULL;
return SR_ERR_BUG;
}
- devc->serial->fd = serial_open(devc->serial->port, O_RDWR | O_NONBLOCK);
+ devc->serial->fd = serial_open(devc->serial->port, O_RDONLY);
if (devc->serial->fd == -1) {
sr_err("radioshack-dmm: Couldn't open serial port '%s'.",
devc->serial->port);
devc->cb_data = cb_data;
+ /* Reset the number of samples to take. If we've already collected our
+ * quota, but we start a new session, and don't reset this, we'll just
+ * quit without aquiring any new samples */
+ devc->num_samples = 0;
+
/* Send header packet to the session bus. */
sr_dbg("radioshack-dmm: Sending SR_DF_HEADER.");
packet.type = SR_DF_HEADER;