Coordinating cellular modem serial interface access (for AT commands)

My impression is that, if multiple processes try to send AT commands via the serial interface at the same time, the commands can get interleaved. (e.g. if I have a daemon monitoring cell signal, and I try to send an SMS at the same time.) Is there a tool, some sort of serial multiplexer, that I can use to prevent this from happening?

I think modemmanager has a dbus interface for sending AT commands, but I am not using modemmanager...

Typical use case for good old "flock" (goggle for "flock linux")

1 Like

Well.... sure, if all the tools that access the serial interface uses flock, then this could work. But many of them don't.

... unless you are saying I need to patch all those tools.

Depends upon " .. all those tools .. " In case of shell scripts/functions, just to be wrapped within flock usage. In worst case, you are correct. Other standard strategy is serialization. I.e. your daemon also listens to a (named) pipe, containing the AT-cmds from " ... other tools ..." . And your daemon then executes these cmds, and passes results back. You should provide more info about required functionality, to select appropriate solution. You might PM me.