X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Farachnid-labs-re-load-pro%2Fprotocol.c;h=7ba13540cb5530087a5c17ad817e952f1c23f552;hb=9cfc695ffe5f04622f61acb98ea4ac91c3f4ffc3;hp=697f75a0890500dff958bbe79531df3c0dfe01ba;hpb=6e68da5140e80443bbb122f0c23ae5a17d91c697;p=libsigrok.git diff --git a/src/hardware/arachnid-labs-re-load-pro/protocol.c b/src/hardware/arachnid-labs-re-load-pro/protocol.c index 697f75a0..7ba13540 100644 --- a/src/hardware/arachnid-labs-re-load-pro/protocol.c +++ b/src/hardware/arachnid-labs-re-load-pro/protocol.c @@ -89,6 +89,21 @@ SR_PRIV int reloadpro_set_current_limit(const struct sr_dev_inst *sdi, return SR_OK; } +SR_PRIV int reloadpro_set_on_off(const struct sr_dev_inst *sdi, gboolean on) +{ + int ret; + char buf[100]; + const char *cmd; + + cmd = (on) ? "on\n" : "off\n"; + if ((ret = send_cmd(sdi, cmd, (char *)&buf, sizeof(buf))) < 0) { + sr_err("Error sending on/off command: %d.", ret); + return SR_ERR; + } + + return SR_OK; +} + SR_PRIV int reloadpro_get_current_limit(const struct sr_dev_inst *sdi, float *current) { @@ -144,11 +159,17 @@ static void handle_packet(const struct sr_dev_inst *sdi) devc = sdi->priv; if (g_str_has_prefix((const char *)devc->buf, "overtemp")) { - sr_dbg("Overtemperature condition!"); + sr_warn("Overtemperature condition!"); devc->otp_active = TRUE; return; } + if (g_str_has_prefix((const char *)devc->buf, "undervolt")) { + sr_warn("Undervoltage condition!"); + devc->uvc_active = TRUE; + return; + } + if (!g_str_has_prefix((const char *)devc->buf, "read ")) { sr_dbg("Unknown packet: '%s'.", devc->buf); return;