X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=hardware%2Fmotech-lps-30x%2Fapi.c;h=164a9cc02321d88656018a93e0879cf765f6dc17;hb=43cd4637285833706f8a404ca027bcf0ee75b9ae;hp=d4b6c0d7ec696bb4e9913c1056d3742d6823f0cd;hpb=1c3d002b68d9fe6fe511c84e4da7f164f32f35ff;p=libsigrok.git diff --git a/hardware/motech-lps-30x/api.c b/hardware/motech-lps-30x/api.c index d4b6c0d7..164a9cc0 100644 --- a/hardware/motech-lps-30x/api.c +++ b/hardware/motech-lps-30x/api.c @@ -281,7 +281,6 @@ SR_PRIV int lps_query_status(struct sr_dev_inst* sdi) { char buf[LINELEN_MAX]; int stat; - const char* ptr; struct dev_context* devc; devc = (struct dev_context*)sdi->priv; @@ -293,11 +292,7 @@ SR_PRIV int lps_query_status(struct sr_dev_inst* sdi) return SR_ERR; } - /* Jump across leading zeros to prevent sr_atoi() believing this to be octal. */ - for (ptr = buf; isspace(*buf) || (*ptr == '0'); ptr++) - ; - - if (sr_atoi(ptr, &stat) != SR_OK) + if (sr_atoi(buf, &stat) != SR_OK) return SR_ERR; return lps_process_status(sdi, stat); @@ -369,7 +364,7 @@ SR_PRIV int lps_read_reply(struct sr_serial_dev_inst *serial, char **buf, int *b /** Scan for LPS-300 series device. */ -static GSList *doScan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *options) +static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *options) { struct sr_dev_inst *sdi; struct drv_context *drvc; @@ -511,7 +506,7 @@ exit_err: /** Scan for LPS-301 device. */ static GSList *scan_lps301(GSList *options) { - return doScan(LPS_301, &motech_lps_301_driver_info, options); + return do_scan(LPS_301, &motech_lps_301_driver_info, options); } static GSList *doDevList(struct sr_dev_driver *drv) @@ -617,7 +612,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, devc = sdi->priv; - /* Cannot change settings while aquisition active, would cause a mess with commands. + /* Cannot change settings while acquisition active, would cause a mess with commands. * Changing this would be possible, but tricky. */ if (devc->acq_running) return SR_ERR_NA; @@ -819,7 +814,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, devc->acq_running = TRUE; serial = sdi->conn; - serial_source_add(serial, G_IO_IN, 50, motech_lps_30x_receive_data, (void *)sdi); + serial_source_add(sdi->session, serial, G_IO_IN, 50, + motech_lps_30x_receive_data, (void *)sdi); std_session_send_df_header(cb_data, LOG_PREFIX); /* Start timer, if required. */