Unable to rotate & set the correct resolution for Waveshare 7.9inch touchscreen (HDMI version)

Creating a bug report/issue

I have searched the existing open and closed issues
YES

Required Information

  • DietPi version | cat /boot/dietpi/.version
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=8
    G_DIETPI_VERSION_RC=0
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’

  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
    bookworm 0

  • Kernel version | uname --all
    Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

  • Architecture | dpkg --print-architecture
    arm64

  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
    RPi 4 Model B (aarch64)

  • Power supply used | (EG: 5V 1A RAVpower)
    Raspberry Pi USB-C Power Supply (EU) - Black (5.1V 3A - 15.3W)

  • SD card used | (EG: SanDisk ultra)
    Sandisk Ultra 16GB

Additional Information (if applicable)

  • Software title | (EG: Nextcloud)
  • Was the software title installed freshly or updated/migrated?
  • Can this issue be replicated on a fresh installation of DietPi?
    ← If you sent a “dietpi-bugreport”, please paste the ID here →
  • Bug report ID | echo $G_HW_UUID

Steps to reproduce

According to the vendors info (https://www.waveshare.com/wiki/7.9inch_Touch_Monitor), I should be able to rotate the screen and set the resolution to 1280 x 400 adding the following in config.txt:

hdmi_group=2
hdmi_mode=87
hdmi_timings=400 0 220 32 110 1280 0 10 10 10 0 0 0 60 0 59510000 0
display_rotate=1

Expected behaviour

Screen should be rotated 90° with a resolution of 1280 wide and 400 high

Actual behaviour

Nothing happens. Screens remains vertical.

Extra details

Did you reboot the system?

Hi,

Yes, I rebooted several times…
Even with different settings…
Unfortunately no single pixel changed… :frowning:
It remains vertical

I’m getting desperate

Hm we had a similiar issue a year ago, without a solution
https://dietpi.com/forum/t/waveshare-7-9inch-dsi-lcd-touch-screen-cannot-display-landscape-please-help/18282/7

Also in their docs they say, they only support Pi OS / Ubuntu / Kali and Retropie, but no plain Debian. Maybe you can ask Waveshare support for help.

On 64bit, DietPi and RPiOS should be nearly same.

@Joly if you have spare SD card, could you test using plain RPiOS?

Hi,

Yes, I saw that topic too, but I understood that screen was a DSI-version, no?

I got this reply from Waveshare:

You can refer to this link: 有道云笔记

I have to admit that I’m not yet very confident with Raspberry.
So, I find cmdline.txt in /boot. I suppose that’s the file they refering to, no?

If someone understands could guide me what I have to do exactly… would be very nice!

I hoped this was a lot easier… :wink:

Hi,

I’ll try.
FYI… I just want to use LMS and Squeezelite as audiostreamer with a nice display :wink:

Hi,

I tested the screen using RPiOS.
The screen works fine via de GUI. Although there are some little strange behaviours in the screen- and appearance configuration tool. But it works.

I succeeded to install LMS. Not yet SqueezeLite. I also use the DACPi from Geekworm…
Meaning,I also have to figure out how to install/configure the audio followed by SqueezeLite…

Anyway, on DietPi, it’s just rotating the screen. If I succeed, all my problems are solved. :wink:

Should I put something in dietpi.txt?

I guess this needs to be done on config.txt

That’s what I also thought.
But I find different posibilities, like :

#Rotation
#display_hdmi_rotate=0
#lcd_rotate=0

But also :

display_rotate=1

I understood the value should be 1, but the screen remains vertical… :frowning:

If you are in the mood, you can compare the two config.txt files between DietPi and RPiOS.

That’s what I was thinking to do…
But there is nearly nothing in config.txt of RPiOS… :frowning:

but at least something that can be shared.

Hello

Hope it helps

To rotate the 7"9 screen, type in the terminal
sudo nano /etc/X11/xorg.conf.d/99-rotate_screen.conf

paste lines below and reboot

“Monitor” section
Identify “Monitor0”
“Rotate” option “left”
EndSection

“Screen” section
Identify “Screen0”
Device “Card0”
Monitor “Monitor0”
EndSection

Not sure if this helps but there is a similar question on rotating the screen for Chromium kiosk mode Configure screen resolution/orientation in Kiosk mode. · Issue #7263 · MichaIng/DietPi · GitHub

Hi,

I made some progress… :slight_smile:

On the commandline, I have to type the following:

export DISPLAY=:0
xrandr --output HDMI-2 --rotate left

Now, I should find a way to activate this automaticaly at boot or startup…

Next step is to correct the touchscreen, because this is not yet rotated…

And I also succeed to rotate the touch input as follow:

Rotary Touch Input

  1. Execution instructions: sudo nano /etc/udev/rules.d/99-waveshare-touch.rules
  2. In the window that opens, add the code as needed:
90 degrees:
ENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 -1 1 1 0 0"
180 degrees:
ENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1"
270 degrees:
ENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
  1. After reboot, touch and screen rotate.
1 Like