Skip to content

feat: automated InfiniSim sessions through a control pipe#188

Open
muesli wants to merge 1 commit intoInfiniTimeOrg:mainfrom
muesli:fifo
Open

feat: automated InfiniSim sessions through a control pipe#188
muesli wants to merge 1 commit intoInfiniTimeOrg:mainfrom
muesli:fifo

Conversation

@muesli
Copy link

@muesli muesli commented Mar 17, 2026

When started with --enable-fifo, InfiniSim will listen for incoming control commands on /tmp/infinisim_[pid].fifo.

This lets us remote control InfiniSim, so we can run through an entire test plan and take screenshots of each step along the way.

I've added the following commands:

  • tap : emulates a tap at the specified coords
  • button: emulates the hardware side button
  • swipe [up|down|left|right]
  • prepare: session with weather data, heartrate, voltage, and steps
  • screenshot : save screenshot at specified path

When started with `--enable-fifo`, InfiniSim will listen for incoming
control commands on `/tmp/infinisim_[pid].fifo`.

This lets us remote control InfiniSim, so we can run through an entire
test plan and take screenshots of each step along the way.

I've added the following commands:

- tap <x> <y>: emulates a tap at the specified coords
- button: emulates the hardware side button
- swipe `[up|down|left|right]`
- prepare: session with weather data, heartrate, voltage, and steps
- screenshot <path>: save screenshot at specified path
@muesli
Copy link
Author

muesli commented Mar 17, 2026

I suppose there's a nicer way to inject taps, but this seems to work just fine. I've used this to create a little test-plan that runs through an entire user session and captures images along the way (see attached screenshot).

This should be nice to visualize changes in PRs and detect regressions (p-hash comparison). I'll open separate PRs for these changes in the near future.

image

@NeroBurner
Copy link
Collaborator

awesome stuff!

one question I have immediately? Why a tmp file? We could use stdin aa well and let the user pipe the file into infinisim. Would that have drawbacks?

@muesli
Copy link
Author

muesli commented Mar 17, 2026

one question I have immediately? Why a tmp file? We could use stdin aa well and let the user pipe the file into infinisim. Would that have drawbacks?

Indeed and it's still a valid alternative. The only drawback is tighter coupling, which is the reason I went with a named pipe. It lets me keep the simulator running while working on different test plans and having them executed one after another. I'll happily switch over to a more traditional stdin pipe should you prefer that.

@NeroBurner NeroBurner added the enhancement New feature or request label Mar 17, 2026
@NeroBurner
Copy link
Collaborator

I think I know not enough for good judgment on what is better. Please help me to better understand.

with stdin or regular files I could let the simulator execute/process a file at a time and in case of a file it stays there for the next run.

How is the user interaction with a named pipe? Do I need to guess the right created filename?

@NeroBurner
Copy link
Collaborator

I currently slightly lean towards regular text files and stdin (maybe because I know files 😅)

orthogonally: we could add an exit keyword to close the sim after processing the file

and I think InfiniEmu has a similar feature as well. Could you have a look if it differs or if we could even support the same style/instruction set?

@muesli
Copy link
Author

muesli commented Mar 17, 2026

How is the user interaction with a named pipe? Do I need to guess the right created filename?

You would typically start up the infinisim process and track its pid, e.g.:

./build/infinisim --enable-fifo &
SIM_PID=$!

You then know its fifo location:

SIM_FIFO="/tmp/infinisim_${SIM_PID}.fifo"

Once that path exists, you can start writing to the fifo to trigger actions inside InfiniSim:

echo "swipe up" > "$SIM_FIFO"
echo "screenshot somefile.png" > "$SIM_FIFO"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants