commit d874be4fa61a83846ca76b3bd85b4962fb50bfb9 Author: YoungSoo Shin Date: Fri Dec 20 18:00:29 2024 +0900 Add diff --git a/README.md b/README.md new file mode 100644 index 0000000..42b3721 --- /dev/null +++ b/README.md @@ -0,0 +1,161 @@ +# Duel head + +## Display +- [Hardkernel 3.2" tft lcd](https://www.hardkernel.com/shop/c1-3-2inch-tfttouchscreen-shield/) +- Generic HDMI monitor + +## Configuration + +### Package +```bash +sudo apt install gnome-icon-theme weston=9.0.0-4ubuntu1 +``` + +The package `gnome-ichone-theme` is used for weston shortcut icon. + +### UDev `/etc/udev/rules.d/99-weston.rules` +```text +odroid@gnome-desktop:~$ cat /etc/udev/rules.d/99-weston.rules +ACTION=="add|change", SUBSYSTEM=="drm", DEVPATH=="/devices/platform/soc/fe000000.apb4/fe050000.spi/spi_master/spi0/spi0.0/drm/card1", ENV{ID_SEAT}="seat-weston" +#SUBSYSTEM=="graphics", ENV{ID_FOR_SEAT}=="graphics-platform-fe050000_spi-cs-0", ENV{ID_SEAT}="seat-weston" +ACTION=="add|change", SUBSYSTEM=="input", ENV{ID_FOR_SEAT}=="input-platform-fe050000_spi-cs-1", ENV{ID_SEAT}="seat-weston" +ACTION=="add|change", SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", OWNER="odroid", ENV{LIBINPUT_CALIBRATION_MATRIX}="1.366975 0.036143 -0.072346 -0.092563 -2.159515 1.082110" +``` +The key is to set `ID_SEAT` on the device to be separated. In the example above, it was set to `seat-weston`. + +Simply set `ID_SEAT` on at least one graphics output device and the input device you want to isolate. also, set the touch calibration values. + +If `ID_SEAT` set, GDM and ubuntu desktop not use these devices. (They use `seat0` - default) + + +### weston.ini `/etc/xdg/weston/weston.ini` +```text +odroid@gnome-desktop:~$ cat /etc/xdg/weston/weston.ini +[core] +require-input=false +locking=false +idle-time=0 +#gbm-format=abgr8888 +#repaint-window=16 +background-color=0x00ffffff +background-type=scale +panel-position=none +startup-animation=none +close-animation=none + +[shell] +background-color=0xff002244 +clock-format=minutes +locking=false + +[libinput] +touchscreen_calibrator=true +calibration_helper=/usr/bin/save-calibration + +[launcher] +path=/usr/bin/weston-terminal +icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png + +[launcher] +path=/root/tc +icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png + +[launcher] +path=/usr/bin/weston-simple-egl +icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png + +#[input-method] +#path=/usr/libexec/weston-keyboard + +#[xwayland] +#path=/usr/bin/Xwayland + +#[autolaunch] +#path=/usr/share/odroid-kiosk-weston/weston-autostart.sh +#watch=true + +[output] +name=UNNAMED-1 +mode=320x240 +ui-size=320x240 +priority=9 +seat=seat-weston +``` + +The key is `seat=seat-weston` in section `[output]`. Set the seat used for display. + +In weston9, the `SPI-1` device is recognized as `UNNAMED-1`, so we set it to `UNNAMED-1`. + + +### Systemd +#### Socket `/etc/systemd/system/weston.socket` +```text +odroid@gnome-desktop:~$ cat /etc/systemd/system/weston.socket +[Unit] +Description=Weston, a Wayland compositor + +[Socket] +ListenStream=%t/weston-0 +``` + +#### Service +```text +odroid@gnome-desktop:~$ cat /etc/systemd/system/weston.service +[Unit] +# Make sure we are started after logins are permitted. +Description=Weston Wayland compositor startup +Requires=systemd-user-sessions.service +After=systemd-user-sessions.service +After=plymouth-quit-wait.service +Wants=dbus.socket +After=dbus.socket +Requires=weston.socket +RequiresMountsFor=/run +After=getty@tty7.service +Conflicts=getty@tty7.service plymouth-quit.service +Before=graphical.target +ConditionPathExists=/dev/tty0 + +[Service] +Type=notify +StandardInput=tty +UtmpIdentifier=tty7 +User=root +#Group=odroid +EnvironmentFile=-/etc/default/weston +Environment="XDG_RUNTIME_DIR=/run/user/0" +Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus" +#Environment=XDG_SEAT=seat-weston +Environment=XDG_SESSION_CLASS=user +#Environment=XDG_SESSION_TYPE=wayland +#Environment=XDG_SESSION_DESKTOP=weston +#Environment=HOME=/home/odroid +#Environment=SEATD_VTBOUND=0 + +PAMName=login + +TTYPath=/dev/tty7 +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes + +StandardInput=tty-fail +StandardOutput=journal +StandardError=journal + +UtmpIdentifier=tty7 +UtmpMode=user + +ExecStart=/usr/bin/weston --log=/home/odroid/weston.log --seat=seat-weston --drm-device=card1 --socket=weston-0 --tty=7 --modules=systemd-notify.so + +[Install] +WantedBy=graphical.target +``` +In `ExecStart`... + +SPI Display's DRM device name is `card-1`, so must set `--drm-device=card1` + +Create a socket weston-0(`weston.socket`) and set it(`--socket=weston-0`) so that it does not overlap with sockets on the existing Ubuntu desktop. + +## TODO +- Run weston without root \ No newline at end of file diff --git a/overlay/etc/systemd/system/weston.service b/overlay/etc/systemd/system/weston.service new file mode 100644 index 0000000..5cf6af2 --- /dev/null +++ b/overlay/etc/systemd/system/weston.service @@ -0,0 +1,49 @@ +[Unit] +# Make sure we are started after logins are permitted. +Description=Weston Wayland compositor startup +Requires=systemd-user-sessions.service +After=systemd-user-sessions.service +After=plymouth-quit-wait.service +Wants=dbus.socket +After=dbus.socket +Requires=weston.socket +RequiresMountsFor=/run +After=getty@tty7.service +Conflicts=getty@tty7.service plymouth-quit.service +Before=graphical.target +ConditionPathExists=/dev/tty0 + +[Service] +Type=notify +StandardInput=tty +UtmpIdentifier=tty7 +User=root +#Group=odroid +EnvironmentFile=-/etc/default/weston +Environment="XDG_RUNTIME_DIR=/run/user/0" +Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus" +#Environment=XDG_SEAT=seat-weston +Environment=XDG_SESSION_CLASS=user +#Environment=XDG_SESSION_TYPE=wayland +#Environment=XDG_SESSION_DESKTOP=weston +#Environment=HOME=/home/odroid +#Environment=SEATD_VTBOUND=0 + +PAMName=login + +TTYPath=/dev/tty7 +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes + +StandardInput=tty-fail +StandardOutput=journal +StandardError=journal + +UtmpIdentifier=tty7 +UtmpMode=user + +ExecStart=/usr/bin/weston --log=/home/odroid/weston.log --seat=seat-weston --drm-device=card1 --socket=weston-0 --tty=7 --modules=systemd-notify.so + +[Install] +WantedBy=graphical.target \ No newline at end of file diff --git a/overlay/etc/systemd/system/weston.socket b/overlay/etc/systemd/system/weston.socket new file mode 100644 index 0000000..5e82417 --- /dev/null +++ b/overlay/etc/systemd/system/weston.socket @@ -0,0 +1,5 @@ +[Unit] +Description=Weston, a Wayland compositor + +[Socket] +ListenStream=%t/weston-0 \ No newline at end of file diff --git a/overlay/etc/udev/rules.d/99-touchscreen-calibration.rules b/overlay/etc/udev/rules.d/99-touchscreen-calibration.rules new file mode 100644 index 0000000..56b0d69 --- /dev/null +++ b/overlay/etc/udev/rules.d/99-touchscreen-calibration.rules @@ -0,0 +1 @@ +ACTION!="remove", SUBSYSTEM=="input", DEVPATH=="/devices/platform/soc/fe000000.apb4/fe050000.spi/spi_master/spi0/spi0.1/input/input4/event4", ENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="1.382308 0.050764 -0.072342 -0.013080 -2.273183 1.071859" \ No newline at end of file diff --git a/overlay/etc/udev/rules.d/99-weston.rules b/overlay/etc/udev/rules.d/99-weston.rules new file mode 100644 index 0000000..db49143 --- /dev/null +++ b/overlay/etc/udev/rules.d/99-weston.rules @@ -0,0 +1,2 @@ +ACTION=="add|change", SUBSYSTEM=="drm", DEVPATH=="/devices/platform/soc/fe000000.apb4/fe050000.spi/spi_master/spi0/spi0.0/drm/card1", ENV{ID_SEAT}="seat-weston" +ACTION=="add|change", SUBSYSTEM=="input", ENV{ID_FOR_SEAT}=="input-platform-fe050000_spi-cs-1", ENV{ID_SEAT}="seat-weston" \ No newline at end of file diff --git a/overlay/etc/xdg/weston/weston.ini b/overlay/etc/xdg/weston/weston.ini new file mode 100644 index 0000000..aa3ef11 --- /dev/null +++ b/overlay/etc/xdg/weston/weston.ini @@ -0,0 +1,37 @@ +[core] +require-input=false +locking=false +idle-time=0 +background-color=0x00ffffff +background-type=scale +panel-position=none +startup-animation=none +close-animation=none + +[shell] +background-color=0xff002244 +clock-format=minutes +locking=false + +[libinput] +touchscreen_calibrator=true +calibration_helper=/usr/bin/calibration-helper + +[launcher] +path=/usr/bin/weston-terminal +icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png + +[launcher] +path=/usr/bin/launch-calibration +icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png + +[launcher] +path=/usr/bin/weston-simple-egl +icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png + +[output] +name=UNNAMED-1 +mode=320x240 +ui-size=320x240 +priority=9 +seat=seat-weston \ No newline at end of file diff --git a/overlay/usr/bin/calibration-helper b/overlay/usr/bin/calibration-helper new file mode 100755 index 0000000..a39b2b5 --- /dev/null +++ b/overlay/usr/bin/calibration-helper @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +SYSPATH="$1" +MATRIX="$2 $3 $4 $5 $6 $7" + +echo "$1 $2 $3 $4 $5 $6 $7" > /root/tcc + +DEV_PATH=$(udevadm info $SYSPATH --query=property | awk -- 'BEGIN { FS="=" } { if ($1 == "DEVPATH") { print $2; exit } }') + +echo "$DEV_PATH" + +[ -z "$DEV_PATH" ] && exit 1 + +echo "ACTION!=\"remove\", SUBSYSTEM==\"input\", DEVPATH==\"$DEV_PATH\", ENV{ID_INPUT_TOUCHSCREEN}==\"1\", ENV{LIBINPUT_CALIBRATION_MATRIX}=\"$MATRIX\"" > /etc/udev/rules.d/99-touchscreen-calibration.rules diff --git a/overlay/usr/bin/launch-calibration b/overlay/usr/bin/launch-calibration new file mode 100755 index 0000000..3303486 --- /dev/null +++ b/overlay/usr/bin/launch-calibration @@ -0,0 +1,5 @@ +#!/bin/bash + +DEV_PATH="/sys"$(udevadm info /dev/input/by-path/platform-fe050000.spi-cs-1-event --query=property |\ +awk -- 'BEGIN { FS="=" } { if ($1 == "DEVPATH") { print $2; exit } }') +weston-touch-calibrator "$DEV_PATH"