uint8_t buf[PACKET_SIZE], divcount;
int i, fd, size, num_probes;
uint64_t samplerate;
uint8_t buf[PACKET_SIZE], divcount;
int i, fd, size, num_probes;
uint64_t samplerate;
/* Send header packet to the session bus. */
sr_dbg("la8input: %s: sending SR_DF_HEADER packet", __func__);
packet.type = SR_DF_HEADER;
/* Send header packet to the session bus. */
sr_dbg("la8input: %s: sending SR_DF_HEADER packet", __func__);
packet.type = SR_DF_HEADER;
packet.payload = &header;
header.feed_version = 1;
gettimeofday(&header.starttime, NULL);
header.num_logic_probes = num_probes;
header.num_analog_probes = 0;
packet.payload = &header;
header.feed_version = 1;
gettimeofday(&header.starttime, NULL);
header.num_logic_probes = num_probes;
header.num_analog_probes = 0;
header.samplerate = samplerate;
sr_session_bus(in->vdevice, &packet);
header.samplerate = samplerate;
sr_session_bus(in->vdevice, &packet);
/* Send data packets to the session bus. */
sr_dbg("la8input: %s: sending SR_DF_LOGIC data packets", __func__);
packet.type = SR_DF_LOGIC;
/* Send data packets to the session bus. */
sr_dbg("la8input: %s: sending SR_DF_LOGIC data packets", __func__);
packet.type = SR_DF_LOGIC;
/* Send 8MB of total data to the session bus in small chunks. */
for (i = 0; i < NUM_PACKETS; i++) {
/* TODO: Handle errors, handle incomplete reads. */
size = read(fd, buf, PACKET_SIZE);
/* Send 8MB of total data to the session bus in small chunks. */
for (i = 0; i < NUM_PACKETS; i++) {
/* TODO: Handle errors, handle incomplete reads. */
size = read(fd, buf, PACKET_SIZE);
/* Send end packet to the session bus. */
sr_dbg("la8input: %s: sending SR_DF_END", __func__);
packet.type = SR_DF_END;
/* Send end packet to the session bus. */
sr_dbg("la8input: %s: sending SR_DF_END", __func__);
packet.type = SR_DF_END;