Posts: 11
Joined: Fri Jun 14, 2019 5:28 pm

Sharing hardware controlled by pigpio daemon

Fri Jun 14, 2019 6:26 pm

I wish to share hardware attached to a rpi host running pigpiod among several remote clients. I know this is a bad idea in general as any client can clobber the values written to the gpio pins: Client A writes gpio17 high, client B writes gpio17 low. However, what I'd like to accomplish is sending a message on a gpio pin after which another message from a different client can be sent. Ideally, having a lock/release mechanism on each client's socket interface would solve the problem but that doesn't exist. So my question is, has anyone accomplished a means of sharing hardware using pigpio in a client server configuration?

Could the use of a script be a possible solution? Client runs a script on pigpiod by calling the script ID and passing the message as a parameter. Does a pigpio script run 'atomically' or will it be preempted by other commands (requests from socket interface) ? Note, the script would be something along these lines:

Code: Select all

// start of critical section
ID = gpioWaveCreate();
// end of critical section

Return to “Automation, sensing and robotics”