Detect if GPIO is in use by other Legato App

Hiya,

Is there any way to detect if a GPIO already has a handler attached?

According to the doc (and testing):

The client will be killed for below scenarios:

  • Only one handler can be registered per pin. Subsequent attempts to register a handler will result in the client being killed.

ciao, Dave

Generally, if you are not using the GPIO, noone is. But you can always search the legato source code for the api name, that should give you all the candidates for conflicts if any.

Hiya,

Ta.

Sorry - I wasn’t clear - I am looking for a way to do it at run-time.

ciao, Dave

Why would you need to do that ? Do you have a case where you don’t know if anyone else is using the GPIO or do you just want to be safe by checking before using ?

Hi,

I may have a case where more than one app may try to use a GPIO … depending on user configuration.

Trying to catch it gracefully/safely - rather than just have the app explode.

ciao, Dave

I have a use case where multiple threads read the gpio state and therefore I had to ditch the legato gpio system for controlling gpios and go directly on the /sys/class/gpio files. That is the only graceful solution I have found

Hiya,

Yeah, I’ve had to do that too - but I needed to do it for speed rather than isolation/protection issues.

I think I might have to re-implement a GPIO service that directly interfaces with /sys/class/gpio to manage input/output states and mux them between apps.

Thanks for your thoughts. Much appreciated.

ciao, Dave