]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/brymen-dmm/api.c
drivers/input: Remove some hardcoded values.
[libsigrok.git] / src / hardware / brymen-dmm / api.c
index fb66d9bfc0fc90294edb69404271eedb48a1c764..ce6f1f33e4f4c8e832fa34232a74f04698d89f13 100644 (file)
@@ -61,7 +61,7 @@ static GSList *brymen_scan(struct sr_dev_driver *di, const char *conn,
                goto scan_cleanup;
        }
 
-       len = 128;
+       len = sizeof(buf);
        ret = brymen_stream_detect(serial, buf, &len, brymen_packet_length,
                             brymen_packet_is_valid, 1000, 9600);
        if (ret != SR_OK)
@@ -110,19 +110,16 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        if (!conn)
                return NULL;
 
-       if (serialcomm) {
-               /* Use the provided comm specs. */
+       if (serialcomm)
                devices = brymen_scan(di, conn, serialcomm);
-       } else {
-               /* But 9600/8n1 should work all of the time. */
+       else
                devices = brymen_scan(di, conn, "9600/8n1/dtr=1/rts=1");
-       }
 
        return devices;
 }
 
-static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
-               const struct sr_channel_group *cg)
+static int config_set(uint32_t key, GVariant *data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
 
@@ -133,8 +130,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        return sr_sw_limits_config_set(&devc->sw_limits, key, data);
 }
 
-static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_channel_group *cg)
+static int config_list(uint32_t key, GVariant **data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
 }
@@ -149,7 +146,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        sr_sw_limits_acquisition_start(&devc->sw_limits);
        std_session_send_df_header(sdi);
 
-       /* Poll every 50ms, or whenever some data comes in. */
        serial = sdi->conn;
        serial_source_add(sdi->session, serial, G_IO_IN, 50,
                        brymen_dmm_receive_data, (void *)sdi);