X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fdemo%2Fdemo.c;h=48f7cf52791d1c74538c879c3bf8417d1cb42824;hb=cf94c8167bdd520e43cda5cdc9ef1ebf301b814d;hp=79a7a0acffe6b6fa67cf18cbc58977fd9771e09c;hpb=ab331b679c417282616efa7d05d456868fd42933;p=libsigrok.git diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 79a7a0ac..48f7cf52 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -66,7 +66,7 @@ enum { /* FIXME: Should not be global. */ SR_PRIV GIOChannel *channels[2]; -struct databag { +struct context { int pipe_fds[2]; uint8_t sample_generator; uint8_t thread_running; @@ -210,7 +210,7 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id) case SR_DI_CUR_SAMPLERATE: info = &cur_samplerate; break; - case SR_DI_PATTERNMODES: + case SR_DI_PATTERNS: info = &pattern_strings; break; } @@ -285,7 +285,7 @@ static int hw_dev_config_set(int dev_index, int hwcap, void *value) static void samples_generator(uint8_t *buf, uint64_t size, void *data) { static uint64_t p = 0; - struct databag *ctx = data; + struct context *ctx = data; uint64_t i; /* TODO: Needed? */ @@ -323,7 +323,7 @@ static void samples_generator(uint8_t *buf, uint64_t size, void *data) /* Thread function */ static void thread_func(void *data) { - struct databag *ctx = data; + struct context *ctx = data; uint8_t buf[BUFSIZE]; uint64_t nb_to_send = 0; int bytes_written; @@ -398,7 +398,7 @@ static int receive_data(int fd, int revents, void *cb_data) if (!thread_running && z <= 0) { /* Make sure we don't receive more packets. */ - g_io_channel_close(channels[0]); + g_io_channel_shutdown(channels[0], FALSE, NULL); /* Send last packet. */ packet.type = SR_DF_END; @@ -414,10 +414,10 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data) { struct sr_datafeed_packet *packet; struct sr_datafeed_header *header; - struct databag *ctx; + struct context *ctx; /* TODO: 'ctx' is never g_free()'d? */ - if (!(ctx = g_try_malloc(sizeof(struct databag)))) { + if (!(ctx = g_try_malloc(sizeof(struct context)))) { sr_err("demo: %s: ctx malloc failed", __func__); return SR_ERR_MALLOC; }