Add sway touchscreen service
This commit is contained in:
parent
54f77ca2d4
commit
1fb7d41384
14 changed files with 120 additions and 3 deletions
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# Copyright (C) 2024-present ROCKNIX (https://github.com/ROCKNIX)
|
||||
|
||||
cat <<EOF >/storage/.config/profile.d/001-device_config
|
||||
DEVICE_FAKE_JACKSENSE="false"
|
||||
DEVICE_POWER_LED="false"
|
||||
DEVICE_BRIGHTNESS="128"
|
||||
DEVICE_BATTERY_LED_STATUS="true"
|
||||
DEVICE_HAS_TOUCHSCREEN="true"
|
||||
EOF
|
|
@ -7,5 +7,6 @@ DEVICE_FAKE_JACKSENSE="true"
|
|||
DEVICE_POWER_LED="true"
|
||||
DEVICE_HEADPHONE_DEV="/dev/input/by-path/platform-rk817-sound-event"
|
||||
DEVICE_BRIGHTNESS="70"
|
||||
DEVICE_HAS_TOUCHSCREEN="true"
|
||||
|
||||
EOF
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Anbernic RG353V
|
11
packages/hardware/quirks/devices/Anbernic RG353VS/001-device_config
Executable file
11
packages/hardware/quirks/devices/Anbernic RG353VS/001-device_config
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
|
||||
|
||||
cat <<EOF >/storage/.config/profile.d/001-device_config
|
||||
DEVICE_FAKE_JACKSENSE="true"
|
||||
DEVICE_POWER_LED="true"
|
||||
DEVICE_HEADPHONE_DEV="/dev/input/by-path/platform-rk817-sound-event"
|
||||
DEVICE_BRIGHTNESS="70"
|
||||
|
||||
EOF
|
17
packages/hardware/quirks/devices/Anbernic RG353VS/020-gpios
Executable file
17
packages/hardware/quirks/devices/Anbernic RG353VS/020-gpios
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
|
||||
|
||||
cat <<EOF >/storage/.config/profile.d/020-gpios
|
||||
DEVICE_WIFI="5"
|
||||
DEVICE_LED="77"
|
||||
DEVICE_PWM_MOTOR="pwmchip1"
|
||||
DEVICE_JACK="86"
|
||||
EOF
|
||||
|
||||
. /storage/.config/profile.d/020-gpios
|
||||
# Enable PWM for rumble and turn rumble off during startup.
|
||||
echo 0 > /sys/class/pwm/${DEVICE_PWM_MOTOR}/export
|
||||
echo 1000000 > /sys/class/pwm/${DEVICE_PWM_MOTOR}/pwm0/period
|
||||
echo 1 > /sys/class/pwm/${DEVICE_PWM_MOTOR}/pwm0/enable
|
||||
echo 1000000 > /sys/class/pwm/${DEVICE_PWM_MOTOR}/pwm0/duty_cycle
|
16
packages/hardware/quirks/devices/Anbernic RG353VS/040-display
Executable file
16
packages/hardware/quirks/devices/Anbernic RG353VS/040-display
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
|
||||
|
||||
. /etc/profile
|
||||
|
||||
# Configure default contrast saturation and hue values
|
||||
for PROPERTY in brightness contrast saturation hue
|
||||
do
|
||||
MYVAL=$(get_setting display.${PROPERTY})
|
||||
if [ -z "${MYVAL}" ]
|
||||
then
|
||||
MYVAL=$(drm_tool list | sed -n '/Connector: 133/,$p' | awk '/'${PROPERTY}'/ {print $5}')
|
||||
fi
|
||||
paneladj ${PROPERTY} ${MYVAL}
|
||||
done
|
18
packages/hardware/quirks/devices/Anbernic RG353VS/info.d/001-panel
Executable file
18
packages/hardware/quirks/devices/Anbernic RG353VS/info.d/001-panel
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
ID=$(dmesg | grep "panel")
|
||||
case ${ID} in
|
||||
*newvision*)
|
||||
ID="v1"
|
||||
;;
|
||||
*sitronix*)
|
||||
ID="v2"
|
||||
;;
|
||||
*)
|
||||
ID="Unknown"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "${ID}" ]
|
||||
then
|
||||
echo "PANEL VERSION: ${ID}"
|
||||
fi
|
|
@ -13,6 +13,7 @@ DEVICE_HEADPHONE_DEV="/dev/input/by-path/platform-es8316-sound-event"
|
|||
DEVICE_HAS_HDMI="true"
|
||||
DEVICE_BATTERY_LED_STATUS="true"
|
||||
DEVICE_PWR_LED_CONTROL="true"
|
||||
DEVICE_HAS_TOUCHSCREEN="true"
|
||||
|
||||
DEVICE_TEMP_SENSOR=("/sys/devices/virtual/thermal/thermal_zone0/temp" "/sys/devices/virtual/thermal/thermal_zone1/temp")
|
||||
EOF
|
||||
|
|
|
@ -10,7 +10,7 @@ cat <<EOF >/storage/.config/profile.d/001-device_config
|
|||
#DEVICE_PLAYBACK_PATH_HP="0*"
|
||||
DEVICE_BRIGHTNESS="128"
|
||||
#DEVICE_HEADPHONE_DEV="/dev/input/by-path/platform-es8316-sound-event"
|
||||
#DEVICE_HAS_HDMI="true"
|
||||
DEVICE_HAS_TOUCHSCREEN="true"
|
||||
#DEVICE_BATTERY_LED_STATUS="true"
|
||||
#DEVICE_PWR_LED_CONTROL="true"
|
||||
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
### Set the default device configuration
|
||||
cat <<EOF >/storage/.config/profile.d/090-ui_service
|
||||
UI_SERVICE="weston.service"
|
||||
UI_SERVICE="sway.service essway.service"
|
||||
EOF
|
||||
|
|
|
@ -20,6 +20,7 @@ export SLOW_CORES \
|
|||
DEVICE_FUNC_KEYB_MODIFIER \
|
||||
DEVICE_HAS_FAN \
|
||||
DEVICE_HAS_HDMI \
|
||||
DEVICE_HAS_TOUCHSCREEN \
|
||||
DEVICE_HDMI_GPIO \
|
||||
DEVICE_HEADPHONE_DEV \
|
||||
DEVICE_JACK \
|
||||
|
|
|
@ -32,9 +32,13 @@ pre_configure_target() {
|
|||
|
||||
post_makeinstall_target() {
|
||||
mkdir -p ${INSTALL}/usr/lib/sway
|
||||
mkdir -p ${INSTALL}/usr/bin
|
||||
cp ${PKG_DIR}/scripts/sway.sh ${INSTALL}/usr/bin
|
||||
cp ${PKG_DIR}/scripts/sway-config ${INSTALL}/usr/lib/sway
|
||||
cp ${PKG_DIR}/scripts/sway_init.sh ${INSTALL}/usr/bin
|
||||
cp ${PKG_DIR}/scripts/sway-touch.sh ${INSTALL}/usr/bin
|
||||
|
||||
chmod +x ${INSTALL}/usr/bin/sway*
|
||||
|
||||
# install config & wallpaper
|
||||
mkdir -p ${INSTALL}/usr/share/sway
|
||||
|
@ -45,3 +49,6 @@ post_makeinstall_target() {
|
|||
safe_remove ${INSTALL}/usr/share/wayland-sessions
|
||||
}
|
||||
|
||||
post_install() {
|
||||
enable_service sway-touch.service
|
||||
}
|
||||
|
|
24
packages/wayland/compositor/sway/scripts/sway-touch.sh
Normal file
24
packages/wayland/compositor/sway/scripts/sway-touch.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2024-present ROCKNIX (https://github.com/ROCKNIX)
|
||||
|
||||
. /etc/profile
|
||||
|
||||
if [ ${DEVICE_HAS_TOUCHSCREEN} = 'true' ]; then
|
||||
|
||||
# Identify touchscreen controller
|
||||
TRIES=0
|
||||
TOUCHSCREEN=$(swaymsg -t get_inputs | jq -r '.[] | select(.type == "touch") | .identifier')
|
||||
while [ -z "${TOUCHSCREEN}" -a $TRIES -lt 30 ]; do
|
||||
TRIES=$((TRIES+1))
|
||||
sleep 1
|
||||
TOUCHSCREEN=$(swaymsg -t get_inputs | jq -r '.[] | select(.type == "touch") | .identifier')
|
||||
done
|
||||
|
||||
# Identify display output
|
||||
OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select (.focused).name')
|
||||
|
||||
# Map touchscreen
|
||||
swaymsg input "${TOUCHSCREEN}" map_to_output "${OUTPUT}"
|
||||
|
||||
fi
|
11
packages/wayland/compositor/sway/system.d/sway-touch.service
Normal file
11
packages/wayland/compositor/sway/system.d/sway-touch.service
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Set up touchscreen devices on sway
|
||||
After=essway.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/sway-touch.sh
|
||||
TimeoutStartSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=rocknix.target
|
Loading…
Reference in a new issue