Pass GPIO 'reference' between apps


Is it possible to pass a GPIO ‘reference’ of some sort between apps?

Use case

I have a generic service that can do ‘something’ to a unspecified GPIO (lets say toggle at a specified rate). This GPIO controller is exposed via an API.

I then want to set up two clients to use this API - each client uses a different GPIO (bound in the appropriate Component.cdef and app.adef) and I want to pass the ‘GPIO’ via API to the service.

Any thoughts?

ciao, Dave

Why don’t you create a 3rd app to control all gpio?
Your two apps can call the function of 3rd app when toogle gpio.

Hi @jyijyi

Ta for your thoughts.

So, write a replacement service for the legato gpio service? I’m trying to re-use what is already available. Two layers of IPC is going to be pretty slow.

Actually, what I think I’ll do is act on the pins directly (using the /sys file interface) - then I can either pass the GPIO number through the service API, or even better, pass the open FD from the client into the service and act directly on the /sys/ file. That way I can use the legato GPIO service to setup the GPIO, but save on the IPC time lag when operating on the GPIO.

ciao, Dave

No, you need to keep the gpio service.
What i mean is only using the 3rd app to call goio API, and the other two apps will use IPC to call 3rd app to control gpio.