]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/teleinfo/api.c
serial: extend stream detect for variable length packet checkers
[libsigrok.git] / src / hardware / teleinfo / api.c
index 759280986e7bea5394573bfaf8fd47b172295e60..e7b4e2342f36e7c71da3846998ce9e3476b1af4c 100644 (file)
@@ -75,11 +75,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
 
        sr_info("Probing serial port %s.", conn);
 
-       serial_flush(serial);
-
        /* Let's get a bit of data and see if we can find a packet. */
        if (serial_stream_detect(serial, buf, &len, len,
-                                teleinfo_packet_valid, 3000, 1200) != SR_OK)
+                       teleinfo_packet_valid, NULL, NULL, 3000) != SR_OK)
                goto scan_cleanup;
 
        sr_info("Found device on port %s.", conn);
@@ -124,8 +122,8 @@ scan_cleanup:
        return std_scan_complete(di, 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;
 
@@ -136,8 +134,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);
 }
@@ -153,7 +151,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 
        std_session_send_df_header(sdi);
 
-       /* Poll every 50ms, or whenever some data comes in. */
        serial_source_add(sdi->session, serial, G_IO_IN, 50,
                        teleinfo_receive_data, (void *)sdi);