MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / receive_data

Function receive_data

libsigrok4DSL/session_driver.c:238–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
239{
240 struct session_vdev *vdev = NULL;
241 struct sr_datafeed_packet packet;
242 struct sr_datafeed_logic logic;
243 struct sr_datafeed_dso dso;
244 struct sr_datafeed_analog analog;
245 int ret;
246 char file_name[32];
247 struct sr_channel *probe = NULL;
248 GSList *pl;
249 int channel;
250
251 assert(sdi);
252 assert(sdi->priv);
253
254 (void)fd;
255 (void)revents;
256
257 sr_detail("Feed chunk.");
258
259 ret = 0;
260 packet.status = SR_PKT_OK;
261
262 vdev = sdi->priv;
263
264 assert(vdev->unit_bits > 0);
265 assert(vdev->cur_channel >= 0);
266 assert(vdev->archive);
267
268 if (vdev->cur_channel < vdev->num_probes)
269 {
270 if (vdev->version == 1)
271 {
272 ret = unzReadCurrentFile(vdev->archive, vdev->buf, CHUNKSIZE);
273 if (-1 == ret)
274 {
275 sr_err("%s: Read inner file error!", __func__);
276 send_error_packet(sdi, vdev, &packet);
277 return FALSE;
278 }
279 }
280 else if (vdev->version > 1)
281 {
282 channel = vdev->cur_channel;
283 pl = sdi->channels;
284
285 while (channel--){
286 pl = pl->next;
287 }
288
289 probe = (struct sr_channel *)pl->data;
290
291 if (vdev->capfile == 0)
292 {
293 char *type_name = (probe->type == SR_CHANNEL_LOGIC) ? "L" : (probe->type == SR_CHANNEL_DSO) ? "O"
294 : (probe->type == SR_CHANNEL_ANALOG) ? "A"
295 : "U";

Callers

nothing calls this directly

Calls 9

unzReadCurrentFileFunction · 0.85
unzLocateFileFunction · 0.85
unzOpenCurrentFileFunction · 0.85
trans_dataFunction · 0.85
ds_data_forwardFunction · 0.85
unzCloseCurrentFileFunction · 0.85
sr_session_source_removeFunction · 0.85
send_error_packetFunction · 0.70
close_archiveFunction · 0.70

Tested by

no test coverage detected