X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fmanson-hcs-3xxx%2Fapi.c;h=ee478033f3cd2b16fa25e0a59c7409d3fc5d2e3d;hb=3f2c7c94a1333a0b30f8461b4f6c0069bbcbecdd;hp=b6449cf6a79d9daf428384971b4b035a1cd630e5;hpb=15a5bfe4815f9991a9bb532c05d6244a1818a0e4;p=libsigrok.git diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c index b6449cf6..ee478033 100644 --- a/src/hardware/manson-hcs-3xxx/api.c +++ b/src/hardware/manson-hcs-3xxx/api.c @@ -15,14 +15,16 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ -/** @file - * Manson HCS-3xxx series power supply driver - * @internal - */ +/** + * @file + * + * Manson HCS-3xxx series power supply driver + * + * @internal + */ #include #include "protocol.h" @@ -79,12 +81,11 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) struct dev_context *devc; struct sr_dev_inst *sdi; struct sr_config *src; - GSList *devices, *l; + GSList *l; const char *conn, *serialcomm; struct sr_serial_dev_inst *serial; char reply[50], **tokens, *dummy; - devices = NULL; conn = NULL; serialcomm = NULL; devc = NULL; @@ -174,13 +175,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) devc->voltage_max_device = g_strtod(tokens[0], &dummy) * devc->model->voltage[2]; g_strfreev(tokens); - devices = g_slist_append(devices, sdi); - serial_close(serial); - if (!devices) - sr_serial_dev_inst_free(serial); - return std_scan_complete(di, devices); + return std_scan_complete(di, g_slist_append(NULL, sdi)); exit_err: sr_dev_inst_free(sdi); @@ -243,6 +240,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd switch (key) { case SR_CONF_LIMIT_MSEC: + case SR_CONF_LIMIT_SAMPLES: return sr_sw_limits_config_set(&devc->limits, key, data); case SR_CONF_VOLTAGE_TARGET: dval = g_variant_get_double(data); @@ -361,7 +359,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc = sdi->priv; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); devc->reply_pending = FALSE; devc->req_sent_at = 0; @@ -374,12 +372,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_OK; } -static int dev_acquisition_stop(struct sr_dev_inst *sdi) -{ - return std_serial_dev_acquisition_stop(sdi, - std_serial_dev_close, sdi->conn, LOG_PREFIX); -} - static struct sr_dev_driver manson_hcs_3xxx_driver_info = { .name = "manson-hcs-3xxx", .longname = "Manson HCS-3xxx", @@ -394,7 +386,7 @@ static struct sr_dev_driver manson_hcs_3xxx_driver_info = { .dev_open = std_serial_dev_open, .dev_close = std_serial_dev_close, .dev_acquisition_start = dev_acquisition_start, - .dev_acquisition_stop = dev_acquisition_stop, + .dev_acquisition_stop = std_serial_dev_acquisition_stop, .context = NULL, }; SR_REGISTER_DEV_DRIVER(manson_hcs_3xxx_driver_info);