I feel like this should be a common use case for a raspberry pi, I'm surprised how hard it is. I have a raspberry pi 3a+ and a python script that runs auxiliary hardware plugged into the pi (I don't think the specifics of those are too important). Then I have one of these three-key USB mini-keyboards plugged directly into the PI, and based on the input from those keys, the python script does things with the auxiliary hardware.
The only problem is that it requires booting up a terminal and manually running the script. Ideally, as soon as the pi turns on, the script would run and start polling for input with just the usb keyboard and auxiliary hardware plugged in, no monitor necessary.
[Tried] Using a cronjob with @reboot seems to be a deadend because they run in the background and can't take user input
[Tried] Using rc.local seems to fail for a similar reason
[Tried] Putting the script in .bashrc seemed like it failed, but I was having trouble finding the logs to figure out what might've gone wrong
[Haven't tried] Using
systemctl by specifying
StandardInput=tty seems like it
might work, though I'm concerned that there is no tty to connect to since there's no monitor/ssh connection (I don't know the details of how this works)
* [Haven't tried] Using
openvt to create a new VT as mentioned at
https://superuser.com/questions/584931/howto-start-an-interactive-script-at-ubuntu-startup seems promising
Ideally, I could just go through all these option. The issue is, I'm helping a friend work this out virtually, which means I'm telling them what to do and that makes the debug process painfully slow. I'd like to hear some advice from the people here on what seems feasible, or if there's a different approach altogether that might be better.