Waveshare DSI LCD displays

@gvolt Nope, without it didn’t even turn back-light on…
I double checked by commenting it out.

I found it in the script (line 42), that’s why I added:

Thanks, good to know.

I know the script (and line 42 :wink: ) but wasn’t sure if adding that particular overlay was really necessary since there have been some installation scripts (for other displays) in Wavshare’s LCD-show repo putting unnecessary entries to config files…

hello @gvolt, thank you for this. I have unfortunately bought the 7.9inch DSI LCD before reading this and have been tinkering to get it to work without any success, so I believe you’ve confirmed it’s going to be hard to get working.

From what I understand my only options are to try to get WaveShare to build more drivers (for the specific kernel that Volumio currently uses) or that Volumio changes its kernel to suit the screen.

I’ve reached out to WaveShare and hope I hear back soon. Unfortunately their drivers are not open source.

For volumio, I’ve looked into making a custom build that uses kernel 5.10.103 as it’s the closest to the current volumio version. However I’m trying to use docker to do the build and it fails when trying to mount to chroot.

I just wanna check before putting more time into it, is building a custom volumio-os at kernel version 5.10.103 feasible to get this to work? I’m hoping based on this commit that it may be as simple as adding a hash for 5.10.103 on line 146 and then changing the value of KERNEL_VERSION to 5.10.103, and proceeding with a usual build.

What are my chances of success?

2 Likes

Very much interested if it works @Mark_Bastard, as I have same display laying around.
I wont have time to tinker around with this in near future, but, please, let me know, if you make some progress. :slight_smile:

1 Like

I’m building it right now using the pi itself rather than docker. If it works I’ll upload the img and link it for you.

@Tomala also contacted Waveshare. Don’t know if he has heard back yet.

I have not yet built Volumio myself, so unfortunately I can contribute little to this. But if you manage to create a runnable Volumio system with kernel 5.10.103, I would expect Waveshare’s drivers for the 7.9" DSI display made for that kernel version would make the display work.

1 Like

Excellent, just a progress update. I built a custom image and installed / booted successfully. I then installed the drivers as per the instructions in the waveshare wiki https://www.waveshare.com/wiki/7.9inch_DSI_LCD and rebooted. The screen actually started and is showing the CLI login screen! I haven’t installed the volumio plugin yet so I’ll give that a go, but it looks like the hard part is done!

Perhaps I celebrated too early, the volumio doesn’t have an area to login to ‘my volumio’ and I need to do that to be able to install the plugin. Sigh…

Okay, I have some success!

Waveshare ended up getting back to me very quickly and provided me a zip file with drivers for the kernel that Volumio uses. I used SCP to transfer them onto volumio, then installed them following the guide here: https://www.waveshare.com/wiki/7.9inch_DSI_LCD

The rotation didn’t work however. The only way I’ve been able to rotate it is to SSH in once it’s already booted and run:

export DISPLAY=:0
xrandr --output DSI-1 --rotate left

However this doesn’t persist on a reboot. Putting it in config.txt or userconfig.txt isn’t working, likely because the command runs too soon if it’s in that file. Does anyone know where the touch screen plugin writes its commands to rotate, what they are, and when they’re run?

I have asked the permission of Waveshare to share the drivers with you guys. If they approve I’ll upload them here.

3 Likes

Then put this in a shell script which you can call as a startup service?
(I expect it will works like given below, but did it out the top of my head, untested)

mkdir ~/scripts
cd scripts
nano startuplcd.sh

Copy Paste:

#!/bin/bash
export DISPLAY=:0
xrandr --output DSI-1 --rotate left

chmod 777 startuplcd.sh

Create startup service
sudo nano /lib/systemd/system/startuplcd.service

Copy Paste:

[Unit]
Description=startuplcd
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/bin/bash /home/volumio/scripts/startuplcd.sh

[Install]
WantedBy=multi-user.target
sudo chmod 644 /lib/systemd/system/startuplcd.service
sudo systemctl daemon-reload
sudo systemctl enable startuplcd.service

