sr_info("session: starting");
+ ret = SR_OK;
for (l = session->devs; l; l = l->next) {
sdi = l->data;
if ((ret = sdi->driver->dev_acquisition_start(sdi, sdi)) != SR_OK) {
}
}
+ /*
+ * Some sources may not be necessarily associated with a device.
+ * Those sources may still be present even after stopping all devices.
+ * We need to make sure all sources are removed, or we risk running the
+ * session in an infinite loop.
+ */
+ while (session->num_sources)
+ sr_session_source_remove(session->sources[0].poll_object);
+
return SR_OK;
}
*
* @param packet The packet to show debugging information for.
*/
-static void datafeed_dump(struct sr_datafeed_packet *packet)
+static void datafeed_dump(const struct sr_datafeed_packet *packet)
{
- struct sr_datafeed_logic *logic;
- struct sr_datafeed_analog *analog;
+ const struct sr_datafeed_logic *logic;
+ const struct sr_datafeed_analog *analog;
switch (packet->type) {
case SR_DF_HEADER:
case SR_DF_TRIGGER:
sr_dbg("bus: received SR_DF_TRIGGER");
break;
- case SR_DF_META_LOGIC:
- sr_dbg("bus: received SR_DF_META_LOGIC");
+ case SR_DF_META:
+ sr_dbg("bus: received SR_DF_META");
break;
case SR_DF_LOGIC:
logic = packet->payload;
- /* TODO: Check for logic != NULL. */
sr_dbg("bus: received SR_DF_LOGIC %" PRIu64 " bytes", logic->length);
break;
- case SR_DF_META_ANALOG:
- sr_dbg("bus: received SR_DF_META_ANALOG");
- break;
case SR_DF_ANALOG:
analog = packet->payload;
- /* TODO: Check for analog != NULL. */
sr_dbg("bus: received SR_DF_ANALOG %d samples", analog->num_samples);
break;
case SR_DF_END:
* @private
*/
SR_PRIV int sr_session_send(const struct sr_dev_inst *sdi,
- struct sr_datafeed_packet *packet)
+ const struct sr_datafeed_packet *packet)
{
GSList *l;
sr_datafeed_callback_t cb;