Skip to contentSkip to conversation

iio:tools: PoC client server version of iio_event_monitor

PATCH New Jonathan Cameron 1 participant 1 message Mar 21, 2021 IIO

lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

PATCH 1/1 iio:tools: PoC client server version of iio_event_monitor

From: Jonathan Cameron <[email protected]>

This is not intended for upstreaming etc, but rather as a crude way of illustrating use of unix sockets to hand over the file descriptors between programs.

It might be useful to do this for the event anon FD, but real target is the buffer anon FDs for multiple buffer IIO devices.

In that case, first opener of the main file descriptor would hand off management to a thread which could then receive requests for the different buffer FDs.

Anynow this is clearly a hacked up mess based on cope coppied from the internet ;)

---
 tools/iio/Build               |   1 +
 tools/iio/Makefile            |   7 +-
 tools/iio/iio_event_network.c | 545 ++++++++++++++++++++++++++++++++++
 3 files changed, 552 insertions(+), 1 deletion(-)
tools/iio/Build +1 -0
index 8d0f3af3723f..077028ae1150 100644
@@ -2,3 +2,4 @@ iio_utils-y += iio_utils.o
 lsiio-y += lsiio.o iio_utils.o
 iio_event_monitor-y += iio_event_monitor.o iio_utils.o
 iio_generic_buffer-y += iio_generic_buffer.o iio_utils.o
+iio_event_network-y += iio_event_network.o iio_utils.o
\ No newline at end of file
tools/iio/Makefile +6 -1
index 5d12ac4e7f8f..d63608fa0243 100644
@@ -14,7 +14,7 @@ MAKEFLAGS += -r
 
 override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
 
-ALL_TARGETS := iio_event_monitor lsiio iio_generic_buffer
+ALL_TARGETS := iio_event_monitor lsiio iio_generic_buffer iio_event_network
 ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
 
 all: $(ALL_PROGRAMS)
@@ -55,6 +55,11 @@ $(IIO_GENERIC_BUFFER_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
 $(OUTPUT)iio_generic_buffer: $(IIO_GENERIC_BUFFER_IN)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
 
+IIO_EVENT_NETWORK_IN := $(OUTPUT)iio_event_network-in.o
+$(IIO_EVENT_NETWORK_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
+	$(Q)$(MAKE) $(build)=iio_event_network
+$(OUTPUT)iio_event_network: $(IIO_EVENT_NETWORK_IN)
+	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
 clean:
 	rm -f $(ALL_PROGRAMS)
 	rm -rf $(OUTPUT)include/linux/iio
tools/iio/iio_event_network.c new file +545 -0

545 lines not on this page · raw message

Signature · 1 line
2.31.0