This commit is contained in:
2024-12-20 18:00:29 +09:00
commit d874be4fa6
8 changed files with 276 additions and 0 deletions

161
README.md Normal file
View File

@@ -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