- /* Chop up the input file into chunks & send it to the session bus. */
- packet.type = SR_DF_LOGIC;
- packet.payload = &logic;
- logic.unitsize = (num_channels + 7) / 8;
- logic.data = buffer;
- while ((size = read(fd, buffer, CHUNKSIZE)) > 0) {
- logic.length = size;
+ return SR_OK;
+}
+
+static int receive(struct sr_input *in, GString *buf)
+{
+ int ret;
+
+ g_string_append_len(in->buf, buf->str, buf->len);
+
+ if (!in->sdi_ready) {
+ /* sdi is ready, notify frontend. */
+ in->sdi_ready = TRUE;
+ return SR_OK;
+ }
+
+ ret = process_buffer(in);
+
+ return ret;
+}
+
+static int end(struct sr_input *in)
+{
+ struct context *inc;
+ struct sr_datafeed_packet packet;
+ int ret;
+
+ if (in->sdi_ready)
+ ret = process_buffer(in);
+ else
+ ret = SR_OK;
+
+ inc = in->priv;
+ if (inc->started) {
+ packet.type = SR_DF_END;