0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2025-03-01 11:31:22 +00:00
GavinDarkglider 3cc9dbb9ca Switch: Tons of fixes, with poor commit history. lol. (#1839)
* Switch: Minor kernel config update

* fat32-boot: Attempt to fix umounting flash partition to prevent possible corruption on reboot

* Switch: Bootloader: Fix mistake in boot.txt that wasnt properly setting up dvfsb stuff

* Switch: Add user for retroarch to run as

* Busybox: Fix writing flash partition when using fat32-boot option to give all users write access

* Audio: Pulseaudio-configs: Minor updates for use when running apps as non root user

* Switch: Finalize changes so for running as non root user.

* Retroarch: Revert broken WAR in retroarch-config script

* Switch: Fix default retroarch config, to work out of box with new user

* Fix retroarch controller configs for switch, and add line to fix it to the update.sh file

* Add back missing lite gamepad config, which got lost in a rebase somewhere

* Retroarch: Start Reworking Switch Clocks

* Switch: Bump switch specific package versions, and add changes needed to make built in lakka clock speed menu work properly. Also hide gamemode.

* Retroarch: add patch to remove game mode from menu to all builds

* Switch: dont enable overclock by default

* sort

* Sort me.

* Switch: Drop old flycast from switch build in favor of newer core.

This has some issues with some games showing artifact bars using vulkan renderer,
but also fixes a lot of issues. As a work around to this issue, users can set opengl renderer, and the bars will not be there.

* More to sort

* Fix CEC stuff

* Fix dock audio switching with new user config

* WIP: GPU Clocks

* sort

* fix quotes

* Add working single joycon configs

* Update Switch Joycond to latest

* Switch: Retroarch: add bluetooth ertm disable, and add patch to fix l2cap kernel hang

* Switch: Update image stuff, so kernel reflects Lakka/Libreelec kernel makes in uimage header, and re-arange some things to make them global

* Switch: Linux: Enable Xpad Driver for wired xbox controllers

* Switch: More xpadneo stuff
This should at a minimum fix issues with Xbox One S controllers
8bitdo and GuliKit KingKong Controller families will probably need more
hid-core patching to redirect them to this driver for support.

Also, when 0.10 version of Xpadneo is released, It will stop building due to kernel not having this patch:
f07b3c1da9

When the time comes, this will need to be looked into.

* xpadneo: update package

* Switch: Update U-Boot to Switchroot 2023-NX03 version

* Switch: Update kernel to Switchroot 5.1.0

* Switch: Create Singular switch-bsp Package
This package consolodates the switch specific configs into one package,
as this feels cleaner, and easier to deal with later, if/when needed.
This package combines the switch-alsa-ucm and switch-bluetooth-dock stuff
into one package.

---------

Co-authored-by: Tomáš Kelemen (vudiq) <vudiq@vudiq.sk>
2023-06-10 03:17:06 +03:00

131 lines
8.9 KiB
Bash
Executable File

#!/bin/bash
if [[ -f /flash/switchroot/joycon_mac.ini ]]; then
# Collect joycon_00 info from ini
JOYCON_00_TYPE=$(sed -nr "/^\[joycon_00\]/ { :l /^type[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n" )
JOYCON_00_MAC=$(sed -nr "/^\[joycon_00\]/ { :l /^mac[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
JOYCON_00_HOST_MAC=$(sed -nr "/^\[joycon_00\]/ { :l /^host[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
JOYCON_00_LTK=$(sed -nr "/^\[joycon_00\]/ { :l /^ltk[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
# collect joycon_00 info from ini
JOYCON_01_TYPE=$(sed -nr "/^\[joycon_01\]/ { :l /^type[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
JOYCON_01_MAC=$(sed -nr "/^\[joycon_01\]/ { :l /^mac[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
JOYCON_01_HOST_MAC=$(sed -nr "/^\[joycon_01\]/ { :l /^host[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
JOYCON_01_LTK=$(sed -nr "/^\[joycon_01\]/ { :l /^ltk[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
# Handle Host BT MAC. Agnostically.
if [[ ! ${JOYCON_00_TYPE} == "0" ]]; then
BT_MAC_ADDR=${JOYCON_00_HOST_MAC}
elif [[ ! ${JOYCON_01_TYPE} == "0" ]]; then
BT_MAC_ADDR=${JOYCON_01_HOST_MAC}
fi
# Handle Joycon Pair data.
if [[ ${JOYCON_00_TYPE} == "1" ]]; then
BT_DEV_00_NAME="Joy-Con (L)"
BT_DEV_00_ID=8198
BT_DEV_00_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920060902030900010902042801090205090002"
elif [[ ${JOYCON_00_TYPE} == "2" ]]; then
BT_DEV_00_NAME="Joy-Con (R)"
BT_DEV_00_ID=8199
BT_DEV_00_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920070902030900010902042801090205090002"
fi
if [[ ${JOYCON_01_TYPE} == "1" ]]; then
BT_DEV_01_NAME="Joy-Con (L)"
BT_DEV_01_ID=8198
BT_DEV_01_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920060902030900010902042801090205090002"
elif [[ ${JOYCON_01_TYPE} == "2" ]]; then
BT_DEV_01_NAME="Joy-Con (R)"
BT_DEV_01_ID=8199
BT_DEV_01_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920070902030900010902042801090205090002"
fi
if [[ ! -d /var/bluetoothconfig/${BT_MAC_ADDR}/cache ]]; then
mkdir -p /var/bluetoothconfig/${BT_MAC_ADDR}/cache
fi
if [[ ! ${JOYCON_00_TYPE} == "0" ]]; then
if [[ ! -d /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_00_MAC} ]]; then
mkdir -p /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_00_MAC}
cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_00_MAC}/info
[General]
Name=${BT_DEV_00_NAME}
Class=0x000508
SupportedTechnologies=BR/EDR;
Trusted=true
Blocked=false
Services=00001000-0000-1000-8000-00805f9b34fb;00001124-0000-1000-8000-00805f9b34fb;00001200-0000-1000-8000-00805f9b34fb;
[LinkKey]
Key=${JOYCON_00_LTK}
Type=4
PINLength=0
[DeviceID]
Source=2
Vendor=1406
Product=${BT_DEV_00_ID}
Version=1
[ConnectionParameters]
MinInterval=5
MaxInterval=15
Latency=120
Timeout=600
EOF
cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/cache/${JOYCON_00_MAC}
[General]
Name=${BT_DEV_00_NAME}
[ServiceRecords]
${BT_DEV_00_SERVICE_RECORDS}
EOF
fi
fi
if [[ ! ${JOYCON_01_TYPE} == "0" ]]; then
if [[ ! -d /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_01_MAC} ]]; then
mkdir -p /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_01_MAC}
cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_01_MAC}/info
[General]
Name=${BT_DEV_01_NAME}
Class=0x000508
SupportedTechnologies=BR/EDR;
Trusted=true
Blocked=false
Services=00001000-0000-1000-8000-00805f9b34fb;00001124-0000-1000-8000-00805f9b34fb;00001200-0000-1000-8000-00805f9b34fb;
[LinkKey]
Key=${JOYCON_01_LTK}
Type=4
PINLength=0
[DeviceID]
Source=2
Vendor=1406
Product=${BT_DEV_01_ID}
Version=1
[ConnectionParameters]
MinInterval=5
MaxInterval=15
Latency=120
Timeout=600
EOF
cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/cache/${JOYCON_01_MAC}
[General]
Name=${BT_DEV_01_NAME}
[ServiceRecords]
${BT_DEV_01_SERVICE_RECORDS}
EOF
fi
fi
fi