Skip to content

Commit 389f041

Browse files
committed
osc: Create channels mask at startup and keep reference to it
Signed-off-by: Dan Nechita <[email protected]>
1 parent f122044 commit 389f041

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

datatypes.h

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ struct extra_dev_info {
7272
gfloat **channels_data_copy;
7373
GSList *plots_sample_counts;
7474
struct iio_stream *stream;
75+
struct iio_channels_mask *channels_mask;
7576
};
7677

7778
struct buffer {

osc.c

+3
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,7 @@ static void init_device_list(struct iio_context *_ctx)
18631863
struct extra_dev_info *dev_info = calloc(1, sizeof(*dev_info));
18641864
iio_device_set_data(dev, dev_info);
18651865
dev_info->input_device = is_input_device(dev);
1866+
dev_info->channels_mask = iio_create_channels_mask(nb_channels);
18661867

18671868
for (j = 0; j < nb_channels; j++) {
18681869
struct iio_channel *ch = iio_device_get_channel(dev, j);
@@ -1898,6 +1899,8 @@ static void cleanup_device_list(struct iio_context *_ctx)
18981899
}
18991900

19001901
dev_info = iio_device_get_data(dev);
1902+
if (dev_info->channels_mask)
1903+
iio_channels_mask_destroy(dev_info->channels_mask);
19011904
free(dev_info);
19021905
iio_device_set_data(dev, NULL);
19031906
}

0 commit comments

Comments
 (0)