Reboot and see the magic happen :joy:

These lines are optional, i put them in al off my services as I don’t want anything to happen when the network is not connected yet.:

After=network-online.target
Wants=network-online.target
1 Like

Thanks, I’ll give that a go

Please report back if it did the trick

1 Like

Waveshare replied for email:
I’m sorry that the DSI LCD is not compatible with the Volumio display.
How about using HDMI display instead?
I brought 7.9" HDMI and currently waiting for delivery. Waveshare offered to me cool discount. :sunglasses:
Folks, if you get DSI to work with Volumio I will probably try it and then HDMI display I will give to my son for his desktop.

@Tomala I got it working, see above. If they dont give me permission to share the drivers broadly I could at least share them privately if you DM me

@Mark_Bastard, did @Wheaten s’ fix work for display rotation?
I am also highly interested in those drivers. :slight_smile:

Hi @Lyzards , no it didn’t work unfortunately.

@Wheaten the script doesn’t work, I think maybe it’s running too early so we need to hook it to wait for a different event rather than network being up.

If I run the script manually after everything is booted and the screen is already showing, it works.

./scripts/startup.sh

I’m thinking it’s best to dive deeper into how the plugin launches chromium and ensure that command runs at the correct time. It may even be that it has to run after chromium launches, like maybe it only works once a GUI process has launched and wouldn’t work for the CLI, so it’s running before the GUI has started. There’s no point in the bootup process where the CLI login prompt rotates.

By the way I received approval to share the drivers from Waveshare!
5.10.92-32.zip (33.3 KB)

Mods, if you want proof of approval I can send a screenshot of the email or forward you the email. Just let me know.

2 Likes

Okay, it’s a hack but I got something working. I modified /opt/volumiokiosk.sh as follows. I added the line starting with xrandr below

#!/bin/bash
while true; do timeout 3 bash -c "</dev/tcp/127.0.0.1/3000" >/dev/null 2>&1 && break; done
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /data/volumiokiosk/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"None"/' /data/volumiokiosk/Default/Preferences
if [ -L /data/volumiokiosk/SingletonCookie ]; then
  rm -rf /data/volumiokiosk/Singleton*
fi
openbox-session &
xrandr --output DSI-1 --rotate left &
while true; do
  /usr/bin/chromium-browser \
    --simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT' \
    --force-device-scale-factor=1 \
    --disable-pinch \
    --kiosk \
    --no-first-run \
    --noerrdialogs \
    --disable-3d-apis \
    --disable-breakpad \
    --disable-crash-reporter \
    --disable-infobars \
    --disable-session-crashed-bubble \
    --disable-translate \
    --user-data-dir='/data/volumiokiosk'     http://localhost:4004
done

I then changed this to make it happen before the openbox-session line and it still worked. Therefore I believe if I can get it to run immediately before this script it’ll probably work.
I didn’t need to export DISPLAY=:0 as that is only needed in an SSH session.

I’m assuming there’s a way to run things in certain orders in services.


EDIT:

Alright, I’ve finally nailed it.

You don’t need the service at all. Volumio seems to use something called openbox for its GUI, and it allows you to make a user specific autostart script.

mkdir /home/volumio/.config/openbox
nano /home/volumio/.config/openbox/autostart
#add in the following line and save
xrandr --output DSI-1 --rotate left
# rotate right if you want the screen orientated the other way for some reason
#

So the high level steps are:

  • Install volumio and the touch_display plugin normally
  • Install the custom driver I attached above as per the wiki instructions
  • Follow my guide to create the openbox autostart file above
  • Reboot and it should be working and horizontal

Thanks to everyone for their help, this ended up being a pretty clean way to get it working so I won’t need to return the screen. I’m otherwise very happy with the screen so that’s a win! In particular compared to the HDMI one I don’t need to worry about cables going out in such a way it’d ruin having a very slim profile. The case I’m going to make will have its entire front be just this screen.

Please let me know if it’s worth making another thread as a ‘guide’ or a wiki page or something else, so that in future people can follow a simple guide rather than trawling through the thread.

