Skip to content

feature/72: Add configuration option for screen rotation #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

whitfijs-jw
Copy link
Owner

- added screen rotation config option to config.ini
- screen can be rotated to any arbirary angle (0 and 180 would be the obvious choices, but I won't screen shame)
- frame buffer is not tied to this option -- changing the image that /usr/sbin/preinit points to will be necessary

config.ini changes:

[screen_prop]
use=true
orientation_angle=0

if use is false, the default screen orientation is 180 degrees.

You can do any angle you want, although you'll be greeted with something like this if you chose anything other than 0 or 180:
45 degrees
45 degree screen rotation

Bootup screen orientation

One thing that is not tied to this configuration is the bootup screen orientation. That is written directly to the frame buffer when the init system starts. To change this image to match your screen orientation you'll have to modify /sbin/preinit:

preinit contents for 180 screen rotation:

#!/bin/busybox sh

# show splash screen
fbv -d 1 /opt/splash.png > /dev/null 2>&1
#dd if=/opt/splash.fb of=/dev/fb0 bs=2457600 count=1 > dev/null 2>&1

# start real init
exec /sbin/init

preinit contents for 0 degrees screen rotation:

#!/bin/busybox sh

# show splash screen
fbv -d 1 /opt/splash_up.png > /dev/null 2>&1
#dd if=/opt/splash.fb of=/dev/fb0 bs=2457600 count=1 > dev/null 2>&1

# start real init
exec /sbin/init

You can get access to preinit to make these changes in three ways:

Modify buildroot

The preinit file can be found at board/volvodash-rpi4/rootfs_overlay/sbin/preinit. Open preinit in a text editor and make the changes outlined above. To get the change to your device, you then need to rebuild the linux image. If you know you're going to keep it this way forever, do this.

Modify SD card rootfs

Pull out your SD card and plug it into your computer in which ever way works for you. On the drive there will be three partitions. The partition you're looking for is labeled rootfs and should be an ext3/ext4 partition. You can then open sbin/preinit/ and modify the contents as outlined above. This would be a good option if you're just testing out what screen orientation is going to work for you. If you rebuild a linux image and overwrite your SD card, this change will be lost.

SSH

Following the instructions on the main README you can SSH into the device and modify the file /sbin/preinit using nano, modify the file as described above. This is equivalent to modifying the rootfs using an SD card, so should only be used when you're testing out what screen orientation is going to work.

	- added screen rotation config option to config.ini
	- screen can be rotated to any arbirary angle (0 and 180 would be the obvious choices, but I won't screen shame)
	- frame buffer is not tied to this option -- changing the image that /usr/sbin/preinit points to will be necessary
@whitfijs-jw whitfijs-jw linked an issue Feb 2, 2025 that may be closed by this pull request
	- removed redundant parentheses in config.cpp
Copy link

sonarqubecloud bot commented Feb 2, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add configuration option for screen rotation
1 participant