diff --git a/packages/hardware/quirks/devices/Anbernic RG353P/001-device_config b/packages/hardware/quirks/devices/Anbernic RG353P/001-device_config new file mode 100644 index 000000000..54c030c92 --- /dev/null +++ b/packages/hardware/quirks/devices/Anbernic RG353P/001-device_config @@ -0,0 +1,11 @@ +#!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# Copyright (C) 2024-present ROCKNIX (https://github.com/ROCKNIX) + +cat </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 diff --git a/packages/hardware/quirks/devices/Anbernic RG353V/001-device_config b/packages/hardware/quirks/devices/Anbernic RG353V/001-device_config index b57d9e7bf..474f33e1e 100755 --- a/packages/hardware/quirks/devices/Anbernic RG353V/001-device_config +++ b/packages/hardware/quirks/devices/Anbernic RG353V/001-device_config @@ -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 diff --git a/packages/hardware/quirks/devices/Anbernic RG353VS b/packages/hardware/quirks/devices/Anbernic RG353VS deleted file mode 120000 index 13b73acc2..000000000 --- a/packages/hardware/quirks/devices/Anbernic RG353VS +++ /dev/null @@ -1 +0,0 @@ -Anbernic RG353V \ No newline at end of file diff --git a/packages/hardware/quirks/devices/Anbernic RG353VS/001-device_config b/packages/hardware/quirks/devices/Anbernic RG353VS/001-device_config new file mode 100755 index 000000000..b57d9e7bf --- /dev/null +++ b/packages/hardware/quirks/devices/Anbernic RG353VS/001-device_config @@ -0,0 +1,11 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +cat </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 diff --git a/packages/hardware/quirks/devices/Anbernic RG353VS/020-gpios b/packages/hardware/quirks/devices/Anbernic RG353VS/020-gpios new file mode 100755 index 000000000..608532312 --- /dev/null +++ b/packages/hardware/quirks/devices/Anbernic RG353VS/020-gpios @@ -0,0 +1,17 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +cat </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 diff --git a/packages/hardware/quirks/devices/Anbernic RG353VS/040-display b/packages/hardware/quirks/devices/Anbernic RG353VS/040-display new file mode 100755 index 000000000..107ddab32 --- /dev/null +++ b/packages/hardware/quirks/devices/Anbernic RG353VS/040-display @@ -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 diff --git a/packages/hardware/quirks/devices/Anbernic RG353VS/info.d/001-panel b/packages/hardware/quirks/devices/Anbernic RG353VS/info.d/001-panel new file mode 100755 index 000000000..da49dae9d --- /dev/null +++ b/packages/hardware/quirks/devices/Anbernic RG353VS/info.d/001-panel @@ -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 diff --git a/packages/hardware/quirks/devices/Anbernic RG552/001-device_config b/packages/hardware/quirks/devices/Anbernic RG552/001-device_config index e2692b88c..af86e5cf9 100755 --- a/packages/hardware/quirks/devices/Anbernic RG552/001-device_config +++ b/packages/hardware/quirks/devices/Anbernic RG552/001-device_config @@ -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 diff --git a/packages/hardware/quirks/devices/GameForce ACE/001-device_config b/packages/hardware/quirks/devices/GameForce ACE/001-device_config index 80f1c4bf6..6d43256f5 100755 --- a/packages/hardware/quirks/devices/GameForce ACE/001-device_config +++ b/packages/hardware/quirks/devices/GameForce ACE/001-device_config @@ -10,7 +10,7 @@ cat </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" diff --git a/packages/hardware/quirks/platforms/RK3588/090-ui_service b/packages/hardware/quirks/platforms/RK3588/090-ui_service index bc7013fc9..5da8b376c 100755 --- a/packages/hardware/quirks/platforms/RK3588/090-ui_service +++ b/packages/hardware/quirks/platforms/RK3588/090-ui_service @@ -4,5 +4,5 @@ ### Set the default device configuration cat </storage/.config/profile.d/090-ui_service -UI_SERVICE="weston.service" +UI_SERVICE="sway.service essway.service" EOF diff --git a/packages/hardware/quirks/profile.d/999-export b/packages/hardware/quirks/profile.d/999-export index cb18620ef..9b56fb76f 100755 --- a/packages/hardware/quirks/profile.d/999-export +++ b/packages/hardware/quirks/profile.d/999-export @@ -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 \ diff --git a/packages/wayland/compositor/sway/package.mk b/packages/wayland/compositor/sway/package.mk index 60516ed17..d02d6270e 100644 --- a/packages/wayland/compositor/sway/package.mk +++ b/packages/wayland/compositor/sway/package.mk @@ -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 +} diff --git a/packages/wayland/compositor/sway/scripts/sway-touch.sh b/packages/wayland/compositor/sway/scripts/sway-touch.sh new file mode 100644 index 000000000..9b09d8e94 --- /dev/null +++ b/packages/wayland/compositor/sway/scripts/sway-touch.sh @@ -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 diff --git a/packages/wayland/compositor/sway/system.d/sway-touch.service b/packages/wayland/compositor/sway/system.d/sway-touch.service new file mode 100644 index 000000000..8694f9e14 --- /dev/null +++ b/packages/wayland/compositor/sway/system.d/sway-touch.service @@ -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