Cheers

1 Like

Here is my final guide on how to get Waveshare DSI monitors to work on Volumio.

My Gear (for reference)

  • Raspberry Pi 4B
  • Waveshare 7.9 inch DSI screen (not HDMI).

Base Installation
Install Volumio and Touch Display plugin. Optionally install Now Playing plugin (allows more customisation to make the screen nicer).
Go to volumio web interface and change the URL to have /dev at the top, and enable SSH.
Reboot volumio. You’ll note that the screen is still permanently turned off. If yours is somehow working, don’t bother with the further instructions as you have a different screen to mine.

Driver Installation
Download these drivers 5.10.92-32.zip (33.3 KB) which are not currently available publically.
Unzip the files as volumio doesn’t seem to have unzip installed.
SCP these to your volumio instance with the following command

scp /path/to/unzipped/files/* volumio@your.volumio.ip.address:~

This should copy them into your home holder on volumio, so now you can login:

ssh volumio@your.volumio.ip.address

Run the driver installation files

sudo bash ./WS_xinchDSI_Main.sh 7_9inch I2C0

Note you can change those last two parameters if you have a different screen or have changed the touch screen jumpers for some reason. Valid options are:

SCREEN_TYPE: 2_8inch, 4inch, 7inch, 9inch, 10_1inch, 7_9inch, 11_9inch
I2C_TYPE: I2C0, I2C1

Now reboot either through the volumio interface or because you’re already SSH’d into a terminal type reboot now

Now when it boots you should see first a terminal with some white text asking to login, but after a while you should see volumio appear on the screen, but it will be rotated the wrong way. This is because by default the screen is in portrait not landscape.

Correcting the screen orientation
I found that the settings in the Touch_Screen plugin did not work, so ignore them. Volumio seems to use a package called openbox to create its GUI, and it allows a simple per-user startup script, so let’s create one.

First make the folder in question
mkdir /home/volumio/.config/openbox

Now let’s make the startup file.
nano /home/volumio/.config/openbox/autostart

Type in the following line. Change ‘left’ to ‘right’ if you want it orientated the other way.
xrandr --output DSI-1 --rotate left

Reboot once more, and now when it starts it should work just right!

Bonus: Now Playing plugin settings
If you like the way I’ve got mine setup I’ll share how I made it this way by changing some settings in the Now Playing plugin. Note that I’m deliberately not using touch controls, I plan to make a HiFi style streamer and I don’t want people touching the screen. I have the android app for managing what’s playing and only want my screen to show what song is currently playing.

Text Styles:
  Font Sizes: Custom
  Title: 40px
  Artist: 36px
  Album: 30px
  Sample Rate: 20px
  Alignment (Horizontal): Center
  Alignment (Vertical): Spread

Widget Styles
  Widget Visibility: Custom
  Playback Buttons: Off
  Seek Bar: Off

Album Art
  Show Album Art: On
  Album Art Size: Custom
  Width: 400px
  Height: 400px
  Album Art Fit: Contain

Background
  Background Type: Volumio Background
  Image: myvinyl.jpg
  Image Fit: Fill
  Image Position: Center
  Background Overlay: Custom (Gradient)
  Gradient CSS: linear-gradient(to right, rgba(0,0,0,1), rgba(0,0,0,0.5))

Dock Component Menu
  Enabled: Off

Dock Component - Action Panel Trigger
  Enabled: Off

Volumio Kiosk (Local Display)
  Enable this. It makes this external screen show 'Now Playing' instead of the default 'Touch Screen' UI

Please if anyone follows this guide please let me know it works. I am doing it from memory after a lot of trial and error!

3 Likes

great to see it working, Make a note for yourself to add this line again when updating “Touch Display”

1 Like

@Mark_Bastard great work and write-up!
Everything is working!
Thanks a lot!

P.s. For those interested in correct touch screen orientation (270 deg in @Mark_Bastard case) don’t forget to add following line in userconfig.txt

dtoverlay=WS_xinchDSI_Touch,invertedx,swappedxy

3 Likes