struct drv_context *drvc;
if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
- sr_err("agilent-dmm: driver context malloc failed.");
+ sr_err("Driver context malloc failed.");
return SR_ERR;
}
break;
}
if (*buflen)
- sr_dbg("agilent-dmm: received '%s'", *buf);
+ sr_dbg("Received '%s'.", *buf);
return SR_OK;
}
return NULL;
if ((fd = serial_open(conn, O_RDWR|O_NONBLOCK)) == -1) {
- sr_err("agilent-dmm: unable to open %s: %s", conn, strerror(errno));
+ sr_err("Unable to open %s: %s.", conn, strerror(errno));
return NULL;
}
if (serial_set_paramstr(fd, serialcomm) != SR_OK) {
- sr_err("agilent-dmm: unable to set serial parameters: %s",
- strerror(errno));
+ sr_err("Unable to set serial parameters: %s.",
+ strerror(errno));
return NULL;
}
serial_flush(fd);
if (serial_write(fd, "*IDN?\r\n", 7) == -1) {
- sr_err("agilent-dmm: unable to send identification string: %s",
- strerror(errno));
+ sr_err("Unable to send identification string: %s.",
+ strerror(errno));
return NULL;
}
tokens[1], tokens[3])))
return NULL;
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
- sr_dbg("agilent-dmm: failed to malloc devc");
+ sr_dbg("failed to malloc devc");
return NULL;
}
devc->profile = &supported_agdmm[i];
struct dev_context *devc;
if (!(devc = sdi->priv)) {
- sr_err("agilent-dmm: sdi->priv was NULL.");
+ sr_err("sdi->priv was NULL.");
return SR_ERR_BUG;
}
devc->serial->fd = serial_open(devc->serial->port, O_RDWR | O_NONBLOCK);
if (devc->serial->fd == -1) {
- sr_err("agilent-dmm: Couldn't open serial port '%s'.",
+ sr_err("Couldn't open serial port '%s'.",
devc->serial->port);
return SR_ERR;
}
struct dev_context *devc;
if (!(devc = sdi->priv)) {
- sr_err("agilent-dmm: sdi->priv was NULL.");
+ sr_err("sdi->priv was NULL.");
return SR_ERR_BUG;
}
return SR_ERR;
if (!(devc = sdi->priv)) {
- sr_err("agilent-dmm: sdi->priv was NULL.");
+ sr_err("sdi->priv was NULL.");
return SR_ERR_BUG;
}
case SR_HWCAP_LIMIT_MSEC:
/* TODO: not yet implemented */
if (*(const uint64_t *)value == 0) {
- sr_err("agilent-dmm: LIMIT_MSEC can't be 0.");
+ sr_err("LIMIT_MSEC can't be 0.");
return SR_ERR;
}
devc->limit_msec = *(const uint64_t *)value;
- sr_dbg("agilent-dmm: Setting time limit to %" PRIu64 "ms.",
+ sr_dbg("Setting time limit to %" PRIu64 "ms.",
devc->limit_msec);
break;
case SR_HWCAP_LIMIT_SAMPLES:
devc->limit_samples = *(const uint64_t *)value;
- sr_dbg("agilent-dmm: Setting sample limit to %" PRIu64 ".",
+ sr_dbg("Setting sample limit to %" PRIu64 ".",
devc->limit_samples);
break;
default:
- sr_err("agilent-dmm: Unknown capability: %d.", hwcap);
+ sr_err("Unknown capability: %d.", hwcap);
return SR_ERR;
break;
}
struct dev_context *devc;
if (!(devc = sdi->priv)) {
- sr_err("agilent-dmm: sdi->priv was NULL.");
+ sr_err("sdi->priv was NULL.");
return SR_ERR_BUG;
}
- sr_dbg("agilent-dmm: Starting acquisition.");
+ sr_dbg("Starting acquisition.");
devc->cb_data = cb_data;
/* Send header packet to the session bus. */
- sr_dbg("agilent-dmm: Sending SR_DF_HEADER.");
+ sr_dbg("Sending SR_DF_HEADER.");
packet.type = SR_DF_HEADER;
packet.payload = (uint8_t *)&header;
header.feed_version = 1;
sr_session_send(devc->cb_data, &packet);
/* Send metadata about the SR_DF_ANALOG packets to come. */
- sr_dbg("agilent-dmm: Sending SR_DF_META_ANALOG.");
+ sr_dbg("Sending SR_DF_META_ANALOG.");
packet.type = SR_DF_META_ANALOG;
packet.payload = &meta;
meta.num_probes = 1;
return SR_ERR;
if (!(devc = sdi->priv)) {
- sr_err("agilent-dmm: sdi->priv was NULL.");
+ sr_err("sdi->priv was NULL.");
return SR_ERR_BUG;
}
- sr_dbg("agilent-dmm: Stopping acquisition.");
+ sr_dbg("Stopping acquisition.");
sr_source_remove(devc->serial->fd);
hw_dev_close((struct sr_dev_inst *)sdi);
/* Send end packet to the session bus. */
- sr_dbg("agilent-dmm: Sending SR_DF_END.");
+ sr_dbg("Sending SR_DF_END.");
packet.type = SR_DF_END;
sr_session_send(cb_data, &packet);
#include <errno.h>
#include <math.h>
-
static void dispatch(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
now = g_get_monotonic_time() / 1000;
for (i = 0; (&jobs[i])->interval; i++) {
if (now - devc->jobqueue[i] > (&jobs[i])->interval) {
- sr_spew("agilent-dmm: running job %d", i);
+ sr_spew("Running job %d.", i);
(&jobs[i])->send(sdi);
devc->jobqueue[i] = now;
}
}
-
}
static void receive_line(const struct sr_dev_inst *sdi)
else
break;
}
- sr_spew("agilent-dmm: received '%s'", devc->buf);
+ sr_spew("Received '%s'.", devc->buf);
recv = NULL;
recvs = devc->profile->recvs;
g_match_info_unref(match);
g_regex_unref(reg);
} else
- sr_dbg("agilent-dmm: unknown line '%s'", devc->buf);
+ sr_dbg("Unknown line '%s'.", devc->buf);
/* Done with this. */
devc->buflen = 0;
-
}
SR_PRIV int agdmm_receive_data(int fd, int revents, void *cb_data)
char buf[32];
devc = sdi->priv;
- sr_spew("agilent-dmm: sending '%s'", cmd);
+ sr_spew("Sending '%s'.", cmd);
strncpy(buf, cmd, 28);
if (!strncmp(buf, "*IDN?", 5))
strncat(buf, "\r\n", 32);
else
strncat(buf, "\n\r\n", 32);
if (serial_write(devc->serial->fd, buf, strlen(buf)) == -1) {
- sr_err("agilent-dmm: failed to send: %s", strerror(errno));
+ sr_err("Failed to send: %s.", strerror(errno));
return SR_ERR;
}
static int send_stat(const struct sr_dev_inst *sdi)
{
-
return agdmm_send(sdi, "STAT?");
}
devc = sdi->priv;
s = g_match_info_fetch(match, 1);
- sr_spew("agilent-dmm: STAT response '%s'", s);
+ sr_spew("STAT response '%s'.", s);
/* Max, Min or Avg mode -- no way to tell which, so we'll
* set both flags to denote it's not a normal measurement. */
else
devc->mode_tempaux = FALSE;
- /* Continuity mode. */
+ /* Continuity mode. */
if (s[16] == '1')
devc->mode_continuity = TRUE;
else
devc = sdi->priv;
s = g_match_info_fetch(match, 1);
- sr_spew("agilent-dmm: STAT response '%s'", s);
+ sr_spew("STAT response '%s'.", s);
/* Peak hold mode. */
if (s[4] == '1')
static int send_fetc(const struct sr_dev_inst *sdi)
{
-
return agdmm_send(sdi, "FETC?");
}
float fvalue;
char *mstr, *eptr;
- sr_spew("agilent-dmm: FETC reply '%s'", g_match_info_get_string(match));
+ sr_spew("FETC reply '%s'.", g_match_info_get_string(match));
devc = sdi->priv;
if (devc->cur_mq == -1)
fvalue = strtof(mstr, &eptr);
g_free(mstr);
if (fvalue == 0.0 && eptr == mstr) {
- sr_err("agilent-dmm: invalid float");
+ sr_err("Invalid float.");
return SR_ERR;
}
if (devc->cur_divider > 0)
static int send_conf(const struct sr_dev_inst *sdi)
{
-
return agdmm_send(sdi, "CONF?");
}
struct dev_context *devc;
char *mstr;
- sr_spew("agilent-dmm: CONF? response '%s'", g_match_info_get_string(match));
+ sr_spew("CONF? response '%s'.", g_match_info_get_string(match));
devc = sdi->priv;
mstr = g_match_info_fetch(match, 1);
if (!strcmp(mstr, "V")) {
devc->cur_mqflags = 0;
devc->cur_divider = 0;
} else
- sr_dbg("agilent-dmm: unknown first argument");
+ sr_dbg("Unknown first argument.");
g_free(mstr);
if (g_match_info_get_match_count(match) == 4) {
else if (!strcmp(mstr, "DC"))
devc->cur_mqflags |= SR_MQFLAG_DC;
else
- sr_dbg("agilent-dmm: unknown third argument");
+ sr_dbg("Unknown third argument.");
g_free(mstr);
} else
devc->cur_mqflags &= ~(SR_MQFLAG_AC | SR_MQFLAG_DC);
struct dev_context *devc;
char *mstr;
- sr_spew("agilent-dmm: CONF? response '%s'", g_match_info_get_string(match));
+ sr_spew("CONF? response '%s'.", g_match_info_get_string(match));
devc = sdi->priv;
mstr = g_match_info_fetch(match, 1);
if (!strncmp(mstr, "VOLT", 4)) {
}
devc->cur_mqflags = 0;
devc->cur_divider = 0;
-} else
- sr_dbg("agilent-dmm: unknown first argument");
+ } else
+ sr_dbg("Unknown first argument.");
g_free(mstr);
-
return SR_OK;
}
struct dev_context *devc;
char *mstr;
- sr_spew("agilent-dmm: CONF? response '%s'", g_match_info_get_string(match));
+ sr_spew("CONF? response '%s'.", g_match_info_get_string(match));
devc = sdi->priv;
mstr = g_match_info_fetch(match, 1);
if(!strcmp(mstr, "DIOD")) {
devc->cur_mqflags = SR_MQFLAG_DIODE;
devc->cur_divider = 0;
} else
- sr_dbg("agilent-dmm: unknown single argument");
+ sr_dbg("Unknown single argument.");
g_free(mstr);
return SR_OK;
* we do need to catch this here, or it'll show up in some other output. */
static int recv_switch(const struct sr_dev_inst *sdi, GMatchInfo *match)
{
-
(void)sdi;
- sr_spew("agilent-dmm: switch '%s'", g_match_info_get_string(match));
+ sr_spew("Switch '%s'.", g_match_info_get_string(match));
return SR_OK;
}
-
SR_PRIV const struct agdmm_job agdmm_jobs_u123x[] = {
{ 143, send_stat },
{ 1000, send_conf },
{ "^\"(DIOD)\"$", recv_conf },
{ NULL, NULL }
};
-
-