Open a7hybnj2 opened 3 years ago
If you pull the piboy firmware the icons for osd.cfg are in PiboyDMGUpdate1.03/PiboyDMGUpdate1.03/PiboyInstall/payload/home/pi/osd/resources
Those get copied into place when you first boot with those assets in your /boot directory.
Yes, I could definitely see how that could work. If it's possible, loading a custom image for the osd would be the most ideal. If you figure that out, definitely let me know. In the meantime, I'll look at the osd config and see if the config has an obvious way to do that.
My only concern with this possible feature is messing with people's osd configs. Some people may not want the airplane mode script to modify their osd. This could possibly be remedied by a variable, BUT if the bluetooth icon doesn't change in the osd anyways, I don't see how this change would be a problem.
Let me know what you find and thanks for the suggestion :) If you come up with anything before I do, feel free to make a pull request and we can work it out!
So, I was just playing with the osd, and it seems, at least on my piboy, the osd is a little buggy. For instance, if I comment out the bluetooth icon on the osd, it doesn't change immediately, unless I change the icon size. Commenting and uncommenting the statistics does change immediately though.
However, uncommenting the bluetooth icon does change immediately. Maybe a way around this would be to change the size of the Piboy icons to something the user hasn't selected, but (on my Piboy at least) making the icons bigger and then smaller in realtime leaves an artifact of the bigger icons displayed on the screen.
Maybe there is a way to reload the osd.cfg without these problems? I would assume these bugs get fixed in the future, but I definitely want this feature now!
@brandflake11 That is a good point. There may be some people with the osd data off completely in which case this could cause issue. That bumps this up into a a more detailed script that checks some preference first. Maybe your install script could check the lines to see if they are already commented out and setting a flag accordingly.
anyway something simple and hacky would be sudo sed -i '61,64 s/wifi/#wifi/' /boot/osd.cfg
to remove the icon and ... s/#wifi/wifi/...
to put it back.
anyway something simple and hacky would be
sudo sed -i '61,64 s/wifi/#wifi/' /boot/osd.cfg
to remove the icon and... s/#wifi/wifi/...
to put it back.
Yes, this would work exactly, although I wouldn't look for specific line numbers as someone may have their bluetooth icon at the top of the config, or tons of comments that offset the line numbers.
Doing it this way would be more accurate for people who have unusual configs:
sed -i 's/^bluetooth\s*$/#bluetooth/' osd.cfg
- to turn off bluetooth osd icon
and
sed -i 's/^#bluetooth\s*$/bluetooth/' osd.cfg
- to turn on the bluetooth osd icon.
With these regular expressions, it makes sure that it finds the word that starts the line and ends with any number of whitespace after it. It can't have any other character after it. I guess if someone has a comment after the line it wouldn't work, but that would be a really special case.
@a7hybnj2 On a side note, does the bluetooth osd icon change instantly for you when you edit and save osd.cfg?
There were several blank icons in the assets. I wonder if that is how they are causing a refresh. Could you complete kill the osd service and restart it? I'll do some more testing when I am back with a keyboard and mouse.
I just tried killing and restarting the osd program. This does work to reset the osd icons, however, it plays the ExperimentalPi startup splashscreen video when you launch it. So, this could be a solution if we wanted to disable osd icons with these scripts, but it will cause the startup video to play.
I really wish the osd was open source so we could fix these issues with it.
Very cool. We're getting closer. That little boot video is in the firmware payload. What if you just delete it?
anyway something simple and
sed -i 's/^bluetooth\s*$/#bluetooth/' osd.cfg
- to turn off bluetooth osd iconand
sed -i 's/^#bluetooth\s*$/bluetooth/' osd.cfg
- to turn on the bluetooth osd icon.
What if you didn't check for leading "#" just check to make sure its the only thing on the line. That way if the user has commented it out then the script would change between "#wifi and ##wifi" both of which would be off. That way the installation script doesn't need to be more complicated.
You would just have to check if they did a "enable airplane mode" twice in a row then you would end up with "###"
anyway something simple and
sed -i 's/^bluetooth\s*$/#bluetooth/' osd.cfg
- to turn off bluetooth osd icon andsed -i 's/^#bluetooth\s*$/bluetooth/' osd.cfg
- to turn on the bluetooth osd icon.What if you didn't check for leading "#" just check to make sure its the only thing on the line. That way if the user has commented it out then the script would change between "#wifi and ##wifi" both of which would be off. That way the installation script doesn't need to be more complicated.
You would just have to check if they did a "enable airplane mode" twice in a row then you would end up with "###"
I think I would rather define a variable that the script looks for to modify the osd. If the variable = 1, then modify the osd. If the variable = 0, then don't touch it. I also would like to have a variable that is used to determine if the pi4 is in the piboy shell, that way if people aren't using these scripts in the piboy it doesn't mess with piboy-related things.
A little off-topic, but do you know of a way to determine if the pi4 is connected to the Piboy, like something in /proc?
I think this also needs to be put into an installation script, that asks if the user wants the osd to be changed if the script detects the pi4 is in the piboy.
Very cool. We're getting closer. That little boot video is in the firmware payload. What if you just delete it?
I just experimented with renaming the .mp4. Maybe we can do a hack with it where we rename the file, do the script, then name it back. I think this would be the best way to do it.
Very cool. We're getting closer. That little boot video is in the firmware payload. What if you just delete it?
I just experimented with renaming the .mp4. Maybe we can do a hack with it where we rename the file, do the script, then name it back. I think this would be the best way to do it.
Great idea. Apply that same principle to the airplane logo. Instead of turning off the bluetooth icon change the name of airplane.png to bluetooth.png so it loads that instead.
Lets start a poll/petition to get piboy to foss their firmware.
Very cool. We're getting closer. That little boot video is in the firmware payload. What if you just delete it?
I just experimented with renaming the .mp4. Maybe we can do a hack with it where we rename the file, do the script, then name it back. I think this would be the best way to do it.
Great idea. Apply that same principle to the airplane logo. Instead of turning off the bluetooth icon change the name of airplane.png to bluetooth.png so it loads that instead.
Lets start a poll/petition to get piboy to foss their firmware.
Oh shoot, I didn't think of that. That's a great idea! I bet that will work. We'll need to make an icon for it. Maybe I can whip something up or someone else would be interested in doing it.
Perhaps the installation script could ask questions.
Do you want to see the expi video on boot? Ect. I personally wouldn't mind not seeing that. Maybe I will make my own little loading video to take its place.
Very cool. We're getting closer. That little boot video is in the firmware payload. What if you just delete it?
I just experimented with renaming the .mp4. Maybe we can do a hack with it where we rename the file, do the script, then name it back. I think this would be the best way to do it.
Great idea. Apply that same principle to the airplane logo. Instead of turning off the bluetooth icon change the name of airplane.png to bluetooth.png so it loads that instead.
Lets start a poll/petition to get piboy to foss their firmware.
Oh shoot, I didn't think of that. That's a great idea! I bet that will work. We'll need to make an icon for it. Maybe I can whip something up or someone else would be interested in doing it.
I can do it. I feel like I should at least do something. I'll be able to sit on my desk tonight to take a look.
Perhaps the installation script could ask questions.
Do you want to see the expi video on boot? Ect. I personally wouldn't mind not seeing that. Maybe I will make my own little loading video to take its place.
Exactly, I need to work on it. I want to create an installation script that asks these questions and makes variables in an appropriate location that the script can then use for later.
I split this topic up into several sub topics since it will be easier to address.
Created another branch to work on this to not disturb the master.
Hey, I left a comment on reddit where I saw this. This is an awesomely perfect solution for easily enabling and disabling wireless devices.
Anyway, I think it would be equally as easy to add to your existing .sh files to turn on and off the lines in osd.cfg. Using
sed
and some clever regex should be pretty easy.