READY/SHOT/OK process ownership without model-analysis semantics. More...
#include <stddef.h>#include <stdbool.h>#include <sys/types.h>#include <signal.h>

Go to the source code of this file.
Data Structures | |
| struct | imx500_pipe |
| One caller-serialized native worker and its borrowed configuration. More... | |
Macros | |
| #define | IMX500_PIPE_INITIALIZER {.pid = -1, .socket = -1} |
| Safe empty lifecycle state: descriptor zero must never mean uninitialized. | |
Functions | |
| int | imx500_pipe_start (struct imx500_pipe *pipe) |
| Replace any owned worker and require its exact READY response. | |
| int | imx500_pipe_shoot (struct imx500_pipe *pipe, char *filename, size_t capacity, int number) |
| Request one saved photograph and qualify its acknowledgement/file. | |
| void | imx500_pipe_stop (struct imx500_pipe *pipe) |
| Close the channel, allow an exit grace period, then kill/reap if needed. | |
| int | imx500_pipe_analyze (struct imx500_pipe *pipe, const char *filename, unsigned number) |
| Submit one saved-picture request to a warm analysis worker without recapturing pixels. | |
Detailed Description
READY/SHOT/OK process ownership without model-analysis semantics.
Each backend keeps its own state, rather than sharing a detector's process globals. This supervisor qualifies the command channel and saved file; exposure identity and analysis results are checked by their respective consumers.
Definition in file imx500_pipe.h.
Macro Definition Documentation
◆ IMX500_PIPE_INITIALIZER
| #define IMX500_PIPE_INITIALIZER {.pid = -1, .socket = -1} |
Safe empty lifecycle state: descriptor zero must never mean uninitialized.
Definition at line 49 of file imx500_pipe.h.
Function Documentation
◆ imx500_pipe_analyze()
| int imx500_pipe_analyze | ( | struct imx500_pipe * | pipe, |
| const char * | filename, | ||
| unsigned | number ) |
Submit one saved-picture request to a warm analysis worker without recapturing pixels.
- Parameters
-
pipe Running owner started with analyze=true and explicit settings. filename Immutable picture path, or a producer-owned private picture for private-image processing. number Positive increasing request number within this worker lifetime.
- Returns
- Zero for an exact successful reply, otherwise minus one after closing/reaping the failed worker.
A failed exchange is not retried, preventing a late reply from qualifying another picture.
Definition at line 239 of file imx500_pipe.c.
◆ imx500_pipe_shoot()
| int imx500_pipe_shoot | ( | struct imx500_pipe * | pipe, |
| char * | filename, | ||
| size_t | capacity, | ||
| int | number ) |
Request one saved photograph and qualify its acknowledgement/file.
- Parameters
-
[in,out] pipe Running worker owned by the calling backend. [out] filename Private .pending path; consume it only after successful return. [in] capacity Writable bytes in filename, including its terminator.[in] number Nonnegative photo number used in the backend's filename.
- Returns
- Zero for an exact OK response and a nonempty regular file, otherwise -1.
Absolute paths avoid dependence on the child's working directory. Newlines are rejected because the protocol is line-framed. A failed exchange closes/reaps the worker rather than pairing a late response with another shot. A later request starts a replacement worker only after the previous owner exits. The caller finishes metadata and calls usher_complete_photo before final-name publication.
- Warning
- This does not decode JPEG pixels, prove exposure timing, or establish valid inference. A failed shot is never automatically replayed.
Definition at line 251 of file imx500_pipe.c.
◆ imx500_pipe_start()
| int imx500_pipe_start | ( | struct imx500_pipe * | pipe | ) |
Replace any owned worker and require its exact READY response.
- Parameters
-
[in,out] pipe Initialized state with live command/model/directory strings.
- Returns
- Zero after readiness, otherwise -1 with newly acquired resources closed.
The child owns the camera. Readiness includes its model-specific warm-up, not just successful process creation. Existing owned work is stopped before spawning, preventing a second child from competing for the same sensor.
- Note
- No analysis sidecar or object/LOOM result is read by this interface.
Definition at line 149 of file imx500_pipe.c.
◆ imx500_pipe_stop()
| void imx500_pipe_stop | ( | struct imx500_pipe * | pipe | ) |
Close the channel, allow an exit grace period, then kill/reap if needed.
- Parameters
-
[in,out] pipe Initialized state; NULL is ignored.
Closing the command channel lets a healthy worker finish normally. Reaping keeps stale process state from being mistaken for an available camera. Monotonic grace periods bound polling; an unconfirmed exit retains PID ownership and prevents a replacement worker. Scheduling and kernel stalls are not preempted.
- Note
- Repeated stops are harmless once the PID and descriptor are cleared.
Definition at line 132 of file imx500_pipe.c.