How best to code manual jog with keyboard or joystick?

I want to set up keyboard or, preferably, analog joystick manual jogging. I don’t want to hit a button each time I want to move a millimeter, but to hold a button down, and have it move until I stop. Or, if using a joystick, I’d like to have the joystick control both direction and speed of the move. I’d like for the motion to start when the input starts, and stop when it stops, if not instant, then pretty close to imperceptible lag, (but if I can get a solution that works at all for now, I’d be happy).

I tried setting up a host module, but it’s proving to require a lot more work/understanding than I was expecting.

My plan was originally to write a host module that I could send commands to, like: SPIN_STEPPER_X {speed}, then have that create and send stepper commands (que_step, set_next_step_dir). I thought this would give me more responsiveness than sending a series of g-code commands. I got as far as writing a host module, receiving a command (sent from mainsail console), and taking some test action based on that, but I couldn’t figure out how to find the x-axis stepper’s oid, or how to send MCU commands at all, and it wasn’t quite clear how to or whether I had to run a finalize_config command.

This morning, I thought I might abandon that, and that it’d be easier to use the API to send a series of G1, but I wasn’t sure quite how to time them, or whether the path-planning/scheduling/whatever would really impede the responsiveness.

I’d appreciate any help.