X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fmaynuo-m97%2Fapi.c;h=970bfe95615c3fb069067fc04d6c332c12d57d0c;hb=093e1cba6b7bf14cfb77fa36f59b0c16e6fca7cc;hp=682254315429732f14697e59b38369e03ce0fdb4;hpb=bee2b0168c087676c1b365861d8c2d4714afa9b9;p=libsigrok.git diff --git a/src/hardware/maynuo-m97/api.c b/src/hardware/maynuo-m97/api.c index 68225431..970bfe95 100644 --- a/src/hardware/maynuo-m97/api.c +++ b/src/hardware/maynuo-m97/api.c @@ -53,9 +53,11 @@ static const uint32_t devopts_cg[] = { SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE | SR_CONF_GET, }; -/* The IDs in this list are only guessed and needs to be verified - against some real hardware. If at least a few of them matches, - it will probably be safe to enable the others. */ +/* + * The IDs in this list are only guessed and needs to be verified + * against some real hardware. If at least a few of them matches, + * it will probably be safe to enable the others. + */ static const struct maynuo_m97_model supported_models[] = { // { 53, "M9711" , 30, 150, 150 }, // { 54, "M9712" , 30, 150, 300 }, @@ -170,12 +172,12 @@ static int config_compare(gconstpointer a, gconstpointer b) static GSList *scan(struct sr_dev_driver *di, GSList *options) { struct sr_config default_serialcomm = { - .key = SR_CONF_SERIALCOMM, - .data = g_variant_new_string("9600/8n1"), + .key = SR_CONF_SERIALCOMM, + .data = g_variant_new_string("9600/8n1"), }; struct sr_config default_modbusaddr = { - .key = SR_CONF_MODBUSADDR, - .data = g_variant_new_uint64(1), + .key = SR_CONF_MODBUSADDR, + .data = g_variant_new_uint64(1), }; GSList *opts = options, *devices; @@ -213,9 +215,6 @@ static int dev_close(struct sr_dev_inst *sdi) struct dev_context *devc; struct sr_modbus_dev_inst *modbus; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - modbus = sdi->conn; if (modbus) { @@ -224,8 +223,7 @@ static int dev_close(struct sr_dev_inst *sdi) /* Wait for the last data that was requested from the device. */ uint16_t registers[devc->expecting_registers]; sr_modbus_read_holding_registers(modbus, -1, - devc->expecting_registers, - registers); + devc->expecting_registers, registers); } maynuo_m97_set_bit(modbus, PC1, 0); @@ -331,9 +329,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd (void)cg; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - modbus = sdi->conn; devc = sdi->priv; @@ -434,9 +429,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) struct sr_modbus_dev_inst *modbus; int ret; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - modbus = sdi->conn; devc = sdi->priv; @@ -454,9 +446,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) { struct sr_modbus_dev_inst *modbus; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - std_session_send_df_end(sdi); modbus = sdi->conn;