Merge pull request #2763 from Oendaril/dev

XU10 and RK3326 fixes
This commit is contained in:
Brooksytech 2024-01-29 21:13:24 -08:00 committed by GitHub
commit a8eedf9429
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 156 additions and 67 deletions

View file

@ -172,7 +172,7 @@ mode = 2
# Specifies which joystick is bound to this controller: -1=No joystick, 0 or more= SDL Joystick number
device = 0
# SDL joystick name (or Keyboard)
name = "xu10_joypad"
name = "XU10 Gamepad"
# Specifies whether this controller is 'plugged in' to the simulated N64
plugged = True
# Specifies which type of expansion pak is in the controller: 1=None, 2=Mem pak, 4=Transfer pak, 5=Rumble pak
@ -195,15 +195,15 @@ DPad L = button(14)
DPad D = button(13)
DPad U = button(12)
Start = button(9)
Z Trig = button(4)
B Button = button(3)
A Button = button(0)
Z Trig = button(7)
B Button = button(1)
A Button = button(2)
C Button R = axis(2+)
C Button L = axis(2-)
C Button D = axis(3+)
C Button U = axis(3-)
R Trig = button(5)
L Trig = button(6)
L Trig = button(4)
Mempak switch =
Rumblepak switch =
# Analog axis configuration mappings

View file

@ -123,3 +123,28 @@ Rumblepak switch =
# Analog axis configuration mappings
X Axis = button(12,13)axis(0-,0+)
Y Axis = button(10,11)axis(1-,1+)
[XU10 Gamepad]
plugged = True
mouse = False
AnalogDeadzone = 0,0
AnalogPeak = 32768, 32768
DPad R = button(15)
DPad L = button(14)
DPad D = button(13)
DPad U = button(12)
Start = button(9)
Z Trig = button(7)
B Button = button(1)
A Button = button(2)
C Button R = axis(2+)
C Button L = axis(2-)
C Button D = axis(3+)
C Button U = axis(3-)
R Trig = button(5)
L Trig = button(4)
Mempak switch =
Rumblepak switch =
#Analog axis configuration mappings
X Axis = axis(0-,0+)
Y Axis = axis(1-,1+)

View file

@ -10,6 +10,5 @@ DEVICE_PLAYBACK_PATH_SPK="SPK"
DEVICE_PLAYBACK_PATH_HP="HP"
DEVICE_BRIGHTNESS="128"
DEVICE_BATTERY_LED_STATUS="true"
DEVICE_PWR_LED_GPIO="77"
DEVICE_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone0/temp"
EOF

View file

@ -0,0 +1,67 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2020-present Fewtarius
# Simple script to watch the battery capacity and
# turn the power LED to different states:
# 0-10% flashing blue and teal
# 11-20% teal
# 21+% blue
# charging purple
# fully charged white
. /etc/profile
function set_led() {
case $1 in
white)
echo 1 > /sys/class/leds/red\:charging/brightness
echo 1 > /sys/class/leds/green\:status/brightness
;;
purple)
echo 1 > /sys/class/leds/red\:charging/brightness
echo 0 > /sys/class/leds/green\:status/brightness
;;
blue)
echo 0 > /sys/class/leds/red\:charging/brightness
echo 0 > /sys/class/leds/green\:status/brightness
;;
teal)
echo 0 > /sys/class/leds/red\:charging/brightness
echo 1 > /sys/class/leds/green\:status/brightness
;;
esac
}
while true
do
CAP=$(cat /sys/class/power_supply/battery/capacity)
STAT=$(cat /sys/class/power_supply/battery/status)
if [[ ${STAT} == "Discharging" ]]
then
if (( ${CAP} <= 10 ))
then
for ctr in $(seq 1 1 5)
do
set_led teal
sleep .5
set_led blue
sleep .5
done
continue
elif (( ${CAP} <= 20 ))
then
set_led teal
else
set_led blue
fi
elif (( ${CAP} <= 95 ))
then
set_led purple
else
set_led white
fi
sleep 15
done

View file

