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

Function sr_session_source_add_channel

libsigrok4DSL/session.c:437–450  ·  view source on GitHub ↗

* Add an event source for a GIOChannel. * * @param channel The GIOChannel. * @param events Events to poll on. * @param timeout Max time to wait before the callback is called, ignored if 0. * @param cb Callback function to add. Must not be NULL. * @param cb_data Data for the callback function. Can be NULL. * * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or * SR_E

Source from the content-addressed store, hash-verified

435 * SR_ERR_MALLOC upon memory allocation errors.
436 */
437SR_PRIV int sr_session_source_add_channel(GIOChannel *channel, int events,
438 int timeout, sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi)
439{
440 GPollFD p;
441
442#ifdef _WIN32
443 g_io_channel_win32_make_pollfd(channel, events, &p);
444#else
445 p.fd = g_io_channel_unix_get_fd(channel);
446 p.events = events;
447#endif
448
449 return _sr_session_source_add(&p, timeout, cb, sdi, (gintptr)channel);
450}
451
452/**
453 * Remove the source belonging to the specified channel.

Callers

nothing calls this directly

Calls 1

_sr_session_source_addFunction · 0.85

Tested by

no test coverage detected