0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2024-12-16 05:38:51 +00:00
GavinDarkglider 600e246a94
L4T/Ayn: upstream changes from 5.x
Lakka 5.x Switch changes (#1853)
Lakka v5.x switchroot 5.1.2 (#1871)
Fix Switch Issue's in upstream 5.x (#1888)
Minor Switch Changes (#1893)
Lakka v5.x switch 3 (#1895)
Lakka v5.x switch 4 (#1898)
L4T: Xorg-server: Fix build issue (#1924)
Switch: remove ra patch
Lakka v5.x switch 6 (#1926)
Cleanups, More LibreELEC Stuff, more permission fixes, Misc switch stuff. (#1930)
Switch: U-Boot: bump version to 2024-NX02 (#1946)

L4T/Ayn post-upstreaming fixes
- retroarch_joypad_autoconfig: remove spaces from file names
- retroarch: remove Switch specific patch merged upstream
- libXv: move to L4T packages folder (package removed in upstream)
- bring some packages from v5.x to L4T packages
- ffmpeg: remove vulkan
- remove stella core from Switch build (missing C++ headers)
- Ayn/Odin: use proper kernel arg to not hide kernel messages in console
- connman: add wpa_supplicant support back
2024-05-21 15:41:36 +02:00

217 lines
18 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")
if [[ -z ${JOYCON_00_TYPE} ]]; then
JOYCON_00_TYPE="0"
fi
# collect joycon_01 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")
if [[ -z ${JOYCON_01_TYPE} ]]; then
JOYCON_01_TYPE="0"
fi
# Collect joycon_02 info from ini
JOYCON_02_TYPE=$(sed -nr "/^\[joycon_02\]/ { :l /^type[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
JOYCON_02_MAC=$(sed -nr "/^\[joycon_02\]/ { :l /^mac[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
JOYCON_02_HOST_MAC=$(sed -nr "/^\[joycon_02\]/ { :l /^host[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
JOYCON_02_LTK=$(sed -nr "/^\[joycon_02\]/ { :l /^ltk[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /flash/switchroot/joycon_mac.ini | tr -d "\\r\\n")
if [[ -z ${JOYCON_02_TYPE} ]]; then
JOYCON_02_TYPE="0"
fi
# 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"
elif [[ ${JOYCON_00_TYPE} == "3" ]]; then
BT_DEV_01_NAME="Pro Controller"
BT_DEV_01_ID=8201
BT_DEV_01_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920090902030900010902042801090205090002"
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"
elif [[ ${JOYCON_01_TYPE} == "3" ]]; then
BT_DEV_01_NAME="Pro Controller"
BT_DEV_01_ID=8201
BT_DEV_01_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920090902030900010902042801090205090002"
fi
if [[ ${JOYCON_02_TYPE} == "1" ]]; then
BT_DEV_02_NAME="Joy-Con (L)"
BT_DEV_02_ID=8198
BT_DEV_02_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920060902030900010902042801090205090002"
elif [[ ${JOYCON_02_TYPE} == "2" ]]; then
BT_DEV_02_NAME="Joy-Con (R)"
BT_DEV_02_ID=8199
BT_DEV_02_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920070902030900010902042801090205090002"
elif [[ ${JOYCON_02_TYPE} == "3" ]]; then
BT_DEV_02_NAME="Pro Controller"
BT_DEV_02_ID=8201
BT_DEV_02_SERVICE_RECORDS="0x00000000=356E0900000A000000000900013503191000090004350D350619010009000135031900010900053503191002090006350909656E09006A090100090009350835061901000901000901002510576972656C6573732047616D65706164090101250747616D657061640902003503090100
0x00010000=36017D0900000A000100000900013503191124090004350D350619010009001135031900110900053503191002090006350909656E09006A0901000900093508350619112409010109000D350F350D350619010009001335031900110901002510576972656C6573732047616D65706164090101250747616D6570616409010225084E696E74656E646F090201090111090202080809020308210902042801090205280109020635B035AE082225AA05010905A1010601FF8521092175089530810285300930750895308102853109317508966901810285320932750896690181028533093375089669018102853F05091901291015002501750195108102050109391500250775049501814205097504950181010501093009310933093416000027FFFF00007510950481020601FF85010901750895309102851009107508953091028511091175089530910285120912750895309102C009020735083506090409090100090209280109020A280109020C090C8009020D280009020E2800
0x00010001=358C0900000A000100010900013503191200090004350D35061901000900013503190001090006350909656E09006A09010009000935083506191200090100090100251B576972656C6573732047616D6570616420506E5020536572766572090101250747616D6570616409020009010309020109057E0902020920090902030900010902042801090205090002"
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} ]] || [[ ! $(grep -q ${JOYCON_00_LTK} /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_00_MAC}/info; echo $?) -eq 0 ]]; 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} ]] || [[ ! $(grep -q ${JOYCON_01_LTK} /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_01_MAC}/info; echo $?) -eq 0 ]]; 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
if [[ ! ${JOYCON_02_TYPE} == "0" ]]; then
if [[ ! -d /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_02_MAC} ]] || [[ ! $(grep -q ${JOYCON_02_LTK} /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_02_MAC}/info; echo $?) -eq 0 ]]; then
mkdir -p /var/bluetoothconfig/bluetooth/${BT_MAC_ADDR}/${JOYCON_02_MAC}
cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/${JOYCON_02_MAC}/info
[General]
Name=${BT_DEV_02_NAME}
Class=0x002508
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_02_LTK}
Type=4
PINLength=0
[DeviceID]
Source=2
Vendor=1406
Product=${BT_DEV_02_ID}
Version=1
[ConnectionParameters]
MinInterval=5
MaxInterval=15
Latency=120
Timeout=600
EOF
cat << EOF > /var/bluetoothconfig/${BT_MAC_ADDR}/cache/${JOYCON_02_MAC}
[General]
Name=${BT_DEV_02_NAME}
[ServiceRecords]
${BT_DEV_02_SERVICE_RECORDS}
EOF
fi
fi
fi