Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#10575 - Simulator remote-control

Attached to Project: Rockbox
Opened by Jonas Häggqvist (rasher) - Sunday, 30 August 2009, 21:12 GMT+2
Task Type Patches
Category Simulator
Status New
Assigned To No-one
Player Type All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Private No

Details

This patch enables you to control the simulator using a named pipe to provide simulated keypresses, rather than the keyboard.

Unfortunately there is a bug that means that not all events seem to have any effect. On the e200 sim, I can use the scroll buttons to move in the main menu, but neither RIGHT nor SELECT lets me enter any of the entries. I suspect it's related to repeat or hold/release handling, but I'm not sure how to fake that properly.
   FS#10575-simulator_command_pipe_v1.patch (8.7 KiB)
 uisimulator/sdl/button_defines.h |  202 +++++++++++++++++++++++++++++++++++++++
 uisimulator/sdl/uisdl.c          |   78 +++++++++++++--
 2 files changed, 273 insertions(+), 7 deletions(-)

This task depends upon

View Dependency Graph

Comment by Thomas Martitz (kugel.) - Sunday, 30 August 2009, 22:20 GMT+2
How are you dealing BUTTON_REL and BUTTON_REPEAT?

BUTTON_REL must always be sent when a button is released (even after BUTTON_REPEAT).

It goes like this (select for example)

starting with the first tick
button released immediately
BUTTON_SELECT -> BUTTON_SELECT|BUTTON_REL

button is pressed for a short time, but not long enough for repeat:
BUTTON_SELECT -> BUTTON_SELECT -> BUTTON_SELECT -> BUTTON_SELECT|BUTTON_REL

Now longer, with repeat:
BUTTON_SELECT -> BUTTON_SELECT -> BUTTON_SELECT -> BUTTON_SELECT|BUTTON_REPEAT -> BUTTON_SELECT|BUTTON_REPEAT -> BUTTON_SELECT|BUTTON_REPEAT -> BUTTON_SELECT|BUTTON_REL

You need to fake that properly.
Comment by Jonas Häggqvist (rasher) - Sunday, 30 August 2009, 22:52 GMT+2
Update that fixes the bug by sending a release event immediately after posting the buttonpress. This should pretty much be useful at this stage, and I'll go back to working on FS#10571 using this method instead of the unstable xte method.
   FS#10575-simulator_command_pipe_v2.patch (8.7 KiB)
 uisimulator/sdl/button_defines.h |  202 +++++++++++++++++++++++++++++++++++++++
 uisimulator/sdl/uisdl.c          |   77 +++++++++++++-
 2 files changed, 272 insertions(+), 7 deletions(-)

Comment by Jonas Häggqvist (rasher) - Monday, 31 August 2009, 05:14 GMT+2
The pipe reading is now implemented as a tick task. This seems to be more stable - plus you can use the regular keys if you want to.
   FS#10575-simulator_command_pipe_v3.patch (9.6 KiB)
 uisimulator/sdl/button_defines.h |  199 +++++++++++++++++++++++++++++++++++++++
 uisimulator/sdl/uisdl.c          |  100 ++++++++++++++++++-
 2 files changed, 293 insertions(+), 6 deletions(-)

Comment by Jonas Häggqvist (rasher) - Monday, 07 September 2009, 17:55 GMT+2
Two updates:

1) Post button status to the button status variable. This means plugins that do their own button handling work as well.
2) Attempt to add a STARTPLUGIN command. It does start the plugin, but behaviour is rather flaky. I suspect I'm not going about it the right way (launching the plugin from the wrong thread or something?). Plus there are 2 warnings caused by me not handling pointers right, I think.
   FS#10575-simulator_command_pipe_v4.patch (12.5 KiB)
 uisimulator/sdl/button.c         |    5 
 uisimulator/sdl/button_defines.h |  199 +++++++++++++++++++++++++++++++++++++++
 uisimulator/sdl/uisdl.c          |  133 ++++++++++++++++++++++++--
 uisimulator/common/sim_tasks.h   |    1 
 uisimulator/common/sim_tasks.c   |   12 ++
 5 files changed, 344 insertions(+), 6 deletions(-)

Comment by Rosso Maltese (asettico) - Saturday, 17 October 2009, 11:30 GMT+2
Sync to r23223.
   sim-10575command_pipe_v4.0.patch (12.5 KiB)
 uisimulator/sdl/button.c         |    5 
 uisimulator/sdl/button_defines.h |  199 +++++++++++++++++++++++++++++++++++++++
 uisimulator/sdl/uisdl.c          |  133 ++++++++++++++++++++++++--
 uisimulator/common/sim_tasks.h   |    1 
 uisimulator/common/sim_tasks.c   |   12 ++
 5 files changed, 344 insertions(+), 6 deletions(-)

Comment by MichaelGiacomelli (saratoga) - Monday, 18 October 2010, 06:01 GMT+2
Can this be used for timing sensitive operations? It would be really neat to be able to issue the sim a series of commands in sequence with precise timing. For instance a sequence like this would be very helpful for debugging the playback engine:

load track -> play for 20 seconds -> skip backwards 5 seconds -> ...

Loading...