]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/arachnid-labs-re-load-pro/protocol.c
Enable loading of session files without the unit size defined
[libsigrok.git] / src / hardware / arachnid-labs-re-load-pro / protocol.c
index 697f75a0890500dff958bbe79531df3c0dfe01ba..7ba13540cb5530087a5c17ad817e952f1c23f552 100644 (file)
@@ -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;