Hello fellow fellows,
I just whacked together a Python script in order to switch between my Hyperpixel display and my HDMI display. I’m afraid it’s terribly unpolished, looks disgusting and I’m still yet to get it working on boot up, but I thought you might find it interesting:
Any ideas on how to refine this script or just replace it completely would be welcomed! Hopefully this might help some of you to get started with the Hyperpixel display. ;)
Edit: Link to relating threads;
From other solutions I’ve seen, this is possibly the best way to achieve it although it will break features of
raspi-config since config.txt will be overwritten.
Ah, thank you.
Yes, I did notice it quite annoyingly changing my underscan settings when I originally switched displays. I’ll add a warning to the README file just to notify others as well. The only way I can see to avoid that is to manually change both the config files before using the switcher, which is a bit of a time consumer, but it’ll do the job.
Edit: And updated. Once I get a bit of time I’ll have another go at making it a bit more user friendly.
By the way, has anyone been able to get this running at boot? Using crontab seems to be a little fiddly for me… I.E: it doesn’t run it at all! :)
I’m guessing it’s failing to find/open/create
What does your crontab entry look like?
It’s a little hard since I’m on a different Pi at the moment, but it looked something along the lines like:
@reboot sleep 5; sudo python [path]
It outputted all of the print commands (mostly), but didn’t wait for a user input, and therefore just went on with the show and gave an error report.
I also tried creating a .sh file to open it, which was then ran by cron, but I believe it didn’t work all that well… I’ll update you again when I get the proper files.
Ah, drat, yes, it wont wait for user input since Cron runs “in the background” and doesn’t attach to your logged-in terminal.
There’s a good answer here that might be of use, the
openvt command should be available: https://superuser.com/questions/584931/howto-start-an-interactive-script-at-ubuntu-startup
Might be worth having the script timeout and close automatically if it’s not interacted with, too.
I’ll add the timeout right away, but I’m not sure on the similarities between Ubuntu and Debian (Raspbian) and whether I can implement them.
I also presume that the install script used there is a bash script, since adding
exec < /dev/tty1 to the start of my Python script will return some interesting results.
Edit: Make that add the timeout in a while. I never realised such a simple process could be so difficult…
Good attempt, but not quite. I’m afraid trying to run either the Python script directly or even a shell script to launch it results in the following error at boot:
Failed to start /etc/rc.local Compatability