Merge pull request #8 from r3claimer/dev

Add sway touchscreen service
This commit is contained in:
r3claimer 2024-03-26 20:57:06 -07:00 committed by GitHub
commit 381c213d5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 122 additions and 5 deletions

View file

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

View file

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

View file

@ -1 +0,0 @@
Anbernic RG353V

View 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

View 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

View 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

View 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

View file

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

View file

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

View file

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

View file

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

View file

@ -19,4 +19,4 @@ RestartSec=2
[Install]
WantedBy=jelos.target
WantedBy=rocknix.target

View file

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

View 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

View 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

View file

@ -1,7 +1,7 @@
[Unit]
Description=Sway Wayland Compositor
Before=graphical.target essway.service
After=multi-user.target jelos-automount.service
After=multi-user.target rocknix-automount.service
ConditionKernelCommandLine=!installer
[Service]