@ -8,11 +8,6 @@
. /etc/profile
# Set export GPIO for Power LED
if [ ! -d "/sys/class/gpio/gpio${DEVICE_PWR_LED_GPIO}" ]; then
echo ${DEVICE_PWR_LED_GPIO} > /sys/class/gpio/export
fi
function set_led() {
case $1 in
red|off)
@ -29,42 +24,52 @@ function set_led() {
esac
}
#Redirect to the device quirks version if it is there
if [ -f "/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/bin/battery_led_status" ]
then
"/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/bin/battery_led_status" $*
else
# Set export GPIO for Power LED
if [ ! -d "/sys/class/gpio/gpio${DEVICE_PWR_LED_GPIO}" ]; then
echo ${DEVICE_PWR_LED_GPIO} > /sys/class/gpio/export
fi
while true
do
CAP=$(cat /sys/class/power_supply/battery/capacity)
STAT=$(cat /sys/class/power_supply/battery/status)
ISDISABLED=$(get_setting powerled.disabled)
if [ "${ISDISABLED}" == "1" ]
then
set_led off
else
if [[ ${STAT} == "Discharging" ]]
while true
do
CAP=$(cat /sys/class/power_supply/battery/capacity)
STAT=$(cat /sys/class/power_supply/battery/status)
ISDISABLED=$(get_setting powerled.disabled)
if [ "${ISDISABLED}" == "1" ]
then
#if (( ${CAP} <= 50 ))
#then
# for ctr in $(seq 1 1 5)
# do
# set_led orange
# sleep .5
# set_led red
# sleep .5
# done
# continue
#elif (( ${CAP} <= 20 ))
if (( ${CAP} <= 20 ))
set_led off
else
if [[ ${STAT} == "Discharging" ]]
then
set_led red
elif (( ${CAP} <= 30 ))
#if (( ${CAP} <= 50 ))
#then
# for ctr in $(seq 1 1 5)
# do
# set_led orange
# sleep .5
# set_led red
# sleep .5
# done
# continue
#elif (( ${CAP} <= 20 ))
if (( ${CAP} <= 20 ))
then
set_led red
elif (( ${CAP} <= 30 ))
then
set_led orange
else
set_led green
fi
elif (( ${CAP} >= 95 ))
then
set_led orange
else
set_led green
fi
elif (( ${CAP} >= 95 ))
then
set_led green
sleep 15
fi
sleep 15
fi
done
done
fi

View file

@ -124,6 +124,9 @@
# build and install OpenVPN support (yes / no)
OPENVPN_SUPPORT="no"
# build and install ZeroTier support (yes / no)
ZEROTIER_SUPPORT="yes"
# build and install diskmounter support (udevil)
# this service provide auto mounting support for external drives in the
# mediacenter also automount internally drives at boottime via udev (yes / no)

View file

@ -948,9 +948,9 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-r33s.dts l
+ };
+};
diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts linux/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts
--- linux.orig/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts 1970-01-01 00:00:00.000000000 +0000
+++ linux/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts 2024-01-29 05:08:22.844542450 +0000
@@ -0,0 +1,835 @@
--- linux.orig/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts 1969-12-31 19:00:00.000000000 -0500
+++ linux/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts 2024-01-29 18:25:00.758766065 -0500
@@ -0,0 +1,825 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Hardkernel Co., Ltd
@ -1255,32 +1255,23 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts linux/
+ };
+ };
+
+ /* led-1 is wired directly to output of always-on regulator */
+
+ leds: gpio-leds {
+ compatible = "gpio-leds";
+ pinctrl-0 = <&led_pins>;
+ pinctrl-names = "default";
+
+ green_led: led-0 {
+ color = <LED_COLOR_ID_GREEN>;
+ default-state = "on";
+ function = LED_FUNCTION_POWER;
+ gpios = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>;
+ };
+
+ amber_led: led-1 {
+ color = <LED_COLOR_ID_AMBER>;
+ function = LED_FUNCTION_CHARGING;
+ gpios = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>;
+ retain-state-suspended;
+ };
+
+ red_led: led-2 {
+ led-0 {
+ color = <LED_COLOR_ID_RED>;
+ default-state = "off";
+ function = LED_FUNCTION_CHARGING;
+ gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>;
+ };
+
+ led-1 {
+ color = <LED_COLOR_ID_GREEN>;
+ default-state = "off";
+ function = LED_FUNCTION_STATUS;
+ gpios = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;
+ gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
+ };
+ };
+
@ -1758,9 +1749,8 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts linux/
+ gpio-led {
+ led_pins: led-pins {
+ rockchip,pins =
+ <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>,
+ <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>,
+ <0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>;
+ <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>,
+ <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+ };
+