Trying to get this to work with my Pi400. The script gives me a grand total of 0 install options so I had to manually clone the pi4 branch and install and then… well the backlight on my display turns on and the touchscreen works (strangely) but I get no display whatsoever. Am I missing something? Is there some kind of diagnostic I can run to see what the deal is or adjust/confirm the config?
So I found the solution here, looks like the /boot/config.txt was missing one line:
opened 05:25PM - 11 Apr 22 UTC
notice
Pi 3B and Pi 4 users running the latest and greatest Raspberry Pi OS should fore… go our installer and use the instructions below.
> :information_source: If you're tied to an older OS and you want to install the legacy drivers, use:
> `curl -sSL get.pimoroni.com/hyperpixel4-legacy | bash`
This new OS can currently be found in Raspberry Pi Imager under "Raspberry Pi OS (Other)"
![image](https://user-images.githubusercontent.com/1746967/162789702-0c95f165-e482-4d47-a179-d841b903985c.png)
Once installed you need only one line in `/boot/config.txt`:
* Rectangular: `dtoverlay=vc4-kms-dpi-hyperpixel4`
* Square: `dtoverlay=vc4-kms-dpi-hyperpixel4sq`
You can rotate these in config.txt by adding the `rotate=` parameter, like so:
```
dtoverlay=vc4-kms-dpi-hyperpixel4sq,rotate=90
```
This supports rotation in console, too, for all you CyberDeck builders!
## HyperPixel 4 Rectangular Rotations
Ensure rotation is set to "Normal" in "Display Configuration"
And that the dtoverlay is in `/boot/config.txt`:
```
dtoverlay=vc4-kms-dpi-hyperpixel4
```
Finally use one of the following `dtparam` lines immediately underneath to set the parameters:
* The default is portrait with header on the right, no extra line needed
* `dtparam=rotate=90,touchscreen-swapped-x-y,touchscreen-inverted-y` - Landscape with header on the bottom
* `dtparam=rotate=180` - Portrait with header on the left
* `dtparam=rotate=270,touchscreen-swapped-x-y,touchscreen-inverted-x` - Landscape with header on the top
## HyperPixel 4 Square Rotations
HyperPixel 4 Square does not correctly swap or invert touch input, so you may want to use the Xorg config method below.
Ensure rotation is set to "Normal" in "Display Configuration"
And that the dtoverlay is in `/boot/config.txt`:
```
dtoverlay=vc4-kms-dpi-hyperpixel4sq
```
Finally use one of the following `dtparam` lines immediately underneath to set the parameters:
* Default is header on the top
* `dtparam=rotate=90` - Header is on the left (wonky touch, see below)
* `dtparam=rotate=180` - Header *still* on the top (doesn't work? Same as default)
* `dtparam=rotate=270` - Header is on the right (wonky touch, see below)
:warning: The `touchscreen-swapped-x-y` parameter does not seem to work with Square. You may need to use the script below for Raspberry Pi OS with Desktop.
## On the fly rotation
Rotating the display via "Screen Configuration" ("arandr") results in inverted touch input and other weirdness- use the dtoverlay params.
If you want to rotate on the fly you can use the below bash script to rotate either display and persist settings into Xorg configuration files.
:warning: Note: You *must* remove the `rotate=` argument from `/boot/config.txt` for these to make sense.
You can remove the rotation config by deleting the `/usr/share/X11/xorg.conf.d/88-hyperpixel4-touch.conf` and `/usr/share/X11/xorg.conf.d/88-dsi-1-rotate.conf` files.
```bash
#!/bin/bash
UTILITY="hyperpixel4-rotate (Rectangular)"
XORG_TOUCH_CONF_FILE="/usr/share/X11/xorg.conf.d/88-hyperpixel4-touch.conf"
XORG_CONF_FILE="/usr/share/X11/xorg.conf.d/88-dsi-1-rotate.conf"
OVERLAY_S="vc4-kms-dpi-hyperpixel4sq"
OVERLAY_R="vc4-kms-dpi-hyperpixel4"
function success() {
echo -e "$(tput setaf 2)$1$(tput sgr0)"
}
function inform() {
echo -e "$(tput setaf 6)$1$(tput sgr0)"
}
function warning() {
echo -e "$(tput setaf 1)$1$(tput sgr0)"
}
function set_xorg_conf {
if [ "$DISPLAY" == "" ]; then
inform "No DISPLAY variable set, trying :0.0"
export DISPLAY=:0.0
fi
inform "Rotating display $1";
xrandr --output DPI-1 --rotate $1
MATRIX="$2 $3 $4 $5 $6 $7 $8 $9 ${10}"
inform "Setting libinput Calibration Matrix: 1 0 0 0 1 0";
xinput set-prop "pointer:$DEVICE" "libinput Calibration Matrix" 1 0 0 0 1 0 0 0 1
inform "Setting Coordinate Transformation Matrix: $MATRIX";
xinput set-prop "pointer:$DEVICE" "Coordinate Transformation Matrix" $MATRIX
inform "Saving xorg touch config to $XORG_TOUCH_CONF_FILE";
sudo tee $XORG_TOUCH_CONF_FILE > /dev/null <<EOF
# Auto generated by $UTILITY, edit with care!
Section "InputClass"
Identifier "HyperPixel4 $DEVICE"
MatchProduct "$DEVICE"
Option "CalibrationMatrix" "1 0 0 0 1 0 0 0 1"
Option "TransformationMatrix" "$MATRIX"
EndSection
EOF
inform "Saving xorg rotate config to $XORG_CONF_FILE";
sudo tee $XORG_CONF_FILE > /dev/null <<EOF
# Auto generated by $UTILITY, edit with care!
Section "Monitor"
Identifier "DPI-1"
Option "Rotate" "$1"
EndSection
EOF
}
printf "HyperPixel 4: Display & Touch Rotation\n"
printf "This utility requires the Raspberry Pi OS desktop or an *Xorg-based* alternative.\n\n"
ORIENTATION=$1
grep -e "^dtoverlay=$OVERLAY_S.*" /boot/config.txt > /dev/null
if [ $? -ne 0 ]; then
grep -e "^dtoverlay=$OVERLAY_R.*" /boot/config.txt > /dev/null
if [ $? -ne 0 ]; then
warning "Rotation requires hardware support on the Pi 4 or Pi 400"
warning "Ensure your HyperPixel4 is enabled in /boot/config.txt"
printf "\nSquare: dtoverlay=$OVERLAY_S\n"
printf "Rectangular: dtoverlay=$OVERLAY_R\n\n"
exit 1
else
inform "Detected HyperPixel 4 Rectangular (found \"$OVERLAY_R\" in config.txt)"
DEVICE="Goodix Capacitive TouchScreen"
fi
else
inform "Detected HyperPixel 4 Square (found \"$OVERLAY_S\" in config.txt)"
DEVICE="EP0110M09"
fi
case $ORIENTATION in
"right")
set_xorg_conf $ORIENTATION 0 1 0 -1 0 1 0 0 1
;;
"left")
set_xorg_conf $ORIENTATION 0 -1 1 1 0 0 0 0 1
;;
"inverted")
set_xorg_conf $ORIENTATION -1 0 1 0 -1 1 0 0 1
;;
"normal")
set_xorg_conf $ORIENTATION 1 0 0 0 1 0 0 0 1
;;
*)
printf "Unsupported orientation: $ORIENTATION\n\n";
printf "Usage:\n"
printf " $0 <orientation>\n\n"
printf "Where orientation is one of: left, right, normal, inverted.\n"
exit 1
esac
```
dtoverlay=vc4-kms-dpi-hyperpixel4