diff --git a/config/blocklist b/config/blocklist index 42ec7e4976..111aac9c77 100644 --- a/config/blocklist +++ b/config/blocklist @@ -9,6 +9,5 @@ ryujinx-sa #broken on JELOS after build 1.1740. melonds-sa #Broken OpenGL renderer upstream mupen64plus-sa-ui-console #Causes segfaults nanoboyadvance-sa #SDL version removed after this commit -freechaf-lr #build issue, revisit. -pcsx_rearmed-lr #pins version as new releases have artifacting issues. kronos-sa #using the release version of kronos had better results. +retroarch #pinning to release versions for stability. diff --git a/packages/apps/portmaster/scripts/start_portmaster.sh b/packages/apps/portmaster/scripts/start_portmaster.sh index 0717b0d7e6..2b9aa5f323 100644 --- a/packages/apps/portmaster/scripts/start_portmaster.sh +++ b/packages/apps/portmaster/scripts/start_portmaster.sh @@ -34,7 +34,7 @@ if [ ! -d "/storage/roms/ports/PortMaster" ]; then fi #We dont use tasksetter, delete it -if [ ! -f /storage/roms/ports/PortMaster/tasksetter ]; then +if [ -f /storage/roms/ports/PortMaster/tasksetter ]; then rm -r /storage/roms/ports/PortMaster/tasksetter fi @@ -65,6 +65,9 @@ else xmlstarlet ed --inplace --subnode "/gameList/folder[last()]" --type elem -n hidden -v "true" /storage/roms/ports/gamelist.xml fi +#Make sure permissions are correct in the PortMaster folder +chmod 755 /storage/roms/ports/PortMaster/* -R + #Start PortMaster @LIBEGL@ cd /storage/roms/ports/PortMaster diff --git a/packages/audio/pipewire/package.mk b/packages/audio/pipewire/package.mk index 0a25b82f26..e5f4c04213 100644 --- a/packages/audio/pipewire/package.mk +++ b/packages/audio/pipewire/package.mk @@ -17,6 +17,7 @@ if [ "${BLUETOOTH_SUPPORT}" = "yes" ]; then -Dbluez5-backend-ofono=disabled \ -Dbluez5-backend-hsphfpd=disabled \ -Dbluez5-codec-aptx=enabled \ + -Dbluez5-codec-lc3plus=disabled \ -Dbluez5-codec-ldac=enabled \ -Dbluez5-codec-aac=enabled" else @@ -83,6 +84,8 @@ pre_configure_target() { } post_install() { + add_user pipewire x 982 980 "pipewire-daemon" "/var/run/pipewire" "/bin/sh" + add_group pipewire 980 mkdir -p ${INSTALL}/etc/alsa/conf.d ln -sf /usr/share/alsa/alsa.conf.d/50-pipewire.conf ${INSTALL}/etc/alsa/conf.d/50-pipewire.conf ln -sf /usr/share/alsa/alsa.conf.d/99-pipewire-default.conf ${INSTALL}/etc/alsa/conf.d/99-pipewire-default.conf diff --git a/packages/emulators/libretro/freechaf-lr/package.mk b/packages/emulators/libretro/freechaf-lr/package.mk index 05ad297219..92fe360137 100644 --- a/packages/emulators/libretro/freechaf-lr/package.mk +++ b/packages/emulators/libretro/freechaf-lr/package.mk @@ -1,5 +1,5 @@ PKG_NAME="freechaf-lr" -PKG_VERSION="4d1d5cb83b93728a63f03454e472a23055d9bbfc" +PKG_VERSION="782739dd6988b0148f9c26ddc6ff414e76e54d7b" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPLv2" diff --git a/packages/emulators/libretro/pcsx_rearmed-lr/package.mk b/packages/emulators/libretro/pcsx_rearmed-lr/package.mk index 180b83dd94..9dba567e92 100644 --- a/packages/emulators/libretro/pcsx_rearmed-lr/package.mk +++ b/packages/emulators/libretro/pcsx_rearmed-lr/package.mk @@ -3,7 +3,7 @@ # Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) PKG_NAME="pcsx_rearmed-lr" -PKG_VERSION="e34ef5a" +PKG_VERSION="ff3890db8ef473ee5eae6a7120ee39d761a86620" PKG_ARCH="arm aarch64" PKG_LICENSE="GPLv2" PKG_SITE="https://github.com/libretro/pcsx_rearmed" diff --git a/packages/emulators/standalone/primehack/package.mk b/packages/emulators/standalone/primehack/package.mk index b4cbc6454a..e85a0a532b 100755 --- a/packages/emulators/standalone/primehack/package.mk +++ b/packages/emulators/standalone/primehack/package.mk @@ -7,6 +7,7 @@ PKG_DEPENDS_TARGET="toolchain libevdev libdrm ffmpeg zlib libpng lzo libusb zstd PKG_SITE="https://github.com/shiiion/dolphin" PKG_URL="${PKG_SITE}.git" PKG_VERSION="48dbd3a4a7249948d3e7e21b20842d493c3b00cb" +PKG_GIT_CLONE_BRANCH="master" PKG_LONGDESC="PrimeHack – A Dolphin Emulator fork for Metroid Prime Trilogy." PKG_PATCH_DIRS+=" wayland" diff --git a/packages/emulators/standalone/retroarch/package.mk b/packages/emulators/standalone/retroarch/package.mk index 457a47f9a5..cba7e61352 100644 --- a/packages/emulators/standalone/retroarch/package.mk +++ b/packages/emulators/standalone/retroarch/package.mk @@ -3,7 +3,7 @@ # Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) PKG_NAME="retroarch" -PKG_VERSION="f091b5a9e9475255e5efaded5f95c9750fdfe15e" +PKG_VERSION="6c2cc456284fcfa6fa5f94664950926c020d2f7b" # v1.16.0.3 PKG_SITE="https://github.com/libretro/RetroArch" PKG_URL="${PKG_SITE}.git" PKG_LICENSE="GPLv3" diff --git a/packages/emulators/standalone/rpcs3-sa/package.mk b/packages/emulators/standalone/rpcs3-sa/package.mk index 5cce92066b..f109d38c9a 100644 --- a/packages/emulators/standalone/rpcs3-sa/package.mk +++ b/packages/emulators/standalone/rpcs3-sa/package.mk @@ -3,7 +3,7 @@ # Copyright (C) 2022-present - The JELOS Project (https://github.com/JustEnoughLinuxOS) PKG_NAME="rpcs3-sa" -PKG_VERSION="ed75bab7b284a9cb62b7308097108e4caef9a0b3" +PKG_VERSION="7081b89e976ad7f931c926022bd93ddd9778347c" PKG_ARCH="x86_64" PKG_LICENSE="GPL-2.0-or-later" PKG_SITE="https://rpcs3.net" @@ -16,7 +16,9 @@ PKG_GIT_CLONE_BRANCH="master" PKG_GIT_CLONE_SINGLE="yes" pre_configure_host() { - PKG_CMAKE_SCRIPT="${PKG_BUILD}/3rdparty/llvm/llvm/llvm/CMakeLists.txt" + # path changes in future commits. + # PKG_CMAKE_SCRIPT="${PKG_BUILD}/3rdparty/llvm/llvm/llvm/CMakeLists.txt" + PKG_CMAKE_SCRIPT="${PKG_BUILD}/llvm/CMakeLists.txt" PKG_CMAKE_OPTS_HOST="-DLLVM_TARGETS_TO_BUILD="X86" \ -DLLVM_BUILD_RUNTIME=OFF \ -DLLVM_BUILD_TOOLS=OFF \ diff --git a/packages/graphics/mesa/package.mk b/packages/graphics/mesa/package.mk index 3c35618ec3..e87afd0f8d 100644 --- a/packages/graphics/mesa/package.mk +++ b/packages/graphics/mesa/package.mk @@ -22,7 +22,7 @@ case ${DEVICE} in PKG_URL="https://mesa.freedesktop.org/archive/mesa-${PKG_VERSION}.tar.xz" ;; *) - PKG_VERSION="23.2.1" + PKG_VERSION="23.3.0" PKG_SITE="http://www.mesa3d.org/" PKG_URL="https://mesa.freedesktop.org/archive/mesa-${PKG_VERSION}.tar.xz" ;; diff --git a/packages/graphics/mesa/patches/AMD64/000-fix-i686.patch b/packages/graphics/mesa/patches/AMD64/000-fix-i686.patch deleted file mode 100644 index 20e3d94940..0000000000 --- a/packages/graphics/mesa/patches/AMD64/000-fix-i686.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/src/gallium/drivers/crocus/crocus_bufmgr.c 2023-03-14 18:16:32.195276836 +0000 -+++ b/src/gallium/drivers/crocus/crocus_bufmgr.c 2023-03-14 18:17:32.920657663 +0000 -@@ -878,7 +878,7 @@ crocus_bo_map_cpu(struct util_debug_call - bo_wait_with_stall_warning(dbg, bo, "CPU mapping"); - } - -- if (!bo->cache_coherent && !bo->bufmgr->has_llc) { -+ //if (!bo->cache_coherent && !bo->bufmgr->has_llc) { - /* If we're reusing an existing CPU mapping, the CPU caches may - * contain stale data from the last time we read from that mapping. - * (With the BO cache, it might even be data from a previous buffer!) -@@ -895,8 +895,8 @@ crocus_bo_map_cpu(struct util_debug_call - * LLC entirely requiring us to keep dirty pixels for the scanout - * out of any cache.) - */ -- intel_invalidate_range(bo->map_cpu, bo->size); -- } -+ // intel_invalidate_range(bo->map_cpu, bo->size); -+ //} - - return bo->map_cpu; - } diff --git a/packages/hardware/quirks/devices/Anbernic RG351M/001-device_config b/packages/hardware/quirks/devices/Anbernic RG351M/001-device_config index b47379e97d..161fa2c340 100644 --- a/packages/hardware/quirks/devices/Anbernic RG351M/001-device_config +++ b/packages/hardware/quirks/devices/Anbernic RG351M/001-device_config @@ -13,5 +13,5 @@ DEVICE_VOLUME="100" DEVICE_BATTERY_LED_STATUS="true" DEVICE_PWR_LED_GPIO="77" DEVICE_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone0/temp" - +DEVICE_MMC_EJECT="false" EOF diff --git a/packages/hardware/quirks/devices/Anbernic RG552/010-governors b/packages/hardware/quirks/devices/Anbernic RG552/010-governors index e3d3da8ee0..2891874244 100755 --- a/packages/hardware/quirks/devices/Anbernic RG552/010-governors +++ b/packages/hardware/quirks/devices/Anbernic RG552/010-governors @@ -7,3 +7,8 @@ CPU_FREQ=("/sys/devices/system/cpu/cpufreq/policy0" "/sys/devices/system/cpu/cpu GPU_FREQ="/sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu" DMC_FREQ="/sys/devices/platform/memory-controller/devfreq/memory-controller/" EOF + +### Lock in lowest freq we want to use +echo 1008000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq +echo 1008000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq +echo 600000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/min_freq diff --git a/packages/hardware/quirks/devices/Anbernic RG552/sleep.d/post/002-freq b/packages/hardware/quirks/devices/Anbernic RG552/sleep.d/post/002-freq new file mode 100644 index 0000000000..7ba581fc1b --- /dev/null +++ b/packages/hardware/quirks/devices/Anbernic RG552/sleep.d/post/002-freq @@ -0,0 +1,32 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +### Restore previous governors before going to sleep + +. /etc/profile + +### Set max/min freq to lowest available value +echo 1008000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq +echo 1008000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq +echo 600000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/min_freq + +echo 1608000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq +echo 2088000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq +echo 900000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/max_freq + +### Grab the old governors. +OLD_CPU_FREQ=$(get_setting "sleep.cpugovernor") +if [ ! -n "${OLD_CPU_FREQ}" ]; then + OLD_CPU_FREQ="schedutil" +fi + +OLD_GPU_FREQ=$(get_setting "sleep.gpugovernor") +if [ ! -n "${OLD_GPU_FREQ}" ]; then + OLD_GPU_FREQ="simple_ondemand" +fi + +# Restore old governors. +set_cpu_gov "${OLD_CPU_FREQ}" +set_dmc_gov "${OLD_CPU_FREQ}" +set_gpu_gov "${OLD_GPU_FREQ}" diff --git a/packages/hardware/quirks/devices/Anbernic RG552/sleep.d/pre/002-freq b/packages/hardware/quirks/devices/Anbernic RG552/sleep.d/pre/002-freq new file mode 100644 index 0000000000..9e66aefa29 --- /dev/null +++ b/packages/hardware/quirks/devices/Anbernic RG552/sleep.d/pre/002-freq @@ -0,0 +1,28 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +# Store current freq governors and set governors to powersave. + +. /etc/profile + +### Get the current cpu and gpu governor, save for when the device wakes from sleep. +CUR_CPU_FREQ="$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor)" +CUR_GPU_FREQ="$(cat /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/governor)" + +set_setting sleep.cpugovernor "${CUR_CPU_FREQ}" +set_setting sleep.gpugovernor "${CUR_GPU_FREQ}" + +### Set all governors to powersave +set_cpu_gov powersave +set_dmc_gov powersave +set_gpu_gov powersave + +### Set max/min freq to lowest available value +echo 600000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq +echo 600000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq +echo 200000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/min_freq + +echo 600000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq +echo 600000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq +echo 200000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/max_freq diff --git a/packages/hardware/quirks/devices/ODROID-GO Advance Black Edition/001-device_config b/packages/hardware/quirks/devices/ODROID-GO Advance Black Edition/001-device_config index 7621a4d007..ca36d07df6 100644 --- a/packages/hardware/quirks/devices/ODROID-GO Advance Black Edition/001-device_config +++ b/packages/hardware/quirks/devices/ODROID-GO Advance Black Edition/001-device_config @@ -10,4 +10,5 @@ DEVICE_SW_HP_SWITCH="true" DEVICE_PLAYBACK_PATH_SPK="SPK" DEVICE_PLAYBACK_PATH_HP="HP" DEVICE_BRIGHTNESS="128" +DEVICE_MMC_EJECT="false" EOF diff --git a/packages/hardware/quirks/devices/ODROID-GO Advance/001-device_config b/packages/hardware/quirks/devices/ODROID-GO Advance/001-device_config index 9bd46c6579..b0a30ac3ca 100644 --- a/packages/hardware/quirks/devices/ODROID-GO Advance/001-device_config +++ b/packages/hardware/quirks/devices/ODROID-GO Advance/001-device_config @@ -14,5 +14,5 @@ DEVICE_VOLUME="100" DEVICE_BATTERY_LED_STATUS="true" DEVICE_PWR_LED_GPIO="77" DEVICE_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone0/temp" - +DEVICE_MMC_EJECT="false" EOF diff --git a/packages/hardware/quirks/devices/ODROID-GO Super/001-device_config b/packages/hardware/quirks/devices/ODROID-GO Super/001-device_config index 5f3794c280..cdf836298a 100644 --- a/packages/hardware/quirks/devices/ODROID-GO Super/001-device_config +++ b/packages/hardware/quirks/devices/ODROID-GO Super/001-device_config @@ -9,4 +9,5 @@ DEVICE_POWER_LED="false" DEVICE_PLAYBACK_PATH_SPK="SPK" DEVICE_PLAYBACK_PATH_HP="HP" DEVICE_BRIGHTNESS="128" +DEVICE_MMC_EJECT="false" EOF diff --git a/packages/hardware/quirks/platforms/RK3326/sleep.d/post/002-freq b/packages/hardware/quirks/platforms/RK3326/sleep.d/post/002-freq new file mode 100644 index 0000000000..d5c06cc41f --- /dev/null +++ b/packages/hardware/quirks/platforms/RK3326/sleep.d/post/002-freq @@ -0,0 +1,23 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +### Restore previous governors before going to sleep + +. /etc/profile + +### Grab the old governors. +OLD_CPU_FREQ=$(get_setting "sleep.cpugovernor") +if [ ! -n "${OLD_CPU_FREQ}" ]; then + OLD_CPU_FREQ="schedutil" +fi + +OLD_GPU_FREQ=$(get_setting "sleep.gpugovernor") +if [ ! -n "${OLD_GPU_FREQ}" ]; then + OLD_GPU_FREQ="simple_ondemand" +fi + +# Restore old governors. +set_cpu_gov "${OLD_CPU_FREQ}" +set_dmc_gov "${OLD_CPU_FREQ}" +set_gpu_gov "${OLD_GPU_FREQ}" diff --git a/packages/hardware/quirks/platforms/RK3326/sleep.d/pre/002-freq b/packages/hardware/quirks/platforms/RK3326/sleep.d/pre/002-freq new file mode 100644 index 0000000000..9fcc29bd94 --- /dev/null +++ b/packages/hardware/quirks/platforms/RK3326/sleep.d/pre/002-freq @@ -0,0 +1,19 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +# Store current freq governors and set governors to powersave. + +. /etc/profile + +### Get the current cpu and gpu governor, save for when the device wakes from sleep. +CUR_CPU_FREQ="$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor)" +CUR_GPU_FREQ="$(cat /sys/devices/platform/ff400000.gpu/devfreq/ff400000.gpu/governor)" + +set_setting sleep.cpugovernor "${CUR_CPU_FREQ}" +set_setting sleep.gpugovernor "${CUR_GPU_FREQ}" + +### Set all governors to powersave +set_cpu_gov powersave +set_dmc_gov powersave +set_gpu_gov powersave diff --git a/packages/hardware/quirks/profile.d/999-export b/packages/hardware/quirks/profile.d/999-export index 7cc4fc629f..95433c38e7 100755 --- a/packages/hardware/quirks/profile.d/999-export +++ b/packages/hardware/quirks/profile.d/999-export @@ -26,6 +26,7 @@ export SLOW_CORES \ DEVICE_KEY_VOLUMEUP \ DEVICE_LED_BRIGHTNESS \ DEVICE_LED_CONTROL \ + DEVICE_MMC_EJECT \ DEVICE_PIPEWIRE_PROFILE \ DEVICE_PWR_LED_CONTROL \ DEVICE_PWR_LED_GPIO \ diff --git a/packages/jelos/autostart/001-setup b/packages/jelos/autostart/001-setup index 470177f18a..72d369c5c2 100755 --- a/packages/jelos/autostart/001-setup +++ b/packages/jelos/autostart/001-setup @@ -25,42 +25,9 @@ fi ### to last known good state if corrupt. /usr/bin/chksysconfig verify +### Clean up settings +sort_settings + ### We do not want to mount the cloud drive on startup ### so we'll reset the mount option to 0. set_setting clouddrive.mounted 0 - -### Enable the desired number of threads. -tocon "Restoring cpu threads..." -NUMTHREADS=$(get_setting "system.threads") -if [ -n "${NUMTHREADS}" ] -then - onlinethreads ${NUMTHREADS} 0 -else - onlinethreads all 1 -fi - -### If we don't have a default governor set, set it -### to schedutil. -if [ -z "$(get_setting system.cpugovernor)" ] -then - set_setting system.cpugovernor schedutil -fi - -### Set the default GPU performance mode -GPUPERF=$(get_setting system.gpuperf) -if [ -n "${GPUPERF}" ] -then - gpu_performance_level ${GPUPERF} -fi - -### Configure suspend mode. -MYSLEEPMODE=$(get_setting system.suspendmode) -if [ -n "${MYSLEEPMODE}" ] -then - /usr/bin/suspendmode ${MYSLEEPMODE} -else - /usr/bin/suspendmode mem -fi - -### Clean up settings -sort_settings diff --git a/packages/jelos/autostart/008-perfmode b/packages/jelos/autostart/008-perfmode new file mode 100755 index 0000000000..71d6770be2 --- /dev/null +++ b/packages/jelos/autostart/008-perfmode @@ -0,0 +1,33 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +# Minimal OS variable loading for performance +. /etc/profile.d/001-functions +. /etc/profile.d/099-freqfunctions + +tocon "Setting performance mode..." + +### Enable the desired number of threads. +tocon "Restoring cpu threads..." +NUMTHREADS=$(get_setting "system.threads") +if [ -n "${NUMTHREADS}" ] +then + onlinethreads ${NUMTHREADS} 0 +else + onlinethreads all 1 +fi + +### If we don't have a default governor set, set it +### to schedutil but don't enable it. +if [ -z "$(get_setting system.cpugovernor)" ] +then + set_setting system.cpugovernor schedutil +fi + +### Set the default GPU performance mode +GPUPERF=$(get_setting system.gpuperf) +if [ -n "${GPUPERF}" ] +then + gpu_performance_level ${GPUPERF} +fi diff --git a/packages/jelos/autostart/009-sleepmode b/packages/jelos/autostart/009-sleepmode new file mode 100755 index 0000000000..74482f941c --- /dev/null +++ b/packages/jelos/autostart/009-sleepmode @@ -0,0 +1,17 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +# Minimal OS variable loading for performance +. /etc/profile.d/001-functions + +tocon "Configure suspend mode..." + +### Configure suspend mode. +MYSLEEPMODE=$(get_setting system.suspendmode) +if [ -n "${MYSLEEPMODE}" ] +then + /usr/bin/suspendmode ${MYSLEEPMODE} +else + /usr/bin/suspendmode mem +fi diff --git a/packages/jelos/sources/post-update b/packages/jelos/sources/post-update index 9cccee80f5..accafac504 100644 --- a/packages/jelos/sources/post-update +++ b/packages/jelos/sources/post-update @@ -73,6 +73,38 @@ sed -i 's~"pulse"~"alsathread"~g' /storage/.config/retroarch/retroarch.cfg ### 20231114 - Update hosts.conf grep "127.0.0.1" /storage/.config/hosts.conf >/dev/null 2>&1 || cp /usr/config/hosts.conf /storage/.config/ +### 20231127 - Migrate games to overlayfs +systemctl stop storage-roms.mount +GAMECOUNT=$(find /storage/roms -type f | wc -l) +if [ "${GAMECOUNT}" -gt 20 ] && \ + [ ! -e "/storage/.migrated_games" ] +then + echo "Migrating games to overlayfs" >>${LOG} + if [ -d "/storage/games-internal" ] + then + echo "Backing up games-internal" >>${LOG} + mv /storage/games-internal /storage/games-internal.backup + fi + mv /storage/roms /storage/games-internal + mkdir /storage/roms + touch /storage/.migrated_games +else + echo "Game weight too low (${GAMECOUNT}) or content already migrated." >>${LOG} +fi +systemctl start storage-roms.mount + +### 20231129 - Don't default to performance. +EPP=$(get_setting system.power.epp) +if [ -z "${EPP}" ] || \ + [ "${EPP}" = "performance" ] +then + EPP="balance_performance" + set_setting system.power.epp ${EPP} +fi + +### 20231130 - Replace smb.conf for new overlay mechanism. +cp -f /usr/config/smb.conf /storage/.config + ### Items below this line should not be removed. tocon "Update complete, rebooting..." reboot diff --git a/packages/jelos/sources/scripts/automount b/packages/jelos/sources/scripts/automount index ed9a646eeb..8f98374920 100755 --- a/packages/jelos/sources/scripts/automount +++ b/packages/jelos/sources/scripts/automount @@ -8,49 +8,95 @@ UPDATE_ROOT="/storage/.update" MOUNT_GAMES=$(get_setting system.automount) GAMES_DEVICE=$(get_setting system.gamesdevice) +MOUNT_PATH="/storage/games-external" +OVERLAY_PATH="/storage/roms" + +start_overlay() { + if [ -e "/storage/.overlay_unsupported" ] + then + # If we're not using the overlay, bind mount the external storage path + # so we don't need to change any configs. + grep ${MOUNT_PATH} /proc/mounts >/dev/null 2>&1 + if [ ! $? = 0 ] + then + MOUNT_PATH="/storage/games-internal" + fi + log $0 "Executing bind mount of ${MOUNT_PATH} to ${OVERLAY_PATH}" + mount --bind ${MOUNT_PATH} ${OVERLAY_PATH} + exit 0 + else + log $0 "Enabling overlay." + systemctl enable storage-roms.mount >/dev/null 2>&1 + systemctl start storage-roms.mount >/dev/null 2>&1 + fi +} if [[ ! "${MOUNT_GAMES}" =~ [0-9] ]] then set_setting system.automount 1 elif [[ "${MOUNT_GAMES}" == "0" ]] then + start_overlay exit 0 fi -load_modules() { +function load_modules() { for MODULE in exfat vfat do lsmod | grep ${MODULE} 2>/dev/null if [ ! $? = 0 ] then + log $0 "Loading ${MODULE}." modprobe ${MODULE} 2>/dev/null fi done } -mount_games() { +function mount_games() { + FSTYPE=$(blkid -o export ${1} | awk 'BEGIN {FS="="} /TYPE/ {print $2}') + case ${FSTYPE} in + ext4) + log $0 "Found supported partition for overlayfs." + if [ -e "/storage/.overlay_unsupported" ] + then + rm -f /storage/.overlay_unsupported + fi + touch /storage/.overlay_supported + set_setting system.merged.storage 1 + ;; + *) + log $0 "Partition does not support overlayfs, disabling." + if [ -e "/storage/.overlay_supported" ] + then + rm -f /storage/.overlay_supported + fi + touch /storage/.overlay_unsupported + ;; + esac + + if [ ! -d "${MOUNT_PATH}" ] + then + log $0 "Create directory ${MOUNT_PATH}" + /usr/bin/busybox mkdir -p ${MOUNT_PATH} >/dev/null 2>&1 + fi + NULL=$(cat /proc/mounts | grep -v -e "/var/media" 2>/dev/null | grep ${1}) if [ ! "$?" = "0" ] && \ [ -e "${1}" ] && \ [ ! -e "/storage/.please_resize_me" ] then ### Udevil shouldn't mount it this early, but just in-case. - umount /var/media/* - log $0 "FSCK ${1}" - fsck -Mly ${1} - log $0 "Mounting ${1} on /storage/roms" - /usr/bin/busybox mount ${1} /storage/roms >/dev/null 2>&1 - /usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/JELOS-system-dirs.conf >/dev/null 2>&1 + umount /var/media/* 2>/dev/null + log $0 "Checking filesystem ${1}." + fsck -Mly ${1} >/dev/null 2>&1 + log $0 "Mounting ${1} on ${MOUNT_PATH}" + /usr/bin/busybox mount ${1} ${MOUNT_PATH} >/dev/null 2>&1 fi + start_overlay } find_games() { if /usr/bin/busybox mountpoint -q /storage ; then - if [ ! -d "/storage/roms" ] - then - /usr/bin/busybox mkdir -p /storage/roms >/dev/null 2>&1 - fi - for DEV in $(for dev in mmcblk[0-9] sd[a-z] nvme[0-9]; do blkid | grep ${dev} | awk 'BEGIN {FS=":"}; /ext4/ || /fat/ {print $1}' | sort -r; done) do ROOTDEV=$(echo ${DEV} | sed -e "s#^/.*/##g" -e "s#p[0-9].*\$##g") @@ -74,10 +120,13 @@ find_games() { [ ! -e "/storage/.please_resize_me" ] then GAMES_DEVICE=${DEV} + log $0 "Found ${DEV} available to mount." mount_games "${DEV}" break fi done + # If we're here there is no external storage to use, but we want to start the overlay anyway. + start_overlay fi } diff --git a/packages/jelos/sources/scripts/benchmark b/packages/jelos/sources/scripts/benchmark new file mode 100755 index 0000000000..0e42bed05d --- /dev/null +++ b/packages/jelos/sources/scripts/benchmark @@ -0,0 +1,112 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +. /etc/profile + +if [ ! "${HW_ARCH}" = "x86_64" ] +then + echo "This platform is not currently supported." + exit 1 +fi + +HOSTNAME=$(hostname) + +if [ -z "${1}" ] +then + BENCHLOG="${1}" +else + BENCHLOG="benchmark.log" +fi + +LOG="${HOME}/${BENCHLOG}.log" + +SYSTEM_TDP=$(get_setting system.overclock) +SYSTEM_GOV=$(get_setting system.cpugovernor) +SYSTEM_EPP=$(get_setting system.power.epp) +SYSTEM_GPU=$(get_setting system.gpuperf) +SYSTEM_THREADS=$(get_setting system.threads) +SYSTEM_POWERSAVE=$(get_setting system.powersave) +SYSTEM_COOLING=$(get_setting cooling.profile) + +case ${1} in + performance) + onlinethreads all + performance + gpu_performance_level profile_peak + cpu_perftune performance + set_setting system.powersave 0 + systemctl restart powerstate + set_setting cooling.profile auto + systemctl restart fancontrol + ;; + balanced_performance) + onlinethreads all + schedutil + gpu_performance_level auto + cpu_perftune balance_performance + set_setting system.powersave 0 + systemctl restart powerstate + set_setting cooling.profile auto + systemctl restart fancontrol + ;; + balanced_powersave) + onlinethreads 4 + powersave + gpu_performance_level low + cpu_perftune balance_power + set_setting system.powersave 1 + systemctl restart powerstate + set_setting cooling.profile quiet + systemctl restart fancontrol + ;; + powersave) + onlinethreads 4 + powersave + gpu_performance_level low + cpu_perftune power + set_setting system.powersave 1 + systemctl restart powerstate + set_setting cooling.profile quiet + systemctl restart fancontrol + ;; + *) + # Default Settings + onlinethreads all + schedutil + gpu_performance_level auto + cpu_perftune balance_performance + set_setting system.powersave 0 + systemctl restart powerstate + set_setting cooling.profile auto + systemctl restart fancontrol + ;; +esac + +if [ -e "${LOG}" ] +then + rm -f ${LOG} +fi + +echo "${HOSTNAME} - ${1}" + +for TDP in 4.5w 6w 9w 15w 18w 24w 28w +do + overclock ${TDP} >/dev/null 2>&1 + echo "Testing @ ${TDP}" 2>&1 | tee -a ${LOG} + echo "----" 2>&1 | tee -a ${LOG} + glmark2-es2-wayland --fullscreen --annotate 2>&1 | awk '/glmark2 Score:/ {print "GLMark: "$3}' | tee -a ${LOG} + cd /usr/bin + ./7z b 2>&1 | awk '/^Tot:/ {print "7z: "$4}' | tee -a ${LOG} + echo "----" 2>&1 | tee -a ${LOG} +done + +overclock ${SYSTEM_TDP} +onlinethreads ${SYSTEM_THREADS} +${SYSTEM_GOV} +gpu_performance_level ${SYSTEM_GPU} +cpu_perftune ${SYSTEM_EPP} +set_setting system.powersave ${SYSTEM_POWERSAVE} +systemctl restart powerstate +set_setting cooling.profile ${SYSTEM_COOLING} +systemctl restart fancontrol diff --git a/packages/jelos/sources/scripts/rom_system_split b/packages/jelos/sources/scripts/rom_system_split deleted file mode 100755 index a52869337a..0000000000 --- a/packages/jelos/sources/scripts/rom_system_split +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -# rom_system_split: split your roms across your local and external storage - -# prerequesites: -# - local roms must be stored in "/storage/roms_local" -# - external roms must be stored in "/storage/roms" -# - you cannot spread the same system files across multiple locations -# NOTE: if duplicate systems are found, local folders will take preference - -LOCAL_FOLDER_NAME="roms_local" -EXT_FOLDER_NAME="roms" - -LOCAL_ROM_FOLDERS=$( - ls -d ${LOCAL_FOLDER_NAME}/*/ | - sed -e "s/${LOCAL_FOLDER_NAME}//g" -) -EXT_ROM_FOLDERS=$( - ls -d ${EXT_FOLDER_NAME}/*/ | - sed -e "s/${EXT_FOLDER_NAME}//g" -) - -ES_SYSTEMS="/storage/.emulationstation/es_systems.cfg" - -ES_LIST=$( - cat ${ES_SYSTEMS} | - grep "" | - sed -e "s///g" -e "s/<\/path>//g" -e "s/\/storage\///g" -) - - -echo "LOCAL_FOLDER_NAME: ${LOCAL_FOLDER_NAME}" -echo "EXT_FOLDER_NAME: ${EXT_FOLDER_NAME}" -echo "EXT_STORAGE: ${EXT_STORAGE}" -echo "EXTERNAL: ${EXTERNAL}" -echo "LOCAL_ROM_FOLDERS: $LOCAL_ROM_FOLDERS{}" -echo "EXT_ROM_FOLDERS: ${EXT_ROM_FOLDERS}" -echo "ES_SYSTEMS: ${ES_SYSTEMS}" -echo "ES_LIST: ${ES_LIST}" - - -# required paramaters: local/external, rom folder list, es folder list -update_es_folders() { - folder_name=${LOCAL_FOLDER_NAME} - orig_folder_name=${EXT_FOLDER_NAME} - if [[ $1 == "external" ]] - then - folder_name=${EXT_FOLDER_NAME} - orig_folder_name=${LOCAL_FOLDER_NAME} - fi - folder_array=( $2 ) - for folder in ${folder_array[@]} - do - system=${folder%?} - # check that the system exists in ES - if [[ $3 == *"${system}"* ]] - then - # skip if there are no files in the folder - if [ -z "$(ls -A /storage/${folder_name}${system})" ] - then - continue - fi - # if the folder doesn't exist in ES, update the original - if [[ $3 != *"${folder_name}${system}"* ]] - then - sed -i -e "s|/storage/${orig_folder_name}${system}|/storage/${folder_name}${system}|g" ${ES_SYSTEMS} - fi - fi - done -} - -# check the external folders first -update_es_folders "external" "${EXT_ROM_FOLDERS}" "${ES_LIST}" -# next check the local folders -# if there are duplicate folders in EXTERNAL, LOCAL ones will take preference -update_es_folders "local" "${LOCAL_ROM_FOLDERS}" "${ES_LIST}" diff --git a/packages/jelos/sources/scripts/setsettings.sh b/packages/jelos/sources/scripts/setsettings.sh index 712cf279a4..05b9e9319f 100755 --- a/packages/jelos/sources/scripts/setsettings.sh +++ b/packages/jelos/sources/scripts/setsettings.sh @@ -52,6 +52,9 @@ declare -a HAS_CHEEVOS=( arcade atari7800 atarilynx colecovision + cps1 + cps2 + cps3 dreamcast famicom fbn @@ -921,10 +924,14 @@ function set_gambatte() { sed -i "/gambatte_gb_colorization =/d" ${GAMBATTECONF} sed -i "/gambatte_gb_internal_palette =/d" ${GAMBATTECONF} fi - local RENDERER=$(game_setting renderer.colorization) - if [ -n "${RENDERER}" ] + local COLORIZATION=$(game_setting renderer.colorization) + local TWB1_COLORIZATION=$(game_setting renderer.twb1_colorization) + local TWB2_COLORIZATION=$(game_setting renderer.twb2_colorization) + local PIXELSHIFT1_COLORIZATION=$(game_setting renderer.pixelshift1_colorization) + + if [ -n "${COLORIZATION}" ] then - case ${RENDERER} in + case ${COLORIZATION} in 0|false|none) echo 'gambatte_gb_colorization = "disabled"' >> ${GAMBATTECONF} ;; @@ -932,11 +939,14 @@ function set_gambatte() { echo 'gambatte_gb_colorization = "auto"' >> ${GAMBATTECONF} ;; GBC|SGB) - echo 'gambatte_gb_colorization = "'${RENDERER}'"' >> ${GAMBATTECONF} + echo 'gambatte_gb_colorization = "'${COLORIZATION}'"' >> ${GAMBATTECONF} ;; *) echo 'gambatte_gb_colorization = "internal"' >> ${GAMBATTECONF} - echo 'gambatte_gb_internal_palette = "'${RENDERER}'"' >> ${GAMBATTECONF} + echo 'gambatte_gb_internal_palette = "'${COLORIZATION}'"' >> ${GAMBATTECONF} + echo 'gambatte_gb_palette_twb64_1 = "'${TWB1_COLORIZATION}'"' >> ${GAMBATTECONF} + echo 'gambatte_gb_palette_twb64_2 = "'${TWB2_COLORIZATION}'"' >> ${GAMBATTECONF} + echo 'gambatte_gb_palette_pixelshift_1 = "'${PIXELSHIFT1_COLORIZATION}'"' >> ${GAMBATTECONF} ;; esac fi diff --git a/packages/kernel/linux-firmware/kernel-firmware/firmwares/any.dat b/packages/kernel/linux-firmware/kernel-firmware/firmwares/any.dat index 22ab7452e0..8ad5768aab 100644 --- a/packages/kernel/linux-firmware/kernel-firmware/firmwares/any.dat +++ b/packages/kernel/linux-firmware/kernel-firmware/firmwares/any.dat @@ -20,4 +20,4 @@ ath9k_htc/* brcm/* rtl_bt/* rtlwifi/* -rtw89/* +rtw*/* diff --git a/packages/kernel/linux/package.mk b/packages/kernel/linux/package.mk index f4b65c6cdd..32a8fc0ccc 100644 --- a/packages/kernel/linux/package.mk +++ b/packages/kernel/linux/package.mk @@ -4,7 +4,7 @@ PKG_NAME="linux" PKG_LICENSE="GPL" -PKG_VERSION="6.6.2" +PKG_VERSION="6.6.3" PKG_URL="https://www.kernel.org/pub/linux/kernel/v6.x/${PKG_NAME}-${PKG_VERSION}.tar.xz" PKG_SITE="http://www.kernel.org" PKG_DEPENDS_HOST="ccache:host rsync:host openssl:host" diff --git a/packages/kernel/linux/patches/AMD64/002-LegionGO-rotation-quirk.patch b/packages/kernel/linux/patches/AMD64/002-LegionGO-rotation-quirk.patch new file mode 100644 index 0000000000..f4b8423eb7 --- /dev/null +++ b/packages/kernel/linux/patches/AMD64/002-LegionGO-rotation-quirk.patch @@ -0,0 +1,17 @@ +diff -rupN linux.orig/drivers/gpu/drm/drm_panel_orientation_quirks.c linux/drivers/gpu/drm/drm_panel_orientation_quirks.c +--- linux.orig/drivers/gpu/drm/drm_panel_orientation_quirks.c 2023-11-28 17:20:18.000000000 +0000 ++++ linux/drivers/gpu/drm/drm_panel_orientation_quirks.c 2023-11-30 15:33:54.949480402 +0000 +@@ -336,6 +336,13 @@ static const struct dmi_system_id orient + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "IdeaPad Duet 3 10IGL5"), + }, + .driver_data = (void *)&lcd1200x1920_rightside_up, ++ }, { /* Lenovo Legion Go */ ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "83E1"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Legion Go 8APU1"), ++ }, ++ .driver_data = (void *)&lcd1600x2560_leftside_up, + }, { /* Lenovo Yoga Book X90F / X90L */ + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), diff --git a/packages/kernel/linux/patches/AMD64/010-optimize-harder-O3.patch b/packages/kernel/linux/patches/AMD64/010-optimize-harder-O3.patch new file mode 100644 index 0000000000..7fdce27f75 --- /dev/null +++ b/packages/kernel/linux/patches/AMD64/010-optimize-harder-O3.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile b/Makefile +--- a/Makefile ++++ b/Makefile +@@ -442,7 +442,7 @@ endif + HOSTPKG_CONFIG = pkg-config + + KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \ +- -O2 -fomit-frame-pointer -std=gnu11 ++ -O3 -fomit-frame-pointer -std=gnu11 + KBUILD_USERCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS) + KBUILD_USERLDFLAGS := $(USERLDFLAGS) + +@@ -474,7 +474,7 @@ endif + -Wclippy::dbg_macro + + KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS) +-KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) ++KBUILD_HOSTCXXFLAGS := -Wall -O3 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) + KBUILD_HOSTRUSTFLAGS := $(rust_common_flags) -O -Cstrip=debuginfo \ + -Zallow-features= $(HOSTRUSTFLAGS) + KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) +@@ -757,7 +757,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) + KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) + + ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE +-KBUILD_CFLAGS += -O2 ++KBUILD_CFLAGS += -O3 + KBUILD_RUSTFLAGS += -Copt-level=2 + else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE + KBUILD_CFLAGS += -Os +diff --git a/init/Kconfig b/init/Kconfig +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -1401,10 +1401,10 @@ choice + default CC_OPTIMIZE_FOR_PERFORMANCE + + config CC_OPTIMIZE_FOR_PERFORMANCE +- bool "Optimize for performance (-O2)" ++ bool "Optimize for performance (-O3)" + help + This is the default optimization level for the kernel, building +- with the "-O2" compiler flag for best performance and most ++ with the "-O3" compiler flag for best performance and most + helpful compile-time warnings. + + config CC_OPTIMIZE_FOR_SIZE diff --git a/packages/network/bluez/modprobe.d/bluetooth.conf b/packages/network/bluez/modprobe.d/bluetooth.conf new file mode 100644 index 0000000000..d99d1dc913 --- /dev/null +++ b/packages/network/bluez/modprobe.d/bluetooth.conf @@ -0,0 +1 @@ +options btusb reset=1 diff --git a/packages/network/bluez/package.mk b/packages/network/bluez/package.mk index 9ace7412b8..90d1a22b16 100644 --- a/packages/network/bluez/package.mk +++ b/packages/network/bluez/package.mk @@ -3,11 +3,11 @@ # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) PKG_NAME="bluez" -PKG_VERSION="5.68" +PKG_VERSION="5.70" PKG_LICENSE="GPL" PKG_SITE="http://www.bluez.org/" PKG_URL="https://www.kernel.org/pub/linux/bluetooth/${PKG_NAME}-${PKG_VERSION}.tar.xz" -PKG_DEPENDS_TARGET="toolchain dbus glib readline systemd" +PKG_DEPENDS_TARGET="toolchain dbus glib readline systemd json-c alsa-lib" PKG_LONGDESC="Bluetooth Tools and System Daemons for Linux." PKG_TOOLCHAIN="autotools" PKG_BUILD_FLAGS="+lto" @@ -37,6 +37,11 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-dependency-tracking \ --enable-sap \ --enable-a2dp \ --enable-avrcp \ + --enable-btpclient \ + --enable-midi \ + --enable-mesh \ + --enable-hid2hci \ + --enable-experimental \ --enable-hid \ --with-gnu-ld \ ${BLUEZ_CONFIG} \ @@ -60,6 +65,9 @@ post_makeinstall_target() { safe_remove ${INSTALL}/usr/bin/ciptool safe_remove ${INSTALL}/usr/share/dbus-1 + mkdir -p ${INSTALL}/etc/dbus-1/system.d + cp src/bluetooth.conf ${INSTALL}/etc/dbus-1/system.d + mkdir -p ${INSTALL}/etc/bluetooth cp src/main.conf ${INSTALL}/etc/bluetooth diff --git a/packages/network/bluez/patches/bluez-04-valve-bluetooth-config.patch b/packages/network/bluez/patches/bluez-04-valve-bluetooth-config.patch new file mode 100644 index 0000000000..ba22408ca8 --- /dev/null +++ b/packages/network/bluez/patches/bluez-04-valve-bluetooth-config.patch @@ -0,0 +1,24 @@ +diff --git a/src/main.conf b/src/main.conf +index 2796f155e..f7b032b9f 100644 +--- a/src/main.conf ++++ b/src/main.conf +@@ -60,7 +60,7 @@ + # or both Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple + # Devices (MPMD) configurations. + # Possible values: "off", "single", "multiple" +-#MultiProfile = off ++MultiProfile = multiple + + # Permanently enables the Fast Connectable setting for adapters that + # support it. When enabled other devices can connect faster to us, +@@ -182,8 +182,8 @@ + + # LE scanning parameters used for passive scanning supporting wake from suspend + # scenarios +-#ScanIntervalSuspend= +-#ScanWindowSuspend= ++ScanIntervalSuspend=2240 ++ScanWindowSuspend=224 + + # LE scanning parameters used for active scanning supporting discovery + # proceedure diff --git a/packages/network/bluez/patches/bluez-045-main-conf.patch b/packages/network/bluez/patches/bluez-045-main-conf.patch deleted file mode 100644 index 50ed8fd350..0000000000 --- a/packages/network/bluez/patches/bluez-045-main-conf.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/src/main.conf b/src/main.conf -index d108934a8..f90820314 100644 ---- a/src/main.conf -+++ b/src/main.conf -@@ -60,7 +60,7 @@ - # or both Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple - # Devices (MPMD) configurations. - # Possible values: "off", "single", "multiple" --#MultiProfile = off -+MultiProfile = multiple - - # Permanently enables the Fast Connectable setting for adapters that - # support it. When enabled other devices can connect faster to us, -@@ -100,7 +100,7 @@ - # Specify the policy to the JUST-WORKS repairing initiated by peer - # Possible values: "never", "confirm", "always" - # Defaults to "never" --#JustWorksRepairing = never -+JustWorksRepairing = always - - # How long to keep temporary devices around - # The value is in seconds. Default is 30. -@@ -109,7 +109,7 @@ - - # Enables the device to issue an SDP request to update known services when - # profile is connected. Defaults to true. --#RefreshDiscovery = true -+RefreshDiscovery = true - - # Default Secure Connections setting. - # Enables the Secure Connections setting for adapters that support it. It -@@ -318,7 +318,7 @@ - # AutoEnable defines option to enable all controllers when they are found. - # This includes adapters present on start as well as adapters that are plugged - # in later on. Defaults to 'true'. --#AutoEnable=true -+AutoEnable=true - - # Audio devices that were disconnected due to suspend will be reconnected on - # resume. ResumeDelay determines the delay between when the controller diff --git a/packages/network/bluez/patches/bluez-04_work-around-Logitech-diNovo-Edge-keyboard-firmware-i.patch b/packages/network/bluez/patches/bluez-04_work-around-Logitech-diNovo-Edge-keyboard-firmware-i.patch deleted file mode 100644 index e583320ecc..0000000000 --- a/packages/network/bluez/patches/bluez-04_work-around-Logitech-diNovo-Edge-keyboard-firmware-i.patch +++ /dev/null @@ -1,29 +0,0 @@ -From aa73bf5039dfd2cf0a52dd6fd22501d955cc1a00 Mon Sep 17 00:00:00 2001 -From: Tommy -Date: Thu, 10 Jan 2013 09:18:43 +0100 -Subject: [PATCH] work around Logitech diNovo Edge keyboard firmware issue - -https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/269851 ---- - tools/hid2hci.rules | 5 ++++- - 1 files changed, 4 insertions(+), 1 deletions(-) - -diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules -index db6bb03..7db4572 100644 ---- a/tools/hid2hci.rules -+++ b/tools/hid2hci.rules -@@ -11,7 +11,10 @@ ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProt - RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" - - # Logitech devices --KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ -+KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[3bc]", \ -+ RUN+="hid2hci --method=logitech-hid --devpath=%p" -+# Logitech, Inc. diNovo Edge Keyboard -+KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c714", \ - RUN+="hid2hci --method=logitech-hid --devpath=%p" - - ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" --- -1.8.0.1 - diff --git a/packages/network/bluez/patches/bluez-05-046d-c52b-Logitech-Inc.-Unifying-Receiver.patch b/packages/network/bluez/patches/bluez-05-046d-c52b-Logitech-Inc.-Unifying-Receiver.patch deleted file mode 100644 index f9f827fe56..0000000000 --- a/packages/network/bluez/patches/bluez-05-046d-c52b-Logitech-Inc.-Unifying-Receiver.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 50f34d1b65c2fb6c557e2b802e908986e8ec0b74 Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Fri, 7 Feb 2014 12:50:29 +0200 -Subject: [PATCH] 046d:c52b Logitech, Inc. Unifying Receiver - ---- - tools/hid2hci.rules | 3 +++ - 1 files changed, 3 insertions(+), 0 deletions(-) - -diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules -index 7db4572..1feca6e 100644 ---- a/tools/hid2hci.rules -+++ b/tools/hid2hci.rules -@@ -16,6 +16,9 @@ KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[ - # Logitech, Inc. diNovo Edge Keyboard - KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c714", \ - RUN+="hid2hci --method=logitech-hid --devpath=%p" -+# Logitech, Inc. Unifying Receiver -+KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", \ -+ RUN+="hid2hci --method=logitech-hid --devpath=%p" - - ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" - --- -1.7.2.5 - diff --git a/packages/network/bluez/patches/bluez-05-valve-bluetooth-phy.patch b/packages/network/bluez/patches/bluez-05-valve-bluetooth-phy.patch new file mode 100644 index 0000000000..d9552a9f19 --- /dev/null +++ b/packages/network/bluez/patches/bluez-05-valve-bluetooth-phy.patch @@ -0,0 +1,246 @@ +From d1ef0be0d84b909a88dccf28af52d5a1c0e49992 Mon Sep 17 00:00:00 2001 +From: Vicki Pfau +Date: Fri, 8 Sep 2023 16:53:02 -0700 +Subject: [PATCH 2/2] Experimental patch to enable alternate Bluetooth + connection modes + +This should improve Bluetooth connectivity, especially with multiple controllers and while docked. + +Testing: +sudo btmgmt +[mgmt]# phy +Verify that LE2MRX, LE2MTX, LECODEDRX, LECODEDTX are in the selected phys list. +Verify that multiple controllers can connect and work well. + +Co-Authored-By: Rachel Blackman +--- + src/adapter.c | 46 ++++++++++++++++++++++++++++ + src/btd.h | 2 ++ + src/main.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ + src/main.conf | 5 +++ + 4 files changed, 138 insertions(+) + +diff --git a/src/adapter.c b/src/adapter.c +index 5ebfc4752..bc1e1d418 100644 +--- a/src/adapter.c ++++ b/src/adapter.c +@@ -86,6 +86,18 @@ + #define DISTANCE_VAL_INVALID 0x7FFF + #define PATHLOSS_MAX 137 + ++#define LE_PHY_1M 0x01 ++#define LE_PHY_2M 0x02 ++#define LE_PHY_CODED 0x04 ++ ++#define PHYVAL_REQUIRED 0x07ff ++#define PHYVAL_1M_TX (1<<9) ++#define PHYVAL_1M_RX (1<<10) ++#define PHYVAL_2M_TX (1<<11) ++#define PHYVAL_2M_RX (1<<12) ++#define PHYVAL_CODED_TX (1<<13) ++#define PHYVAL_CODED_RX (1<<14) ++ + /* + * These are known security keys that have been compromised. + * If this grows or there are needs to be platform specific, it is +@@ -844,6 +856,36 @@ static bool set_discoverable(struct btd_adapter *adapter, uint8_t mode, + return false; + } + ++static void set_phy_support_complete(uint8_t status, uint16_t length, ++ const void *param, void *user_data) ++{ ++ if (status != 0) { ++ struct btd_adapter *adapter = (struct btd_adapter *)user_data; ++ ++ btd_error(adapter->dev_id, "PHY setting rejected for %u: %s", ++ adapter->dev_id, mgmt_errstr(status)); ++ } ++} ++ ++static bool set_phy_support(struct btd_adapter *adapter, uint32_t phy_mask) ++{ ++ struct mgmt_cp_set_phy_confguration cp; ++ ++ memset(&cp, 0, sizeof(cp)); ++ cp.selected_phys = cpu_to_le32(phy_mask | PHYVAL_REQUIRED); ++ ++ if (mgmt_send(adapter->mgmt, MGMT_OP_SET_PHY_CONFIGURATION, ++ adapter->dev_id, sizeof(cp), &cp, ++ set_phy_support_complete, (void*)adapter, NULL) > 0) ++ return true; ++ ++ btd_error(adapter->dev_id, "Failed to set PHY for index %u", ++ adapter->dev_id); ++ ++ return false; ++ ++} ++ + static bool pairable_timeout_handler(gpointer user_data) + { + struct btd_adapter *adapter = user_data; +@@ -10387,6 +10429,10 @@ static void read_info_complete(uint8_t status, uint16_t length, + if (btd_adapter_get_powered(adapter)) + adapter_start(adapter); + ++ // Some adapters do not want to accept this before being started/powered. ++ if (btd_opts.phys > 0) ++ set_phy_support(adapter, btd_opts.phys); ++ + return; + + failed: +diff --git a/src/btd.h b/src/btd.h +index b7e7ebd61..2b84f7a51 100644 +--- a/src/btd.h ++++ b/src/btd.h +@@ -151,6 +151,8 @@ struct btd_opts { + struct btd_advmon_opts advmon; + + struct btd_csis csis; ++ ++ uint32_t phys; + }; + + extern struct btd_opts btd_opts; +diff --git a/src/main.c b/src/main.c +index 2134fcf75..700c83c78 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -127,6 +127,7 @@ static const char *le_options[] = { + "AdvMonAllowlistScanDuration", + "AdvMonNoFilterScanDuration", + "EnableAdvMonInterleaveScan", ++ "SupportedPHYs", + NULL + }; + +@@ -180,10 +181,32 @@ static const struct group_table { + { } + }; + ++static const char *conf_phys_str[] = { ++ "BR1M1SLOT", ++ "BR1M3SLOT", ++ "BR1M5SLOT", ++ "EDR2M1SLOT", ++ "EDR2M3SLOT", ++ "EDR2M5SLOT", ++ "EDR3M1SLOT", ++ "EDR3M3SLOT", ++ "EDR3M5SLOT", ++ "LE1MTX", ++ "LE1MRX", ++ "LE2MTX", ++ "LE2MRX", ++ "LECODEDTX", ++ "LECODEDRX", ++}; ++ + #ifndef MIN + #define MIN(x, y) ((x) < (y) ? (x) : (y)) + #endif + ++#ifndef NELEM ++#define NELEM(x) (sizeof(x) / sizeof((x)[0])) ++#endif ++ + static int8_t check_sirk_alpha_numeric(char *str) + { + int8_t val = 0; +@@ -224,6 +247,54 @@ static size_t hex2bin(const char *hexstr, uint8_t *buf, size_t buflen) + return len; + } + ++static const char *conf_phys2str(uint32_t phys) ++{ ++ static char str[256]; ++ unsigned int i; ++ int off; ++ ++ off = 0; ++ str[0] = '\0'; ++ ++ for (i = 0; i < NELEM(conf_phys_str); i++) { ++ if ((phys & (1 << i)) != 0) ++ off += snprintf(str + off, sizeof(str) - off, "%s ", ++ conf_phys_str[i]); ++ } ++ ++ return str; ++} ++ ++static bool str2phy(const char *phy_str, uint32_t *phy_val) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < NELEM(conf_phys_str); i++) { ++ if (strcasecmp(conf_phys_str[i], phy_str) == 0) { ++ *phy_val = (1 << i); ++ return true; ++ } ++ } ++ ++ return false; ++} ++ ++static void btd_parse_phy_list(char **list) ++{ ++ uint32_t phys = 0; ++ ++ for (int i = 0; list[i]; i++) { ++ uint32_t phy_val; ++ ++ info("Enabling PHY option: %s", list[i]); ++ ++ if (str2phy(list[i], &phy_val)) ++ phys |= phy_val; ++ } ++ ++ btd_opts.phys = phys; ++} ++ + GKeyFile *btd_get_main_conf(void) + { + return main_conf; +@@ -674,6 +745,20 @@ static void parse_le_config(GKeyFile *config) + return; + + parse_mode_config(config, "LE", params, ARRAY_SIZE(params)); ++ ++ char **strlist; ++ GError *err = NULL; ++ strlist = g_key_file_get_string_list(config, "LE", ++ "SupportedPHYs", ++ NULL, &err); ++ if (err) { ++ DBG("%s", err->message); ++ g_clear_error(&err); ++ } ++ else { ++ btd_parse_phy_list(strlist); ++ g_strfreev(strlist); ++ } + } + + static bool match_experimental(const void *data, const void *match_data) +diff --git a/src/main.conf b/src/main.conf +index cb9b241df..c086a17d0 100644 +--- a/src/main.conf ++++ b/src/main.conf +@@ -231,6 +231,11 @@ MultiProfile = multiple + # Defaults to 1 + #EnableAdvMonInterleaveScan= + ++# Which Bluetooth LE PHYs should be enabled/supported? ++# Options are LE1MTX LE1MRX LE2MTX LE2MRX LECODEDTX LECODEDRX ++# Defaults to LE1MTX,LE1MRX ++SupportedPHYs=LE1MTX,LE1MRX,LE2MTX,LE2MRX,LECODEDTX,LECODEDRX ++ + [GATT] + # GATT attribute cache. + # Possible values: +-- +2.41.0 + diff --git a/packages/network/bluez/patches/bluez-06-AVRCP_TG_MDI_BV-04-C.patch b/packages/network/bluez/patches/bluez-06-AVRCP_TG_MDI_BV-04-C.patch new file mode 100644 index 0000000000..38478f0539 --- /dev/null +++ b/packages/network/bluez/patches/bluez-06-AVRCP_TG_MDI_BV-04-C.patch @@ -0,0 +1,15 @@ +diff -ru bluez-5.66.orig/profiles/audio/avrcp.c bluez-5.66/profiles/audio/avrcp.c +--- bluez-5.66.orig/profiles/audio/avrcp.c 2022-03-16 08:06:20.000000000 -0700 ++++ bluez-5.66/profiles/audio/avrcp.c 2023-07-30 08:03:17.414213611 -0700 +@@ -1210,6 +1210,10 @@ + GUINT_TO_POINTER(str_to_metadata(key))); + } + ++ if (attrs == NULL) ++ return g_list_prepend(NULL, ++ GUINT_TO_POINTER(AVRCP_MEDIA_ATTRIBUTE_TITLE)); ++ + return attrs; + } + +Only in bluez-5.66/profiles/audio: avrcp.c.orig diff --git a/packages/network/bluez/patches/bluez-06-raspberry-pi-mods.patch b/packages/network/bluez/patches/bluez-06-raspberry-pi-mods.patch deleted file mode 100644 index 342a4c09ac..0000000000 --- a/packages/network/bluez/patches/bluez-06-raspberry-pi-mods.patch +++ /dev/null @@ -1,156 +0,0 @@ -Description: Patches for compatibility with on-board Bluetooth on RPi 3 -Author: Simon Long -Last-Update: 2017-04-05 - ---- a/tools/hciattach.c -+++ b/tools/hciattach.c -@@ -1091,6 +1091,9 @@ - { "bcm43xx", 0x0000, 0x0000, HCI_UART_H4, 115200, 3000000, - FLOW_CTL, DISABLE_PM, NULL, bcm43xx, NULL }, - -+ { "bcm43xx-3wire", 0x0000, 0x0000, HCI_UART_3WIRE, 115200, 3000000, -+ 0, DISABLE_PM, NULL, bcm43xx, NULL }, -+ - { "ath3k", 0x0000, 0x0000, HCI_UART_ATH3K, 115200, 115200, - FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, - -@@ -1237,7 +1240,7 @@ - { - struct uart_t *u = NULL; - int detach, printpid, raw, opt, i, n, ld, err; -- int to = 10; -+ int to = 30; - int init_speed = 0; - int send_break = 0; - pid_t pid; ---- a/tools/hciattach.h -+++ b/tools/hciattach.h -@@ -44,7 +45,7 @@ - #define HCI_UART_VND_DETECT 5 - - #ifndef FIRMWARE_DIR --#define FIRMWARE_DIR "/etc/firmware" -+#define FIRMWARE_DIR "/lib/firmware" - #endif - - int read_hci_event(int fd, unsigned char *buf, int size); ---- a/tools/hciattach_bcm43xx.c -+++ b/tools/hciattach_bcm43xx.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - #include "lib/bluetooth.h" - #include "lib/hci.h" -@@ -303,9 +304,23 @@ - static int bcm43xx_locate_patch(const char *dir_name, - const char *chip_name, char *location) - { -+ struct stat statbuf; -+ char path[PATH_MAX]; - DIR *dir; - int ret = -1; - -+ /* Try an exact match before scanning, otherwise a board without a specific -+ * firmware/link may end up loading a specific firmware for another board -+ * just because it is encountered first. -+ */ -+ if (snprintf(path, PATH_MAX, "%s/%s%s", dir_name, chip_name, FW_EXT) < 0) -+ return -1; -+ if ((stat(path, &statbuf) == 0) && S_ISREG(statbuf.st_mode)) { -+ strcpy(location, path); -+ return 0; -+ } -+ -+ /* Now search subdirectories and files with suffixes */ - dir = opendir(dir_name); - if (!dir) { - fprintf(stderr, "Cannot open directory '%s': %s\n", -@@ -320,8 +335,6 @@ - break; - - if (entry->d_type & DT_DIR) { -- char path[PATH_MAX]; -- - if (!strcmp(entry->d_name, "..") || !strcmp(entry->d_name, ".")) - continue; - -@@ -341,8 +354,10 @@ - break; - - /* found */ -- snprintf(location, PATH_MAX, "%s/%s", dir_name, entry->d_name); -- ret = 0; -+ if (snprintf(location, PATH_MAX, "%s/%s", dir_name, entry->d_name) < 0) -+ ret = -1; -+ else -+ ret = 0; - break; - } - } -@@ -352,11 +367,32 @@ - return ret; - } - -+static int get_board_type(char *buf, int buf_size) -+{ -+ int bytes_read; -+ int len; -+ int fd; -+ -+ fd = open("/sys/firmware/devicetree/base/compatible", O_RDONLY); -+ if (fd < 0) -+ return -1; -+ -+ bytes_read = read(fd, buf, buf_size); -+ close(fd); -+ if (bytes_read < 0) -+ return -1; -+ -+ len = strnlen(buf, buf_size); -+ return (len < buf_size) ? len : -1; -+} -+ - int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, - const char *bdaddr) - { - char chip_name[20]; -+ char board_specific_name[sizeof(chip_name) + 64]; - char fw_path[PATH_MAX]; -+ int chip_name_len; - - printf("bcm43xx_init\n"); - -@@ -366,12 +402,17 @@ - if (bcm43xx_read_local_name(fd, chip_name, sizeof(chip_name))) - return -1; - -- if (bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) { -- fprintf(stderr, "Patch not found, continue anyway\n"); -+ /* Grab the board compatible string from Device Tree */ -+ chip_name_len = strlen(chip_name); -+ memcpy(board_specific_name, chip_name, chip_name_len); -+ board_specific_name[chip_name_len++] = '.'; -+ -+ if (((get_board_type(board_specific_name + chip_name_len, -+ sizeof(board_specific_name) - chip_name_len) < 0) || -+ bcm43xx_locate_patch(FIRMWARE_DIR, board_specific_name, fw_path)) && -+ bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) { -+ fprintf(stderr, "Patch not found for %s, continue anyway\n", chip_name); - } else { -- if (bcm43xx_set_speed(fd, ti, speed)) -- return -1; -- - if (bcm43xx_load_firmware(fd, fw_path)) - return -1; - -@@ -381,6 +422,7 @@ - return -1; - } - -+ sleep(1); - if (bcm43xx_reset(fd)) - return -1; - } diff --git a/packages/network/bluez/patches/bluez-08-hciattach-retry-device-reset-when-no-response.patch b/packages/network/bluez/patches/bluez-08-hciattach-retry-device-reset-when-no-response.patch deleted file mode 100644 index ebf306187a..0000000000 --- a/packages/network/bluez/patches/bluez-08-hciattach-retry-device-reset-when-no-response.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 57f7aead147b138109709bbef9d4c674a3a6dc9b Mon Sep 17 00:00:00 2001 -From: meijjaa -Date: Mon, 23 Jan 2017 22:35:33 +0100 -Subject: [PATCH] hciattach: retry device reset when no response - -Some bcm chips need a couple of retries to reset. Currently init will just -timeout after a failed reset. - -Signed-off-by: meijjaa ---- - tools/hciattach_bcm43xx.c | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/tools/hciattach_bcm43xx.c b/tools/hciattach_bcm43xx.c -index bb24483..ad89161 100644 ---- a/tools/hciattach_bcm43xx.c -+++ b/tools/hciattach_bcm43xx.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - - #include "lib/bluetooth.h" - #include "lib/hci.h" -@@ -82,21 +83,31 @@ fail: - return -1; - } - -+int _fd; -+void expired(int sig) -+{ -+ unsigned char cmd[] = { HCI_COMMAND_PKT, 0x03, 0x0C, 0x00 }; -+ write(_fd, cmd, sizeof(cmd)) != sizeof(cmd); -+ alarm(4); -+} -+ - static int bcm43xx_reset(int fd) - { - unsigned char cmd[] = { HCI_COMMAND_PKT, 0x03, 0x0C, 0x00 }; - unsigned char resp[CC_MIN_SIZE]; - -+ _fd = fd; -+ signal(SIGALRM, expired); - if (write(fd, cmd, sizeof(cmd)) != sizeof(cmd)) { - fprintf(stderr, "Failed to write reset command\n"); - return -1; - } -- -+ alarm(4); - if (read_hci_event(fd, resp, sizeof(resp)) < CC_MIN_SIZE) { - fprintf(stderr, "Failed to reset chip, invalid HCI event\n"); - return -1; - } -- -+ alarm(0); - if (resp[4] != cmd[1] || resp[5] != cmd[2] || resp[6] != CMD_SUCCESS) { - fprintf(stderr, "Failed to reset chip, command failure\n"); - return -1; --- -2.38.1 diff --git a/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch b/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch deleted file mode 100644 index 12cf6a8b57..0000000000 --- a/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch +++ /dev/null @@ -1,57 +0,0 @@ -From ccc0a0cba8a2fdb8cfb148276e7c9413a3e22dc8 Mon Sep 17 00:00:00 2001 -From: MilhouseVH -Date: Thu, 19 Sep 2019 22:48:19 +0100 -Subject: [PATCH] sixaxis: Fix PID for Navigation Controller - -Newsgroups: gmane.linux.bluez.kernel -Date: 2015-06-15 18:28:26 GMT (36 weeks, 4 days, 21 hours and 32 minutes ago) - -Navigation Controller is using PID 0x042f over USB but PID 0x0268 -(same as Dualshock 3) over BT. ---- - plugins/sixaxis.c | 8 +++++++- - profiles/input/sixaxis.h | 2 ++ - 2 files changed, 9 insertions(+), 1 deletion(-) - -diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c -index 939fed7..f6baea7 100644 ---- a/plugins/sixaxis.c -+++ b/plugins/sixaxis.c -@@ -364,7 +364,13 @@ static bool setup_device(int fd, const char *sysfs_path, - info("sixaxis: setting up new device"); - - btd_device_device_set_name(device, cp->name); -- btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version); -+ -+ /* if device reports different pid/vid on BT prefer those over USB */ -+ if (cp->bt_pid) -+ btd_device_set_pnpid(device, cp->source, cp->vid, cp->bt_pid, cp->version); -+ else -+ btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version); -+ - btd_device_set_temporary(device, true); - - closure = g_new0(struct authentication_closure, 1); -diff --git a/profiles/input/sixaxis.h b/profiles/input/sixaxis.h -index 8e6f3cc..321a918 100644 ---- a/profiles/input/sixaxis.h -+++ b/profiles/input/sixaxis.h -@@ -38,6 +38,7 @@ struct cable_pairing { - uint16_t vid; - uint16_t pid; - uint16_t version; -+ uint16_t bt_pid; - CablePairingType type; - }; - -@@ -59,6 +60,7 @@ get_pairing(uint16_t vid, uint16_t pid) - .vid = 0x054c, - .pid = 0x042f, - .version = 0x0000, -+ .bt_pid = 0x0268, - .type = CABLE_PAIRING_SIXAXIS, - }, - { --- -2.7.4 - diff --git a/packages/network/bluez/patches/bluez-13-configure-Check-ell-path.patch b/packages/network/bluez/patches/bluez-13-configure-Check-ell-path.patch deleted file mode 100644 index bd9626e225..0000000000 --- a/packages/network/bluez/patches/bluez-13-configure-Check-ell-path.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 124187ef9abed60a7c40f751153e9c4516cd1f91 Mon Sep 17 00:00:00 2001 -From: Rudi Heitbaum -Date: Sat, 1 Jul 2023 01:31:20 +0000 -Subject: [PATCH] configure: Check ell path - -Use of AC_CHECK_FILE prevents cross compilation. -Instead use test to support cross compiling. - -Signed-off-by: Rudi Heitbaum ---- - configure.ac | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/configure.ac b/configure.ac -index eff297960..bc7edfcd3 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -298,9 +298,10 @@ if (test "${enable_external_ell}" = "yes"); then - AC_SUBST(ELL_LIBS) - fi - if (test "${enable_external_ell}" != "yes"); then -- AC_CHECK_FILE(${srcdir}/ell/ell.h, dummy=yes, -- AC_CHECK_FILE(${srcdir}/../ell/ell/ell.h, dummy=yes, -- AC_MSG_ERROR(ELL source is required or use --enable-external-ell))) -+ if (test ! -f ${srcdir}/ell/ell.h) && -+ (test ! -f ${srcdir}/../ell/ell/ell.h); then -+ AC_MSG_ERROR(ELL source is required or use --enable-external-ell) -+ fi - fi - AM_CONDITIONAL(EXTERNAL_ELL, test "${enable_external_ell}" = "yes" || - (test "${enable_btpclient}" != "yes" && --- -2.34.1 - diff --git a/packages/network/bluez/patches/bluez-21-hciattach-add-QCA9377-Tuffello-support.patch b/packages/network/bluez/patches/bluez-21-hciattach-add-QCA9377-Tuffello-support.patch deleted file mode 100644 index 98355a6126..0000000000 --- a/packages/network/bluez/patches/bluez-21-hciattach-add-QCA9377-Tuffello-support.patch +++ /dev/null @@ -1,2376 +0,0 @@ -From b42a087411199d7f480f1683bddd3206c5fd17b1 Mon Sep 17 00:00:00 2001 -From: Gary Bisson -Date: Wed, 17 Aug 2016 11:36:28 +0200 -Subject: [PATCH] hciattach: add QCA9377 Tuffello support - -From CodeAurora repository: -https://source.codeaurora.org/quic/la/platform/external/bluetooth/bluez/ - -Modifications: -- code indentation -- remove verbose traces -- use H4 protocol instead of IBS - -Also squashed: -hciattach_rome: simplify baudrate setting -hciattach_rome: do not override module internal MAC address -hciattach_rome: force IBS to disabled in NVM -hciattach_rome: display ROM and TLV info by default - -Signed-off-by: Gary Bisson ---- - Makefile.tools | 1 + - android/Android.mk | 1 + - tools/hciattach.c | 12 + - tools/hciattach.h | 1 + - tools/hciattach_rome.c | 1872 ++++++++++++++++++++++++++++++++++++++++ - tools/hciattach_rome.h | 388 +++++++++ - 6 files changed, 2275 insertions(+) - create mode 100644 tools/hciattach_rome.c - create mode 100644 tools/hciattach_rome.h - -diff --git a/Makefile.tools b/Makefile.tools -index b7b422506..e0e995089 100644 ---- a/Makefile.tools -+++ b/Makefile.tools -@@ -304,6 +304,7 @@ tools_hciattach_SOURCES = tools/hciattach.c tools/hciattach.h \ - tools/hciattach_ti.c \ - tools/hciattach_tialt.c \ - tools/hciattach_ath3k.c \ -+ tools/hciattach_rome.c \ - tools/hciattach_qualcomm.c \ - tools/hciattach_intel.c \ - tools/hciattach_bcm43xx.c -diff --git a/android/Android.mk b/android/Android.mk -index 76a826b47..01599c04b 100644 ---- a/android/Android.mk -+++ b/android/Android.mk -@@ -696,6 +696,7 @@ LOCAL_SRC_FILES := \ - bluez/tools/hciattach_ti.c \ - bluez/tools/hciattach_tialt.c \ - bluez/tools/hciattach_ath3k.c \ -+ bluez/tools/hciattach_rome.c \ - bluez/tools/hciattach_qualcomm.c \ - bluez/tools/hciattach_intel.c \ - bluez/tools/hciattach_bcm43xx.c \ -diff --git a/tools/hciattach.c b/tools/hciattach.c -index fad176c9b..02a65c692 100644 ---- a/tools/hciattach.c -+++ b/tools/hciattach.c -@@ -263,6 +263,11 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) - return ath3k_post(fd, u->pm); - } - -+static int qca(int fd, struct uart_t *u, struct termios *ti) -+{ -+ return qca_soc_init(fd, u->speed, u->bdaddr); -+} -+ - static int qualcomm(int fd, struct uart_t *u, struct termios *ti) - { - return qualcomm_init(fd, u->speed, ti, u->bdaddr); -@@ -1093,6 +1098,10 @@ struct uart_t uart[] = { - { "ath3k", 0x0000, 0x0000, HCI_UART_ATH3K, 115200, 115200, - FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, - -+ /* QCA ROME */ -+ { "qca", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, -+ FLOW_CTL, DISABLE_PM, NULL, qca, NULL }, -+ - /* QUALCOMM BTS */ - { "qualcomm", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, - FLOW_CTL, DISABLE_PM, NULL, qualcomm, NULL }, -@@ -1145,6 +1154,9 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw) - if (u->flags & AMP_DEV) - flags |= 1 << HCI_UART_CREATE_AMP; - -+ if (!strncmp(u->type, "qca", 3)) -+ flags |= 1 << HCI_UART_RESET_ON_INIT; -+ - fd = open(dev, O_RDWR | O_NOCTTY); - if (fd < 0) { - perror("Can't open serial port"); -diff --git a/tools/hciattach.h b/tools/hciattach.h -index 249aab49e..85c801ccf 100644 ---- a/tools/hciattach.h -+++ b/tools/hciattach.h -@@ -65,6 +65,7 @@ int bgb2xx_init(int dd, bdaddr_t *bdaddr); - int ath3k_init(int fd, int speed, int init_speed, char *bdaddr, - struct termios *ti); - int ath3k_post(int fd, int pm); -+int qca_soc_init(int fd, int speed, char *bdaddr); - int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr); - int intel_init(int fd, int init_speed, int *speed, struct termios *ti); - int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -new file mode 100644 -index 000000000..9a7f222c4 ---- /dev/null -+++ b/tools/hciattach_rome.c -@@ -0,0 +1,1872 @@ -+/* -+ * -+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. -+ * Not a Contribution. -+ * -+ * Copyright 2012 The Android Open Source Project -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); you -+ * may not use this file except in compliance with the License. You may -+ * obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -+ * implied. See the License for the specific language governing -+ * permissions and limitations under the License. -+ * -+ */ -+ -+/****************************************************************************** -+ * -+ * Filename: hciattach_rome.c -+ * -+ * Description: Contains controller-specific functions, like -+ * firmware patch download -+ * low power mode operations -+ * -+ ******************************************************************************/ -+ -+#define MODULE_HAS_MAC_ADDR -+#define LOG_TAG "bt_vendor" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "hciattach_rome.h" -+#include "hciattach.h" -+ -+/****************************************************************************** -+ ** Variables -+ ******************************************************************************/ -+FILE *file; -+unsigned char *phdr_buffer; -+unsigned char *pdata_buffer = NULL; -+patch_info rampatch_patch_info; -+int rome_ver = ROME_VER_UNKNOWN; -+unsigned char gTlv_type; -+unsigned char gtlv_dwndcfg; -+char *rampatch_file_path; -+char *nvm_file_path; -+vnd_userial_cb_t vnd_userial; -+unsigned char wait_vsc_evt = TRUE; -+ -+/***************************************************************************** -+ ** Functions -+ *****************************************************************************/ -+ -+/******************************************************************************* -+ ** -+ ** Function userial_to_tcio_baud -+ ** -+ ** Description helper function converts USERIAL baud rates into TCIO -+ ** conforming baud rates -+ ** -+ ** Returns TRUE/FALSE -+ ** -+ *******************************************************************************/ -+unsigned char userial_to_tcio_baud(unsigned char cfg_baud, unsigned int *baud) -+{ -+ if (cfg_baud == USERIAL_BAUD_115200) -+ *baud = B115200; -+ else if (cfg_baud == USERIAL_BAUD_4M) -+ *baud = B4000000; -+ else if (cfg_baud == USERIAL_BAUD_3M) -+ *baud = B3000000; -+ else if (cfg_baud == USERIAL_BAUD_2M) -+ *baud = B2000000; -+ else if (cfg_baud == USERIAL_BAUD_1M) -+ *baud = B1000000; -+ else if (cfg_baud == USERIAL_BAUD_921600) -+ *baud = B921600; -+ else if (cfg_baud == USERIAL_BAUD_460800) -+ *baud = B460800; -+ else if (cfg_baud == USERIAL_BAUD_230400) -+ *baud = B230400; -+ else if (cfg_baud == USERIAL_BAUD_57600) -+ *baud = B57600; -+ else if (cfg_baud == USERIAL_BAUD_19200) -+ *baud = B19200; -+ else if (cfg_baud == USERIAL_BAUD_9600) -+ *baud = B9600; -+ else if (cfg_baud == USERIAL_BAUD_1200) -+ *baud = B1200; -+ else if (cfg_baud == USERIAL_BAUD_600) -+ *baud = B600; -+ else { -+ fprintf(stderr, "userial vendor open: unsupported baud idx %i\n", cfg_baud); -+ *baud = B115200; -+ return FALSE; -+ } -+ -+ return TRUE; -+} -+ -+ -+/******************************************************************************* -+ ** -+ ** Function userial_vendor_set_baud -+ ** -+ ** Description Set new baud rate -+ ** -+ ** Returns None -+ ** -+ *******************************************************************************/ -+void userial_vendor_set_baud(unsigned char userial_baud) -+{ -+ unsigned int tcio_baud; -+ -+ if (tcgetattr(vnd_userial.fd, &vnd_userial.termios) < 0) { -+ perror("Can't get port settings"); -+ return; -+ } -+ cfmakeraw(&vnd_userial.termios); -+ vnd_userial.termios.c_cflag |= CLOCAL; -+ vnd_userial.termios.c_cflag |= CREAD; -+ vnd_userial.termios.c_cflag |= CS8; -+ tcsetattr(vnd_userial.fd, TCSANOW, &vnd_userial.termios); -+ -+ userial_to_tcio_baud(userial_baud, &tcio_baud); -+ -+ cfsetospeed(&vnd_userial.termios, tcio_baud); -+ cfsetispeed(&vnd_userial.termios, tcio_baud); -+ tcsetattr(vnd_userial.fd, TCSADRAIN, &vnd_userial.termios); /* don't change speed until last write done */ -+ -+} -+ -+ -+/******************************************************************************* -+ ** -+ ** Function userial_vendor_ioctl -+ ** -+ ** Description ioctl inteface -+ ** -+ ** Returns None -+ ** -+ *******************************************************************************/ -+int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) -+{ -+ int err = -1; -+ struct termios ti; -+ -+ if (tcgetattr(fd, &ti) < 0) { -+ perror("Can't get port settings"); -+ return -1; -+ } -+ cfmakeraw(&ti); -+ ti.c_cflag |= CLOCAL; -+ ti.c_cflag |= CREAD; -+ ti.c_cflag |= CS8; -+ -+ switch(op) { -+#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) -+ case USERIAL_OP_ASSERT_BT_WAKE: -+ VNDUSERIALDBG("## userial_vendor_ioctl: Asserting BT_Wake ##"); -+ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_ASSERT, NULL); -+ break; -+ -+ case USERIAL_OP_DEASSERT_BT_WAKE: -+ VNDUSERIALDBG("## userial_vendor_ioctl: De-asserting BT_Wake ##"); -+ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_DEASSERT, NULL); -+ break; -+ -+ case USERIAL_OP_GET_BT_WAKE_STATE: -+ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_GET_ST, p_data); -+ break; -+#endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) -+ case USERIAL_OP_FLOW_ON: -+ ti.c_cflag |= CRTSCTS; -+ if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { -+ perror("Can't set port settings"); -+ return -1; -+ } -+ -+ break; -+ -+ case USERIAL_OP_FLOW_OFF: -+ ti.c_cflag &= ~CRTSCTS; -+ if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { -+ fprintf(stderr, "Can't set port settings"); -+ return -1; -+ } -+ break; -+ -+ default: -+ break; -+ } -+ -+ return err; -+} -+ -+ -+int get_vs_hci_event(unsigned char *rsp) -+{ -+ int err = 0, soc_id =0; -+ unsigned char paramlen = 0; -+ -+ if ( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE)) -+ PR_DBG("%s: Received HCI-Vendor Specific event\n", __FUNCTION__); -+ else { -+ fprintf(stderr, "%s: Failed to receive HCI-Vendor Specific event\n", __FUNCTION__); -+ err = -EIO; -+ goto failed; -+ } -+ -+ /* Check the status of the operation */ -+ switch ( rsp[CMD_RSP_OFFSET] ) { -+ case EDL_CMD_REQ_RES_EVT: -+ switch(rsp[RSP_TYPE_OFFSET]) { -+ case EDL_PATCH_VER_RES_EVT: -+ case EDL_APP_VER_RES_EVT: -+ PR_INFO("Current Product ID\t\t: 0x%08x\n", -+ (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 | -+ rsp[PATCH_PROD_ID_OFFSET+2] << 16 | -+ rsp[PATCH_PROD_ID_OFFSET+1] << 8 | -+ rsp[PATCH_PROD_ID_OFFSET] )); -+ -+ /* Patch Version indicates FW patch version */ -+ PR_INFO("Current Patch Version\t\t: 0x%04x\n", -+ (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 | -+ rsp[PATCH_PATCH_VER_OFFSET] )); -+ -+ /* ROM Build Version indicates ROM build version like 1.0/1.1/2.0 */ -+ rome_ver = (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 | -+ rsp[PATCH_ROM_BUILD_VER_OFFSET]); -+ PR_INFO("Current ROM Build Version\t: 0x%04x\n", rome_ver); -+ -+ /* In case rome 1.0/1.1, there is no SOC ID version available */ -+ if (paramlen - 10) { -+ soc_id = (unsigned int)(rsp[PATCH_SOC_VER_OFFSET +3] << 24 | -+ rsp[PATCH_SOC_VER_OFFSET+2] << 16 | -+ rsp[PATCH_SOC_VER_OFFSET+1] << 8 | -+ rsp[PATCH_SOC_VER_OFFSET]); -+ PR_INFO("Current SOC Version\t\t: 0x%08x\n", soc_id); -+ } -+ -+ /* Rome Chipset Version can be decided by Patch version and SOC version, -+ Upper 2 bytes will be used for Patch version and Lower 2 bytes will be -+ used for SOC as combination for BT host driver */ -+ rome_ver = (rome_ver << 16) | (soc_id & 0x0000ffff); -+ break; -+ case EDL_TVL_DNLD_RES_EVT: -+ case EDL_CMD_EXE_STATUS_EVT: -+ switch (err = rsp[CMD_STATUS_OFFSET]) { -+ case HCI_CMD_SUCCESS: -+ PR_DBG("%s: Download Packet successfully!\n", __FUNCTION__); -+ break; -+ case PATCH_LEN_ERROR: -+ fprintf(stderr, "%s: Invalid patch length argument passed for EDL PATCH " -+ "SET REQ cmd\n", __FUNCTION__); -+ break; -+ case PATCH_VER_ERROR: -+ fprintf(stderr, "%s: Invalid patch version argument passed for EDL PATCH " -+ "SET REQ cmd\n", __FUNCTION__); -+ break; -+ case PATCH_CRC_ERROR: -+ fprintf(stderr, "%s: CRC check of patch failed!!!\n", __FUNCTION__); -+ break; -+ case PATCH_NOT_FOUND: -+ fprintf(stderr, "%s: Invalid patch data!!!\n", __FUNCTION__); -+ break; -+ case TLV_TYPE_ERROR: -+ fprintf(stderr, "%s: TLV Type Error !!!\n", __FUNCTION__); -+ break; -+ default: -+ fprintf(stderr, "%s: Undefined error (0x%x)", __FUNCTION__, err); -+ break; -+ } -+ break; -+ } -+ break; -+ -+ case NVM_ACCESS_CODE: -+ PR_DBG("%s: NVM Access Code!!!\n", __FUNCTION__); -+ err = HCI_CMD_SUCCESS; -+ break; -+ case EDL_SET_BAUDRATE_RSP_EVT: -+ /* Rome 1.1 has bug with the response, so it should ignore it. */ -+ if (rsp[BAUDRATE_RSP_STATUS_OFFSET] != BAUDRATE_CHANGE_SUCCESS) { -+ fprintf(stderr, "%s: Set Baudrate request failed - 0x%x\n", __FUNCTION__, -+ rsp[CMD_STATUS_OFFSET]); -+ err = -1; -+ } -+ break; -+ default: -+ fprintf(stderr, "%s: Not a valid status!!!\n", __FUNCTION__); -+ err = -1; -+ break; -+ } -+ -+failed: -+ return err; -+} -+ -+ -+int wait_for_data(int fd, int maxTimeOut) -+{ -+ fd_set infids; -+ struct timeval timeout; -+ -+ if (maxTimeOut <= 0) { -+ fprintf(stderr, "%s: Invalid timeout value specified", __func__); -+ return -EINVAL; -+ } -+ -+ FD_ZERO (&infids); -+ FD_SET (fd, &infids); -+ timeout.tv_sec = maxTimeOut; -+ timeout.tv_usec = 0; -+ -+ /* Check whether data is available in TTY buffer before calling read() */ -+ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) { -+ fprintf(stderr, "%s: Timing out on select for %d secs.\n", __FUNCTION__, maxTimeOut); -+ return -1; -+ } -+ -+ return 1; -+} -+ -+/* -+ * Read an VS HCI event from the given file descriptor. -+ */ -+int read_vs_hci_event(int fd, unsigned char* buf, int size) -+{ -+ int remain, r, retry = 0; -+ int count = 0; -+ -+ if (size <= 0) { -+ fprintf(stderr, "Invalid size arguement!\n"); -+ return -1; -+ } -+ -+ /* Check whether data is available in TTY buffer before calling read() */ -+ if (wait_for_data(fd, SELECT_TIMEOUT) < 1) -+ return -1; -+ -+ /* The first byte identifies the packet type. For HCI event packets, it -+ * should be 0x04, so we read until we get to the 0x04. */ -+ /* It will keep reading until find 0x04 byte */ -+ while (1) { -+ /* Read UART Buffer for HCI-DATA */ -+ r = read(fd, buf, 1); -+ if (r <= 0) { -+ fprintf(stderr, "%s: read() failed. error: %d\n", -+ __FUNCTION__, r); -+ return -1; -+ } -+ -+ /* Check if received data is HCI-DATA or not. -+ * If not HCI-DATA, then retry reading the UART Buffer once. -+ * Sometimes there could be corruption on the UART lines and to -+ * avoid that retry once reading the UART Buffer for HCI-DATA. -+ */ -+ if (buf[0] == 0x04) { /* Recvd. HCI DATA */ -+ retry = 0; -+ break; -+ } -+ else if (retry < MAX_RETRY_CNT) { /* Retry mechanism */ -+ retry++; -+ fprintf(stderr, "%s: Not an HCI-VS-Event! buf[0]: %d", -+ __FUNCTION__, buf[0]); -+ if (wait_for_data(fd, SELECT_TIMEOUT) < 1) -+ return -1; -+ else /* Data available in UART Buffer: Continue to read */ -+ continue; -+ } -+ else { /* RETRY failed : Exiting with failure */ -+ fprintf(stderr, "%s: RETRY failed!", __FUNCTION__); -+ return -1; -+ } -+ } -+ count++; -+ -+ /* The next two bytes are the event code and parameter total length. */ -+ while (count < 3) { -+ r = read(fd, buf + count, 3 - count); -+ if ((r <= 0) || (buf[1] != 0xFF )) { -+ fprintf(stderr, "It is not VS event !!\n"); -+ return -1; -+ } -+ count += r; -+ } -+ -+ /* Now we read the parameters. */ -+ if (buf[2] < (size - 3)) -+ remain = buf[2]; -+ else -+ remain = size - 3; -+ -+ while ((count - 3) < remain) { -+ r = read(fd, buf + count, remain - (count - 3)); -+ if (r <= 0) -+ return -1; -+ count += r; -+ } -+ -+ /* Check if the set patch command is successful or not */ -+ if (get_vs_hci_event(buf) != HCI_CMD_SUCCESS) -+ return -1; -+ -+ return count; -+} -+ -+ -+int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size) -+{ -+ int ret = 0; -+ -+ /* Send the HCI command packet to UART for transmission */ -+ ret = write(fd, cmd, size); -+ if (ret != size) { -+ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, ret); -+ goto failed; -+ } -+ -+ if (wait_vsc_evt) { -+ /* Check for response from the Controller */ -+ if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) { -+ ret = -ETIMEDOUT; -+ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); -+ goto failed; -+ } -+ } -+ -+failed: -+ return ret; -+} -+ -+void frame_hci_cmd_pkt( -+ unsigned char *cmd, -+ int edl_cmd, unsigned int p_base_addr, -+ int segtNo, int size -+ ) -+{ -+ int offset = 0; -+ hci_command_hdr *cmd_hdr; -+ -+ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); -+ -+ cmd_hdr = (void *) (cmd + 1); -+ -+ cmd[0] = HCI_COMMAND_PKT; -+ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, HCI_PATCH_CMD_OCF); -+ cmd_hdr->plen = size; -+ cmd[4] = edl_cmd; -+ -+ switch (edl_cmd) { -+ case EDL_PATCH_SET_REQ_CMD: -+ /* Copy the patch header info as CMD params */ -+ memcpy(&cmd[5], phdr_buffer, PATCH_HDR_LEN); -+ PR_DBG("%s: Sending EDL_PATCH_SET_REQ_CMD\n", __FUNCTION__); -+ PR_DBG("HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", -+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); -+ break; -+ case EDL_PATCH_DLD_REQ_CMD: -+ offset = ((segtNo - 1) * MAX_DATA_PER_SEGMENT); -+ p_base_addr += offset; -+ cmd_hdr->plen = (size + 6); -+ cmd[5] = (size + 4); -+ cmd[6] = EXTRACT_BYTE(p_base_addr, 0); -+ cmd[7] = EXTRACT_BYTE(p_base_addr, 1); -+ cmd[8] = EXTRACT_BYTE(p_base_addr, 2); -+ cmd[9] = EXTRACT_BYTE(p_base_addr, 3); -+ memcpy(&cmd[10], (pdata_buffer + offset), size); -+ -+ PR_DBG("%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes\n", -+ __FUNCTION__, size); -+ PR_DBG("HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t" -+ "0x%x\t0x%x\t0x%x\t\n", segtNo, cmd[0], cmd[1], cmd[2], -+ cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], cmd[8], cmd[9]); -+ break; -+ case EDL_PATCH_ATCH_REQ_CMD: -+ PR_DBG("%s: Sending EDL_PATCH_ATTACH_REQ_CMD\n", __FUNCTION__); -+ PR_DBG("HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", -+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); -+ break; -+ case EDL_PATCH_RST_REQ_CMD: -+ PR_DBG("%s: Sending EDL_PATCH_RESET_REQ_CMD\n", __FUNCTION__); -+ PR_DBG("HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", -+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); -+ break; -+ case EDL_PATCH_VER_REQ_CMD: -+ PR_DBG("%s: Sending EDL_PATCH_VER_REQ_CMD\n", __FUNCTION__); -+ PR_DBG("HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", -+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); -+ break; -+ case EDL_PATCH_TLV_REQ_CMD: -+ PR_DBG("%s: Sending EDL_PATCH_TLV_REQ_CMD\n", __FUNCTION__); -+ /* Parameter Total Length */ -+ cmd[3] = size +2; -+ -+ /* TLV Segment Length */ -+ cmd[5] = size; -+ PR_DBG("HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", -+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]); -+ offset = (segtNo * MAX_SIZE_PER_TLV_SEGMENT); -+ memcpy(&cmd[6], (pdata_buffer + offset), size); -+ break; -+ default: -+ fprintf(stderr, "%s: Unknown EDL CMD !!!\n", __FUNCTION__); -+ } -+} -+ -+void rome_extract_patch_header_info(unsigned char *buf) -+{ -+ int index; -+ -+ /* Extract patch id */ -+ for (index = 0; index < 4; index++) -+ rampatch_patch_info.patch_id |= -+ (LSH(buf[index + P_ID_OFFSET], (index * 8))); -+ -+ /* Extract (ROM and BUILD) version information */ -+ for (index = 0; index < 2; index++) -+ rampatch_patch_info.patch_ver.rom_version |= -+ (LSH(buf[index + P_ROME_VER_OFFSET], (index * 8))); -+ -+ for (index = 0; index < 2; index++) -+ rampatch_patch_info.patch_ver.build_version |= -+ (LSH(buf[index + P_BUILD_VER_OFFSET], (index * 8))); -+ -+ /* Extract patch base and entry addresses */ -+ for (index = 0; index < 4; index++) -+ rampatch_patch_info.patch_base_addr |= -+ (LSH(buf[index + P_BASE_ADDR_OFFSET], (index * 8))); -+ -+ /* Patch BASE & ENTRY addresses are same */ -+ rampatch_patch_info.patch_entry_addr = rampatch_patch_info.patch_base_addr; -+ -+ /* Extract total length of the patch payload */ -+ for (index = 0; index < 4; index++) -+ rampatch_patch_info.patch_length |= -+ (LSH(buf[index + P_LEN_OFFSET], (index * 8))); -+ -+ /* Extract the CRC checksum of the patch payload */ -+ for (index = 0; index < 4; index++) -+ rampatch_patch_info.patch_crc |= -+ (LSH(buf[index + P_CRC_OFFSET], (index * 8))); -+ -+ /* Extract patch control value */ -+ for (index = 0; index < 4; index++) -+ rampatch_patch_info.patch_ctrl |= -+ (LSH(buf[index + P_CONTROL_OFFSET], (index * 8))); -+ -+ fprintf(stderr, "PATCH_ID\t : 0x%x\n", rampatch_patch_info.patch_id); -+ fprintf(stderr, "ROM_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.rom_version); -+ fprintf(stderr, "BUILD_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.build_version); -+ fprintf(stderr, "PATCH_LENGTH\t : 0x%x\n", rampatch_patch_info.patch_length); -+ fprintf(stderr, "PATCH_CRC\t : 0x%x\n", rampatch_patch_info.patch_crc); -+ fprintf(stderr, "PATCH_CONTROL\t : 0x%x\n", rampatch_patch_info.patch_ctrl); -+ fprintf(stderr, "PATCH_BASE_ADDR\t : 0x%x\n", rampatch_patch_info.patch_base_addr); -+ -+} -+ -+int rome_edl_set_patch_request(int fd) -+{ -+ int size, err; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+ /* Frame the HCI CMD to be sent to the Controller */ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_SET_REQ_CMD, 0, -+ -1, PATCH_HDR_LEN + 1); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if (err != size) { -+ fprintf(stderr, "Failed to set the patch info to the Controller!\n"); -+ goto error; -+ } -+ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if (err < 0) { -+ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); -+ goto error; -+ } -+error: -+ return err; -+} -+ -+int rome_edl_patch_download_request(int fd) -+{ -+ int no_of_patch_segment; -+ int index = 1, err = 0, size = 0; -+ unsigned int p_base_addr; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+ no_of_patch_segment = (rampatch_patch_info.patch_length / -+ MAX_DATA_PER_SEGMENT); -+ -+ /* Initialize the patch base address from the one read from bin file */ -+ p_base_addr = rampatch_patch_info.patch_base_addr; -+ -+ /* -+ * Depending upon size of the patch payload, download the patches in -+ * segments with a max. size of 239 bytes -+ */ -+ for (index = 1; index <= no_of_patch_segment; index++) { -+ /* Frame the HCI CMD PKT to be sent to Controller*/ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr, -+ index, MAX_DATA_PER_SEGMENT); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ -+ /* Initialize the RSP packet everytime to 0 */ -+ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if (err != size) { -+ fprintf(stderr, "Failed to send the patch payload to the Controller!\n"); -+ goto error; -+ } -+ -+ /* Read Command Complete Event */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if (err < 0) { -+ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", -+ __FUNCTION__, index); -+ goto error; -+ } -+ } -+ -+ /* Check if any pending patch data to be sent */ -+ size = (rampatch_patch_info.patch_length < MAX_DATA_PER_SEGMENT) ? -+ rampatch_patch_info.patch_length : -+ (rampatch_patch_info.patch_length % MAX_DATA_PER_SEGMENT); -+ -+ if (size) { -+ /* Frame the HCI CMD PKT to be sent to Controller*/ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr, index, size); -+ -+ /* Initialize the RSP packet everytime to 0 */ -+ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if (err != size) { -+ fprintf(stderr, "Failed to send the patch payload to the Controller!\n"); -+ goto error; -+ } -+ -+ /* Read Command Complete Event */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if (err < 0) { -+ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", -+ __FUNCTION__, index); -+ goto error; -+ } -+ } -+ -+error: -+ return err; -+} -+ -+static int rome_download_rampatch(int fd) -+{ -+ int c, size, index, ret = -1; -+ -+ /* Get handle to the RAMPATCH binary file */ -+ fprintf(stderr, "%s: Getting handle to the RAMPATCH binary file from %s\n", __FUNCTION__, ROME_FW_PATH); -+ file = fopen(ROME_FW_PATH, "r"); -+ if (file == NULL) { -+ fprintf(stderr, "%s: Failed to get handle to the RAMPATCH bin file!\n", -+ __FUNCTION__); -+ return -ENFILE; -+ } -+ -+ /* Allocate memory for the patch headder info */ -+ fprintf(stderr, "%s: Allocating memory for the patch header\n", __FUNCTION__); -+ phdr_buffer = (unsigned char *) malloc(PATCH_HDR_LEN + 1); -+ if (phdr_buffer == NULL) { -+ fprintf(stderr, "%s: Failed to allocate memory for patch header\n", -+ __FUNCTION__); -+ goto phdr_alloc_failed; -+ } -+ for (index = 0; index < PATCH_HDR_LEN + 1; index++) -+ phdr_buffer[index] = 0x0; -+ -+ /* Read 28 bytes of patch header information */ -+ fprintf(stderr, "%s: Reading patch header info\n", __FUNCTION__); -+ index = 0; -+ do { -+ c = fgetc (file); -+ phdr_buffer[index++] = (unsigned char)c; -+ } while (index != PATCH_HDR_LEN); -+ -+ /* Save the patch header info into local structure */ -+ fprintf(stderr, "%s: Saving patch hdr. info\n", __FUNCTION__); -+ rome_extract_patch_header_info((unsigned char *)phdr_buffer); -+ -+ /* Set the patch header info onto the Controller */ -+ ret = rome_edl_set_patch_request(fd); -+ if (ret < 0) { -+ fprintf(stderr, "%s: Error setting the patchheader info!\n", __FUNCTION__); -+ goto pdata_alloc_failed; -+ } -+ -+ /* Allocate memory for the patch payload */ -+ fprintf(stderr, "%s: Allocating memory for patch payload\n", __FUNCTION__); -+ size = rampatch_patch_info.patch_length; -+ pdata_buffer = (unsigned char *) malloc(size+1); -+ if (pdata_buffer == NULL) { -+ fprintf(stderr, "%s: Failed to allocate memory for patch payload\n", -+ __FUNCTION__); -+ goto pdata_alloc_failed; -+ } -+ for (index = 0; index < size+1; index++) -+ pdata_buffer[index] = 0x0; -+ -+ /* Read the patch data from Rampatch binary image */ -+ fprintf(stderr, "%s: Reading patch payload from RAMPATCH file\n", __FUNCTION__); -+ index = 0; -+ do { -+ c = fgetc (file); -+ pdata_buffer[index++] = (unsigned char)c; -+ } while (c != EOF); -+ -+ /* Downloading patches in segments to controller */ -+ ret = rome_edl_patch_download_request(fd); -+ if (ret < 0) { -+ fprintf(stderr, "%s: Error downloading patch segments!\n", __FUNCTION__); -+ goto cleanup; -+ } -+cleanup: -+ free(pdata_buffer); -+pdata_alloc_failed: -+ free(phdr_buffer); -+phdr_alloc_failed: -+ fclose(file); -+ -+ return ret; -+} -+ -+int rome_attach_rampatch(int fd) -+{ -+ int size, err; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+ /* Frame the HCI CMD to be sent to the Controller */ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_ATCH_REQ_CMD, 0, -+ -1, EDL_PATCH_CMD_LEN); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if (err != size) { -+ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); -+ goto error; -+ } -+ -+ /* Read Command Complete Event */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if (err < 0) { -+ fprintf(stderr, "%s: Failed to attach the patch segment(s)\n", __FUNCTION__); -+ goto error; -+ } -+error: -+ return err; -+} -+ -+int rome_rampatch_reset(int fd) -+{ -+ int size, err = 0; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ struct timespec tm = { 0, 100*1000*1000 }; /* 100 ms */ -+ -+ /* Frame the HCI CMD to be sent to the Controller */ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_RST_REQ_CMD, 0, -+ -1, EDL_PATCH_CMD_LEN); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); -+ -+ /* Send HCI Command packet to Controller */ -+ err = write(fd, cmd, size); -+ if (err != size) { -+ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); -+ goto error; -+ } -+ -+ /* -+ * Controller doesn't sends any response for the patch reset -+ * command. HOST has to wait for 100ms before proceeding. -+ */ -+ nanosleep(&tm, NULL); -+ -+error: -+ return err; -+} -+ -+int get_value_from_config(char *file_path,char *param) -+{ -+ FILE *pfile = NULL; -+ char *line = NULL; -+ char *pch = NULL; -+ char param_str[20]; -+ int bytes_read = 0, position; -+ int ret = -1; -+ -+ if (!file_path || !param) { -+ fprintf(stderr,"Invalid arguments\n"); -+ return -EINVAL; -+ } -+ -+ pfile = fopen(file_path, "r" ); -+ if (!pfile) { -+ fprintf(stderr, "Failed to open %s\n", file_path); -+ return ret; -+ } -+ -+ while (getline(&line, &bytes_read, pfile) > 0 ) { -+ if (line[0] != '#' && line[0] != '\n') { -+ pch = memchr(line, '=', strlen(line)); -+ if (pch != NULL) { -+ position = pch - line; -+ strncpy(param_str, line, position); -+ if (strncmp(param_str, param, position) == 0) { -+ ret = atoi(pch + 1); -+ break; -+ } -+ } -+ } -+ } -+ free(line); -+ fclose(pfile); -+ return ret; -+} -+ -+int read_bd_address(unsigned char *bdaddr) -+{ -+ int fd = -1; -+ int readPtr = 0; -+ unsigned char data[BD_ADDR_LEN]; -+ -+ /* Open the persist file for reading device address*/ -+ fd = open("/etc/bluetooth/.bt_nv.bin", O_RDONLY); -+ if (fd < 0) { -+ fprintf(stderr, "%s: Open failed: Programming default BD ADDR\n", __func__); -+ return -1; -+ } -+ -+ /* Read the NVM Header : fp will be advanced by readPtr number of bytes */ -+ readPtr = read(fd, data, PERSIST_HEADER_LEN); -+ if (readPtr > 0) -+ fprintf(stderr, "%s: Persist header data: %02x \t %02x \t %02x\n", __func__, -+ data[NVITEM], data[RDWR_PROT], data[NVITEM_SIZE]); -+ else { -+ fprintf(stderr, "%s: Read from persist memory failed : Programming default" -+ " BD ADDR\n"); -+ close(fd); -+ return -1; -+ } -+ -+ /* Check for BD ADDR length before programming */ -+ if (data[NVITEM_SIZE] != BD_ADDR_LEN) { -+ fprintf(stderr, "Invalid BD ADDR: Programming default BD ADDR!\n"); -+ close(fd); -+ return -1; -+ } -+ -+ /* Read the BD ADDR info */ -+ readPtr = read(fd, data, BD_ADDR_LEN); -+ if (readPtr > 0) -+ fprintf(stderr, "BD-ADDR: ==> %02x:%02x:%02x:%02x:%02x:%02x\n", data[0], -+ data[1], data[2], data[3], data[4], data[5]); -+ else { -+ fprintf(stderr, "%s: Read from persist memory failed : Programming default" -+ " BD ADDR\n"); -+ close(fd); -+ return -1; -+ } -+ memcpy(bdaddr, data, BD_ADDR_LEN); -+ close(fd); -+ return 0; -+} -+ -+int isSpeedValid(int speed, unsigned char *baud_rate) -+{ -+ switch(speed) { -+ case 9600: -+ *baud_rate = BAUDRATE_9600; -+ break; -+ case 19200: -+ *baud_rate = BAUDRATE_19200; -+ break; -+ case 57600: -+ *baud_rate = BAUDRATE_57600; -+ break; -+ case 115200: -+ *baud_rate = BAUDRATE_115200; -+ break; -+ case 230400: -+ *baud_rate = BAUDRATE_230400; -+ break; -+ case 460800: -+ *baud_rate = BAUDRATE_460800; -+ break; -+ case 921600: -+ *baud_rate = BAUDRATE_921600; -+ break; -+ case 1000000: -+ *baud_rate = BAUDRATE_1000000; -+ break; -+ case 2000000: -+ *baud_rate = BAUDRATE_2000000; -+ break; -+ case 3000000: -+ *baud_rate = BAUDRATE_3000000; -+ break; -+ case 4000000: -+ *baud_rate = BAUDRATE_4000000; -+ break; -+ case 300: -+ case 600: -+ case 1200: -+ case 2400: -+ default: -+ fprintf(stderr, "Invalid baudrate, default to 115200!\n"); -+ *baud_rate = BAUDRATE_115200; -+ break; -+ } -+ return -1; -+} -+ -+int rome_get_tlv_file(char *file_path, unsigned char baud_rate) -+{ -+ FILE * pFile; -+ long fileSize; -+ int readSize, nvm_length, nvm_index, i; -+ unsigned short nvm_tag_len; -+ tlv_patch_info *ptlv_header; -+ tlv_nvm_hdr *nvm_ptr; -+ unsigned char data_buf[PRINT_BUF_SIZE]={0,}; -+ unsigned char *nvm_byte_ptr; -+ unsigned char bdaddr[6]; -+ unsigned short pcm_value, ibs_value; -+ unsigned short deep_sleep_value; -+ -+ pFile = fopen ( file_path , "r" ); -+ if (pFile==NULL) { -+ fprintf(stderr, "%s File Open Fail\n", file_path); -+ return -1; -+ } -+ -+ /* Get File Size */ -+ fseek (pFile , 0 , SEEK_END); -+ -+ if ((fileSize = ftell(pFile)) < 0) { -+ fprintf(stderr, "%s: fail to get current file position\n", file_path); -+ fclose(pFile); -+ return -1; -+ } -+ -+ if (fileSize == 0) { -+ fprintf(stderr, "%s: no content in the file\n", file_path); -+ fclose(pFile); -+ return -1; -+ } -+ -+ rewind (pFile); -+ -+ pdata_buffer = (unsigned char*) malloc (sizeof(char)*fileSize); -+ if (pdata_buffer == NULL) { -+ fprintf(stderr, "Allocated Memory failed\n"); -+ fclose (pFile); -+ return -1; -+ } -+ -+ /* Copy file into allocated buffer */ -+ readSize = fread (pdata_buffer,1,fileSize,pFile); -+ -+ /* File Close */ -+ fclose (pFile); -+ -+ if (readSize != fileSize) { -+ fprintf(stderr, "Read file size(%d) not matched with actual file size (%ld bytes)\n",readSize,fileSize); -+ return -1; -+ } -+ -+ ptlv_header = (tlv_patch_info *) pdata_buffer; -+ -+ /* To handle different event between rampatch and NVM */ -+ gTlv_type = ptlv_header->tlv_type; -+ gtlv_dwndcfg = ptlv_header->tlv.patch.dwnd_cfg; -+ -+ if (ptlv_header->tlv_type == TLV_TYPE_PATCH) { -+ PR_INFO("====================================================\n"); -+ PR_INFO("TLV Type : 0x%x\n", ptlv_header->tlv_type); -+ PR_INFO("Length : %d bytes\n", (ptlv_header->tlv_length1) | -+ (ptlv_header->tlv_length2 << 8) | -+ (ptlv_header->tlv_length3 << 16)); -+ PR_INFO("Total Length : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len); -+ PR_INFO("Patch Data Length : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); -+ PR_INFO("Signing Format Version : 0x%x\n", ptlv_header->tlv.patch.sign_ver); -+ PR_INFO("Signature Algorithm : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); -+ PR_INFO("Event Handling : 0x%x\n", ptlv_header->tlv.patch.dwnd_cfg); -+ PR_INFO("Reserved : 0x%x\n", ptlv_header->tlv.patch.reserved1); -+ PR_INFO("Product ID : 0x%04x\n", ptlv_header->tlv.patch.prod_id); -+ PR_INFO("Rom Build Version : 0x%04x\n", ptlv_header->tlv.patch.build_ver); -+ PR_INFO("Patch Version : 0x%04x\n", ptlv_header->tlv.patch.patch_ver); -+ PR_INFO("Reserved : 0x%x\n", ptlv_header->tlv.patch.reserved2); -+ PR_INFO("Patch Entry Address : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr)); -+ PR_INFO("====================================================\n"); -+ -+ } else if (ptlv_header->tlv_type == TLV_TYPE_NVM) { -+ PR_INFO("====================================================\n"); -+ PR_INFO("TLV Type : 0x%x\n", ptlv_header->tlv_type); -+ PR_INFO("Length : %d bytes\n", nvm_length = -+ (ptlv_header->tlv_length1) | -+ (ptlv_header->tlv_length2 << 8) | -+ (ptlv_header->tlv_length3 << 16)); -+ -+ if (nvm_length <= 0) -+ return readSize; -+ -+ for(nvm_byte_ptr=(unsigned char *)(nvm_ptr = &(ptlv_header->tlv.nvm)), nvm_index=0; -+ nvm_index < nvm_length ; nvm_ptr = (tlv_nvm_hdr *) nvm_byte_ptr) { -+ PR_DBG("TAG ID\t\t\t : %d\n", nvm_ptr->tag_id); -+ PR_DBG("TAG Length\t\t\t : %d\n", nvm_tag_len = nvm_ptr->tag_len); -+ PR_DBG("TAG Pointer\t\t\t : %d\n", nvm_ptr->tag_ptr); -+ PR_DBG("TAG Extended Flag\t\t : %d\n", nvm_ptr->tag_ex_flag); -+ -+ /* Increase nvm_index to NVM data */ -+ nvm_index+=sizeof(tlv_nvm_hdr); -+ nvm_byte_ptr+=sizeof(tlv_nvm_hdr); -+ -+#ifndef MODULE_HAS_MAC_ADDR -+ /* Write BD Address */ -+ if (nvm_ptr->tag_id == TAG_NUM_2 && read_bd_address(bdaddr) == 0) { -+ memcpy(nvm_byte_ptr, bdaddr, 6); -+ PR_INFO("Overriding default BD ADDR with user" -+ " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n", -+ *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), -+ *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); -+ } -+#else -+ /* Remove it from NVM data */ -+ if (nvm_ptr->tag_id == TAG_NUM_2) { -+ int nvm_size = nvm_ptr->tag_len + sizeof(tlv_nvm_hdr); -+ PR_INFO("Skip BD Address from NVM\n"); -+ nvm_index += nvm_ptr->tag_len; -+ nvm_byte_ptr += nvm_ptr->tag_len; -+ memmove(nvm_ptr, nvm_byte_ptr, nvm_length - nvm_index); -+ nvm_length -= nvm_size; -+ nvm_byte_ptr -= nvm_size; -+ readSize -= nvm_size; -+ nvm_index -= nvm_size; -+ continue; -+ } -+#endif -+ -+ if (nvm_ptr->tag_id == TAG_NUM_17) { -+ PR_DBG("Forcing IBS to be disabled\n"); -+ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] &= -+ (~(FWCONF_IBS_ENABLE << FWCONF_IBS_VAL_BIT)); -+ if (baud_rate != nvm_byte_ptr[FWCONF_BAUD_VAL_OFFSET]) { -+ PR_INFO("Change Vendor Baud from 0x%02x to 0x%02x\n", -+ nvm_byte_ptr[FWCONF_BAUD_VAL_OFFSET], baud_rate); -+ nvm_byte_ptr[FWCONF_BAUD_VAL_OFFSET] = baud_rate; -+ } -+ } -+ -+ if (nvm_ptr->tag_id == TAG_NUM_27) { -+ if ((deep_sleep_value = -+ get_value_from_config(FW_CONFIG_FILE_PATH, "DEEP_SLEEP")) >= 0) { -+ if (deep_sleep_value == FWCONF_DEEP_SLEEP_DISABLE) { -+ nvm_byte_ptr[FWCONF_DEEP_SLEEP_BYTE_OFFSET] &= -+ (~(1 << FWCONF_DEEP_SLEEP_BIT_OFFSET)); -+ } else if (deep_sleep_value == FWCONF_DEEP_SLEEP_ENABLE) { -+ nvm_byte_ptr[FWCONF_DEEP_SLEEP_BYTE_OFFSET] |= -+ (1 << FWCONF_DEEP_SLEEP_BIT_OFFSET); -+ } else { -+ fprintf(stderr, "Ignoring invalid deep sleep config value\n"); -+ } -+ } -+ } -+ -+ /* Read from file and check what PCM Configuration is required: -+ * Master = 0 /Slave = 1 */ -+ /* Override PCM configuration */ -+ if (nvm_ptr->tag_id == TAG_NUM_44) { -+ if ((pcm_value = -+ get_value_from_config(FW_CONFIG_FILE_PATH, "PCM")) >= 0) { -+ -+ if (pcm_value == FWCONF_PCM_SLAVE) { -+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] |= -+ (1 << FWCONF_PCM_ROLE_BIT_OFFSET); -+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] |= -+ (1 << FWCONF_PCM_ROLE_BIT_OFFSET); -+ } else if (pcm_value == FWCONF_PCM_MASTER) { -+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] &= -+ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET)); -+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] &= -+ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET)); -+ } -+ } -+ } -+ -+ for(i =0;(itag_len && (i*3 + 2) < PRINT_BUF_SIZE);i++) -+ snprintf((char *) data_buf, PRINT_BUF_SIZE, "%s%.02x ", -+ (char *)data_buf, *(nvm_byte_ptr + i)); -+ -+ PR_DBG("TAG Data\t\t\t : %s\n", data_buf); -+ -+ /* Clear buffer */ -+ memset(data_buf, 0x0, PRINT_BUF_SIZE); -+ -+ /* increased by tag_len */ -+ nvm_index+=nvm_ptr->tag_len; -+ nvm_byte_ptr +=nvm_ptr->tag_len; -+ } -+ -+ PR_INFO("====================================================\n"); -+ -+ } else { -+ fprintf(stderr, "TLV Header type is unknown (%d) \n", ptlv_header->tlv_type); -+ } -+ -+ return readSize; -+} -+ -+int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc_evt) -+{ -+ int size=0, err = -1; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+ /* Frame the HCI CMD PKT to be sent to Controller*/ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ -+ /* Initialize the RSP packet everytime to 0 */ -+ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if (err != size) { -+ fprintf(stderr, "Failed to send the patch payload to the Controller! 0x%x\n", err); -+ return err; -+ } -+ -+ if (wait_cc_evt) { -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if (err < 0) { -+ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", __FUNCTION__, index); -+ return err; -+ } -+ } -+ -+ return err; -+} -+ -+int rome_tlv_dnld_req(int fd, int tlv_size) -+{ -+ int total_segment, remain_size, i, err = -1; -+ unsigned char wait_cc_evt = FALSE; -+ unsigned int rom = rome_ver >> 16; -+ -+ total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; -+ remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\ -+ tlv_size: (tlv_size%MAX_SIZE_PER_TLV_SEGMENT); -+ -+ if (gTlv_type == TLV_TYPE_PATCH) { -+ /* Prior to Rome version 3.2(including inital few rampatch release of -+ * Rome 3.2), the event handling mechanism is ROME_SKIP_EVT_NONE. After -+ * few release of rampatch for Rome 3.2, the mechamism is changed to -+ * ROME_SKIP_EVT_VSE_CC. Rest of the mechanism is not used for now -+ */ -+ switch (gtlv_dwndcfg) -+ { -+ case ROME_SKIP_EVT_NONE: -+ wait_vsc_evt = TRUE; -+ wait_cc_evt = TRUE; -+ PR_DBG("%s: Event handling type: ROME_SKIP_EVT_NONE", __func__); -+ break; -+ case ROME_SKIP_EVT_VSE_CC: -+ wait_vsc_evt = FALSE; -+ wait_cc_evt = FALSE; -+ PR_DBG("%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__); -+ break; -+ /* Not handled for now */ -+ case ROME_SKIP_EVT_VSE: -+ case ROME_SKIP_EVT_CC: -+ default: -+ fprintf(stderr, "%s: Unsupported Event handling: %d", __func__, gtlv_dwndcfg); -+ break; -+ } -+ } else { -+ wait_vsc_evt = TRUE; -+ wait_cc_evt = TRUE; -+ } -+ -+ for(i = 0; i < total_segment; i++) { -+ if ((i+1) == total_segment) { -+ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) && -+ (gTlv_type == TLV_TYPE_PATCH)) { -+ /* If the Rome version is from 1.1 to 3.1 -+ * 1. No CCE for the last command segment but all other segment -+ * 2. All the command segments get VSE including the last one -+ */ -+ wait_cc_evt = !remain_size ? FALSE: TRUE; -+ } else if ((rom == ROME_PATCH_VER_0302) && -+ (gTlv_type == TLV_TYPE_PATCH)) { -+ /* If the Rome version is 3.2 -+ * 1. None of the command segments receive CCE -+ * 2. No command segments receive VSE except the last one -+ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is -+ * same as Rome 2.1, 2.2, 3.0 -+ */ -+ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) { -+ wait_cc_evt = !remain_size ? FALSE: TRUE; -+ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) { -+ wait_vsc_evt = !remain_size ? TRUE: FALSE; -+ } -+ } -+ } -+ -+ if ((err = rome_tlv_dnld_segment(fd, i, MAX_SIZE_PER_TLV_SEGMENT, wait_cc_evt )) < 0) -+ goto error; -+ } -+ -+ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) && -+ (gTlv_type == TLV_TYPE_PATCH)) { -+ /* If the Rome version is from 1.1 to 3.1 -+ * 1. No CCE for the last command segment but all other segment -+ * 2. All the command segments get VSE including the last one -+ */ -+ wait_cc_evt = remain_size ? FALSE: TRUE; -+ } else if ((rom == ROME_PATCH_VER_0302) && (gTlv_type == TLV_TYPE_PATCH)) { -+ /* If the Rome version is 3.2 -+ * 1. None of the command segments receive CCE -+ * 2. No command segments receive VSE except the last one -+ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is -+ * same as Rome 2.1, 2.2, 3.0 -+ */ -+ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) { -+ wait_cc_evt = remain_size ? FALSE: TRUE; -+ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) { -+ wait_vsc_evt = remain_size ? TRUE: FALSE; -+ } -+ } -+ -+ if (remain_size) err =rome_tlv_dnld_segment(fd, i, remain_size, wait_cc_evt); -+ -+error: -+ return err; -+} -+ -+int rome_download_tlv_file(int fd, unsigned char baud_rate) -+{ -+ int tlv_size, err = -1; -+ -+ /* Rampatch TLV file Downloading */ -+ pdata_buffer = NULL; -+ -+ if ((tlv_size = rome_get_tlv_file(rampatch_file_path, baud_rate)) < 0) -+ goto error; -+ -+ if ((err = rome_tlv_dnld_req(fd, tlv_size)) < 0) -+ goto error; -+ -+ if (pdata_buffer != NULL) { -+ free (pdata_buffer); -+ pdata_buffer = NULL; -+ } -+ -+ /* NVM TLV file Downloading */ -+ if ((tlv_size = rome_get_tlv_file(nvm_file_path, baud_rate)) < 0) -+ goto error; -+ -+ if ((err = rome_tlv_dnld_req(fd, tlv_size)) < 0) -+ goto error; -+ -+error: -+ if (pdata_buffer != NULL) -+ free (pdata_buffer); -+ -+ return err; -+} -+ -+int rome_1_0_nvm_tag_dnld(int fd) -+{ -+ int i, size, err = 0; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+#if (NVM_VERSION >= ROME_1_0_100019) -+ unsigned char cmds[MAX_TAG_CMD][HCI_MAX_CMD_SIZE] = -+ { -+ /* Tag 2 */ /* BD Address */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 9, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 2, -+ /* Tag Len */ 6, -+ /* Tag Value */ 0x77,0x78,0x23,0x01,0x56,0x22 -+ }, -+ /* Tag 6 */ /* Bluetooth Support Features */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 11, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 6, -+ /* Tag Len */ 8, -+ /* Tag Value */ 0xFF,0xFE,0x8B,0xFE,0xD8,0x3F,0x5B,0x8B -+ }, -+ /* Tag 17 */ /* HCI Transport Layer Setting */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 11, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 17, -+ /* Tag Len */ 8, -+ /* Tag Value */ 0x82,0x01,0x0E,0x08,0x04,0x32,0x0A,0x00 -+ }, -+ /* Tag 35 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 58, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 35, -+ /* Tag Len */ 55, -+ /* Tag Value */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x58, 0x59, -+ 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E, 0x26, 0x5F, 0x2F, 0x5F, -+ 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E, 0x26, 0x5F, 0x2F, 0x5F, -+ 0x0C, 0x18, 0x14, 0x24, 0x40, 0x4C, 0x70, 0x80, 0x80, 0x80, -+ 0x0C, 0x18, 0x14, 0x24, 0x40, 0x4C, 0x70, 0x80, 0x80, 0x80, -+ 0x1B, 0x14, 0x01, 0x04, 0x48 -+ }, -+ /* Tag 36 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 15, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 36, -+ /* Tag Len */ 12, -+ /* Tag Value */ 0x0F,0x00,0x03,0x03,0x03,0x03,0x00,0x00,0x03,0x03,0x04,0x00 -+ }, -+ /* Tag 39 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 7, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 39, -+ /* Tag Len */ 4, -+ /* Tag Value */ 0x12,0x00,0x00,0x00 -+ }, -+ /* Tag 41 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 91, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 41, -+ /* Tag Len */ 88, -+ /* Tag Value */ 0x15, 0x00, 0x00, 0x00, 0xF6, 0x02, 0x00, 0x00, 0x76, 0x00, -+ 0x1E, 0x00, 0x29, 0x02, 0x1F, 0x00, 0x61, 0x00, 0x1A, 0x00, -+ 0x76, 0x00, 0x1E, 0x00, 0x7D, 0x00, 0x40, 0x00, 0x91, 0x00, -+ 0x06, 0x00, 0x92, 0x00, 0x03, 0x00, 0xA6, 0x01, 0x50, 0x00, -+ 0xAA, 0x01, 0x15, 0x00, 0xAB, 0x01, 0x0A, 0x00, 0xAC, 0x01, -+ 0x00, 0x00, 0xB0, 0x01, 0xC5, 0x00, 0xB3, 0x01, 0x03, 0x00, -+ 0xB4, 0x01, 0x13, 0x00, 0xB5, 0x01, 0x0C, 0x00, 0xC5, 0x01, -+ 0x0D, 0x00, 0xC6, 0x01, 0x10, 0x00, 0xCA, 0x01, 0x2B, 0x00, -+ 0xCB, 0x01, 0x5F, 0x00, 0xCC, 0x01, 0x48, 0x00 -+ }, -+ /* Tag 42 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 63, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 42, -+ /* Tag Len */ 60, -+ /* Tag Value */ 0xD7, 0xC0, 0x00, 0x00, 0x8F, 0x5C, 0x02, 0x00, 0x80, 0x47, -+ 0x60, 0x0C, 0x70, 0x4C, 0x00, 0x00, 0x00, 0x01, 0x1F, 0x01, -+ 0x42, 0x01, 0x69, 0x01, 0x95, 0x01, 0xC7, 0x01, 0xFE, 0x01, -+ 0x3D, 0x02, 0x83, 0x02, 0xD1, 0x02, 0x29, 0x03, 0x00, 0x0A, -+ 0x10, 0x00, 0x1F, 0x00, 0x3F, 0x00, 0x7F, 0x00, 0xFD, 0x00, -+ 0xF9, 0x01, 0xF1, 0x03, 0xDE, 0x07, 0x00, 0x00, 0x9A, 0x01 -+ }, -+ /* Tag 84 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 153, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 84, -+ /* Tag Len */ 150, -+ /* Tag Value */ 0x7C, 0x6A, 0x59, 0x47, 0x19, 0x36, 0x35, 0x25, 0x25, 0x28, -+ 0x2C, 0x2B, 0x2B, 0x28, 0x2C, 0x28, 0x29, 0x28, 0x29, 0x28, -+ 0x29, 0x29, 0x2C, 0x29, 0x2C, 0x29, 0x2C, 0x28, 0x29, 0x28, -+ 0x29, 0x28, 0x29, 0x2A, 0x00, 0x00, 0x2C, 0x2A, 0x2C, 0x18, -+ 0x98, 0x98, 0x98, 0x98, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, -+ 0x1E, 0x13, 0x1E, 0x1E, 0x1E, 0x1E, 0x13, 0x13, 0x11, 0x13, -+ 0x1E, 0x1E, 0x13, 0x12, 0x12, 0x12, 0x11, 0x12, 0x1F, 0x12, -+ 0x12, 0x12, 0x10, 0x0C, 0x18, 0x0D, 0x01, 0x01, 0x01, 0x01, -+ 0x01, 0x01, 0x01, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x0D, 0x0D, -+ 0x0E, 0x0D, 0x01, 0x01, 0x0D, 0x0D, 0x0D, 0x0D, 0x0F, 0x0D, -+ 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x05, 0x10, 0x03, 0x00, -+ 0x7E, 0x7B, 0x7B, 0x72, 0x71, 0x50, 0x50, 0x50, 0x00, 0x40, -+ 0x60, 0x60, 0x30, 0x08, 0x02, 0x0F, 0x00, 0x01, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x16, 0x16, 0x08, 0x08, 0x00, -+ 0x00, 0x00, 0x1E, 0x34, 0x2B, 0x1B, 0x23, 0x2B, 0x15, 0x0D -+ }, -+ /* Tag 85 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 119, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 85, -+ /* Tag Len */ 116, -+ /* Tag Value */ 0x03, 0x00, 0x38, 0x00, 0x45, 0x77, 0x00, 0xE8, 0x00, 0x59, -+ 0x01, 0xCA, 0x01, 0x3B, 0x02, 0xAC, 0x02, 0x1D, 0x03, 0x8E, -+ 0x03, 0x00, 0x89, 0x01, 0x0E, 0x02, 0x5C, 0x02, 0xD7, 0x02, -+ 0xF8, 0x08, 0x01, 0x00, 0x1F, 0x00, 0x0A, 0x02, 0x55, 0x02, -+ 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x2A, 0xD7, 0x00, 0x00, -+ 0x00, 0x1E, 0xDE, 0x00, 0x00, 0x00, 0x14, 0x0F, 0x0A, 0x0F, -+ 0x0A, 0x0C, 0x0C, 0x0C, 0x0C, 0x04, 0x04, 0x04, 0x0C, 0x0C, -+ 0x0C, 0x0C, 0x06, 0x06, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, -+ 0x01, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, -+ 0x06, 0x0F, 0x14, 0x05, 0x47, 0xCF, 0x77, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0xAC, 0x7C, 0xFF, 0x40, 0x00, 0x00, 0x00, -+ 0x12, 0x04, 0x04, 0x01, 0x04, 0x03 -+ }, -+ {TAG_END} -+ }; -+#elif (NVM_VERSION == ROME_1_0_6002) -+ unsigned char cmds[MAX_TAG_CMD][HCI_MAX_CMD_SIZE] = -+ { -+ /* Tag 2 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 9, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 2, -+ /* Tag Len */ 6, -+ /* Tag Value */ 0x77,0x78,0x23,0x01,0x56,0x22 /* BD Address */ -+ }, -+ /* Tag 6 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 11, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 6, -+ /* Tag Len */ 8, -+ /* Tag Value */ 0xFF,0xFE,0x8B,0xFE,0xD8,0x3F,0x5B,0x8B -+ }, -+ /* Tag 17 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 11, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 17, -+ /* Tag Len */ 8, -+ /* Tag Value */ 0x82,0x01,0x0E,0x08,0x04,0x32,0x0A,0x00 -+ }, -+ /* Tag 36 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 15, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 36, -+ /* Tag Len */ 12, -+ /* Tag Value */ 0x0F,0x00,0x03,0x03,0x03,0x03,0x00,0x00,0x03,0x03,0x04,0x00 -+ }, -+ -+ /* Tag 39 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 7, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 39, -+ /* Tag Len */ 4, -+ /* Tag Value */ 0x12,0x00,0x00,0x00 -+ }, -+ -+ /* Tag 41 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 199, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 41, -+ /* Tag Len */ 196, -+ /* Tag Value */ 0x30,0x00,0x00,0x00,0xD5,0x00,0x0E,0x00,0xD6,0x00,0x0E,0x00, -+ 0xD7,0x00,0x16,0x00,0xD8,0x00,0x16,0x00,0xD9,0x00,0x16,0x00, -+ 0xDA,0x00,0x1E,0x00,0xDB,0x00,0x26,0x00,0xDC,0x00,0x5F,0x00, -+ 0xDD,0x00,0x2F,0x00,0xDE,0x00,0x5F,0x00,0xE0,0x00,0x0E,0x00, -+ 0xE1,0x00,0x0E,0x00,0xE2,0x00,0x16,0x00,0xE3,0x00,0x16,0x00, -+ 0xE4,0x00,0x16,0x00,0xE5,0x00,0x1E,0x00,0xE6,0x00,0x26,0x00, -+ 0xE7,0x00,0x5F,0x00,0xE8,0x00,0x2F,0x00,0xE9,0x00,0x5F,0x00, -+ 0xEC,0x00,0x0C,0x00,0xED,0x00,0x08,0x00,0xEE,0x00,0x14,0x00, -+ 0xEF,0x00,0x24,0x00,0xF0,0x00,0x40,0x00,0xF1,0x00,0x4C,0x00, -+ 0xF2,0x00,0x70,0x00,0xF3,0x00,0x80,0x00,0xF4,0x00,0x80,0x00, -+ 0xF5,0x00,0x80,0x00,0xF8,0x00,0x0C,0x00,0xF9,0x00,0x18,0x00, -+ 0xFA,0x00,0x14,0x00,0xFB,0x00,0x24,0x00,0xFC,0x00,0x40,0x00, -+ 0xFD,0x00,0x4C,0x00,0xFE,0x00,0x70,0x00,0xFF,0x00,0x80,0x00, -+ 0x00,0x01,0x80,0x00,0x01,0x01,0x80,0x00,0x04,0x01,0x1B,0x00, -+ 0x05,0x01,0x14,0x00,0x06,0x01,0x01,0x00,0x07,0x01,0x04,0x00, -+ 0x08,0x01,0x00,0x00,0x09,0x01,0x00,0x00,0x0A,0x01,0x03,0x00, -+ 0x0B,0x01,0x03,0x00 -+ }, -+ -+ /* Tag 44 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 44, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 44, -+ /* Tag Len */ 41, -+ /* Tag Value */ 0x6F,0x0A,0x00,0x00,0x00,0x00,0x00,0x50,0xFF,0x10,0x02,0x02, -+ 0x01,0x00,0x14,0x01,0x06,0x28,0xA0,0x62,0x03,0x64,0x01,0x01, -+ 0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0xFF,0x10,0x02,0x01, -+ 0x00,0x14,0x01,0x02,0x03 -+ }, -+ {TAG_END} -+ }; -+#endif -+ -+ for (i=0; (i < MAX_TAG_CMD) && (cmds[i][0] != TAG_END); i++) { -+ /* Write BD Address */ -+ if (cmds[i][TAG_NUM_OFFSET] == TAG_NUM_2){ -+ memcpy(&cmds[i][TAG_BDADDR_OFFSET], vnd_local_bd_addr, 6); -+ fprintf(stderr, "BD Address: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", -+ cmds[i][TAG_BDADDR_OFFSET ], cmds[i][TAG_BDADDR_OFFSET + 1], -+ cmds[i][TAG_BDADDR_OFFSET + 2], cmds[i][TAG_BDADDR_OFFSET + 3], -+ cmds[i][TAG_BDADDR_OFFSET + 4], cmds[i][TAG_BDADDR_OFFSET + 5]); -+ } -+ size = cmds[i][3] + HCI_COMMAND_HDR_SIZE + 1; -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)&cmds[i][0], rsp, size); -+ if (err != size) { -+ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); -+ goto error; -+ } -+ -+ /* Read Command Complete Event - This is extra routine for ROME 1.0. From ROM 2.0, it should be removed. */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if (err < 0) { -+ fprintf(stderr, "%s: Failed to get patch version(s)\n", __FUNCTION__); -+ goto error; -+ } -+ } -+ -+error: -+ return err; -+} -+ -+ -+ -+int rome_patch_ver_req(int fd) -+{ -+ int size, err = 0; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+ /* Frame the HCI CMD to be sent to the Controller */ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_VER_REQ_CMD, 0, -+ -1, EDL_PATCH_CMD_LEN); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if (err != size) { -+ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); -+ goto error; -+ } -+ -+ /* Read Command Complete Event - This is extra routine for ROME 1.0. From ROM 2.0, it should be removed. */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if (err < 0) { -+ fprintf(stderr, "%s: Failed to get patch version(s)\n", __FUNCTION__); -+ goto error; -+ } -+error: -+ return err; -+ -+} -+ -+static void flow_control(int fd, int opt) -+{ -+ struct termios c_opt; -+ -+ ioctl(fd, TIOCMGET, &c_opt); -+ c_opt.c_cc[VTIME] = 0; /* inter-character timer unused */ -+ c_opt.c_cc[VMIN] = 0; /* blocking read until 8 chars received */ -+ c_opt.c_cflag &= ~CSIZE; -+ c_opt.c_cflag |= (CS8 | CLOCAL | CREAD); -+ if (opt == MSM_ENABLE_FLOW_CTRL) -+ c_opt.c_cflag |= CRTSCTS; -+ else if (opt == MSM_DISABLE_FLOW_CTRL) -+ c_opt.c_cflag &= ~CRTSCTS; -+ else { -+ fprintf(stderr, "%s: Incorrect option passed for TIOCMSET\n", __func__); -+ return; -+ } -+ c_opt.c_iflag = IGNPAR; -+ c_opt.c_oflag = 0; -+ c_opt.c_lflag = 0; -+ ioctl(fd, TIOCMSET, &c_opt); -+} -+ -+ -+int rome_set_baudrate_req(int fd, unsigned char baud_rate) -+{ -+ int size, err = 0; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ hci_command_hdr *cmd_hdr; -+ int flags; -+ -+ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); -+ -+ cmd_hdr = (void *) (cmd + 1); -+ cmd[0] = HCI_COMMAND_PKT; -+ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); -+ cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; -+ cmd[4] = baud_rate; -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); -+ -+ /* Flow off during baudrate change */ -+ flow_control(fd, MSM_DISABLE_FLOW_CTRL); -+ -+ /* Send the HCI command packet to UART for transmission */ -+ err = write(fd, cmd, size); -+ if (err != size) { -+ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); -+ goto error; -+ } -+ /* Change Local UART baudrate to high speed UART */ -+ userial_vendor_set_baud(baud_rate); -+ -+ /* Flow on after changing local uart baudrate */ -+ flow_control(fd, MSM_ENABLE_FLOW_CTRL); -+ -+ /* Check for response from the Controller */ -+ if ((err = read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { -+ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); -+ goto error; -+ } -+ -+ /* Wait for command complete event */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if (err < 0) { -+ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); -+ goto error; -+ } -+error: -+ return err; -+ -+} -+ -+ -+int rome_hci_reset_req(int fd, char baud) -+{ -+ int size, err = 0; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ hci_command_hdr *cmd_hdr; -+ int flags; -+ -+ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); -+ -+ cmd_hdr = (void *) (cmd + 1); -+ cmd[0] = HCI_COMMAND_PKT; -+ cmd_hdr->opcode = HCI_RESET; -+ cmd_hdr->plen = 0; -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); -+ -+ /* Flow off during baudrate change */ -+ flow_control(fd, MSM_DISABLE_FLOW_CTRL); -+ -+ /* Send the HCI command packet to UART for transmission */ -+ err = write(fd, cmd, size); -+ if (err != size) { -+ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); -+ goto error; -+ } -+ -+ /* Change Local UART baudrate to high speed UART */ -+ userial_vendor_set_baud(baud); -+ -+ /* Flow on after changing local uart baudrate */ -+ flow_control(fd, MSM_ENABLE_FLOW_CTRL); -+ -+ /* Wait for command complete event */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if (err < 0) { -+ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); -+ goto error; -+ } -+ -+error: -+ return err; -+ -+} -+ -+int qca_soc_init(int fd, int speed, char *bdaddr) -+{ -+ int err = -1; -+ int ret = 0; -+ int size; -+ unsigned char baud_rate = 0; -+ -+ vnd_userial.fd = fd; -+ -+ /* Get Rome version information */ -+ if ((err = rome_patch_ver_req(fd)) < 0) { -+ fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); -+ ret = -1; -+ goto error; -+ } -+ -+ fprintf(stderr, "%s: Rome Version (0x%08x)\n", __FUNCTION__, rome_ver); -+ -+ switch (rome_ver){ -+ case ROME_VER_1_0: -+ /* Set and Download the RAMPATCH */ -+ fprintf(stderr, "%s: Setting Patch Header & Downloading Patches\n", __FUNCTION__); -+ err = rome_download_rampatch(fd); -+ if (err < 0) { -+ fprintf(stderr, "%s: DOWNLOAD RAMPATCH failed!\n", __FUNCTION__); -+ ret = -1; -+ goto error; -+ } -+ -+ /* Attach the RAMPATCH */ -+ fprintf(stderr, "%s: Attaching the patches\n", __FUNCTION__); -+ err = rome_attach_rampatch(fd); -+ if (err < 0) { -+ fprintf(stderr, "%s: ATTACH RAMPATCH failed!\n", __FUNCTION__); -+ ret = -1; -+ goto error; -+ } -+ -+ /* Send Reset */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); -+ err = rome_rampatch_reset(fd); -+ if (err < 0) { -+ fprintf(stderr, "Failed to RESET after RAMPATCH upgrade!\n"); -+ ret = -1; -+ goto error; -+ } -+ -+ /* NVM download */ -+ fprintf(stderr, "%s: Downloading NVM\n", __FUNCTION__); -+ err = rome_1_0_nvm_tag_dnld(fd); -+ if (err < 0) { -+ fprintf(stderr, "Downloading NVM Failed !!\n"); -+ ret = -1; -+ goto error; -+ } -+ -+ /* Change baud rate 115.2 kbps to 3Mbps*/ -+ err = rome_hci_reset_req(fd, baud_rate); -+ if (err < 0) { -+ fprintf(stderr, "HCI Reset Failed !!\n"); -+ ret = -1; -+ goto error; -+ } -+ break; -+ case ROME_VER_1_1: -+ rampatch_file_path = ROME_RAMPATCH_TLV_PATH; -+ nvm_file_path = ROME_NVM_TLV_PATH; -+ goto download; -+ case ROME_VER_1_3: -+ rampatch_file_path = ROME_RAMPATCH_TLV_1_0_3_PATH; -+ nvm_file_path = ROME_NVM_TLV_1_0_3_PATH; -+ goto download; -+ case ROME_VER_2_1: -+ rampatch_file_path = ROME_RAMPATCH_TLV_2_0_1_PATH; -+ nvm_file_path = ROME_NVM_TLV_2_0_1_PATH; -+ goto download; -+ case ROME_VER_3_0: -+ rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH; -+ nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; -+ goto download; -+ case ROME_VER_3_2: -+ rampatch_file_path = ROME_RAMPATCH_TLV_3_0_2_PATH; -+ nvm_file_path = ROME_NVM_TLV_3_0_2_PATH; -+ goto download; -+ case TUFELLO_VER_1_0: -+ rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH; -+ nvm_file_path = TF_NVM_TLV_1_0_0_PATH; -+ goto download; -+ case TUFELLO_VER_1_1: -+ rampatch_file_path = TF_RAMPATCH_TLV_1_0_1_PATH; -+ nvm_file_path = TF_NVM_TLV_1_0_1_PATH; -+download: -+ isSpeedValid(speed, &baud_rate); -+ if (baud_rate < 0) { -+ ret = -1; -+ goto error; -+ } -+ -+ /* Donwload TLV files (rampatch, NVM) */ -+ err = rome_download_tlv_file(fd, baud_rate); -+ if (err < 0) { -+ fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); -+ ret = -1; -+ goto error; -+ } -+ -+ /* -+ * Overriding the baud rate value in NVM file with the user -+ * requested baud rate, since default baud rate in NVM file is 3M. -+ */ -+ err = rome_set_baudrate_req(fd, baud_rate); -+ if (err < 0) { -+ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); -+ ret = -1; -+ goto error; -+ } -+ -+ /* Perform HCI reset here*/ -+ err = rome_hci_reset_req(fd, baud_rate); -+ if (err < 0) { -+ fprintf(stderr, "HCI Reset Failed !!!\n"); -+ ret = -1; -+ goto error; -+ } -+ -+ break; -+ case ROME_VER_UNKNOWN: -+ default: -+ fprintf(stderr, "%s: Detected unknown ROME version\n", __FUNCTION__); -+ ret = -1; -+ break; -+ } -+ -+error: -+ return ret; -+} -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -new file mode 100644 -index 000000000..597743e0b ---- /dev/null -+++ b/tools/hciattach_rome.h -@@ -0,0 +1,388 @@ -+/* -+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. -+ * Not a Contribution. -+ * Copyright 2012 The Android Open Source Project -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); -+ * you may not use this file except in compliance with the License. -+ * You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ */ -+#ifndef HW_ROME_H -+#define HW_ROME_H -+ -+/****************************************************************************** -+** Constants & Macros -+******************************************************************************/ -+#define HCI_MAX_CMD_SIZE 260 -+#define HCI_MAX_EVENT_SIZE 260 -+#define PRINT_BUF_SIZE ((HCI_MAX_CMD_SIZE * 3) + 2) -+/* HCI Command/Event Opcode */ -+#define HCI_RESET 0x0C03 -+#define EVT_CMD_COMPLETE 0x0E -+/* HCI Packet types */ -+#define HCI_COMMAND_PKT 0x01 -+#define HCI_ACLDATA_PKT 0x02 -+#define HCI_SCODATA_PKT 0x03 -+#define HCI_EVENT_PKT 0x04 -+#define HCI_VENDOR_PKT 0xff -+#define cmd_opcode_pack(ogf, ocf) (unsigned short)((ocf & 0x03ff)|(ogf << 10)) -+ -+#define NVITEM 0 -+#define RDWR_PROT 1 -+#define NVITEM_SIZE 2 -+#define PERSIST_HEADER_LEN 3 -+#define BD_ADDR_LEN 6 -+#define MSM_DISABLE_FLOW_CTRL 0 -+#define MSM_ENABLE_FLOW_CTRL 1 -+ -+#ifdef _PLATFORM_MDM_ -+#define USERIAL_OP_CLK_ON 0x5441 -+#define USERIAL_OP_CLK_OFF 0x5442 -+#endif -+ -+#define PR_INFO(fmt, arg...) printf(fmt, ## arg) -+#ifdef DEBUG -+ #define PR_DBG(fmt, arg...) printf(fmt, ## arg) -+#else -+ #define PR_DBG(fmt, arg...) -+#endif -+ -+unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -+typedef enum { -+ USERIAL_OP_FLOW_ON, -+ USERIAL_OP_FLOW_OFF, -+ USERIAL_OP_NOP, -+} userial_vendor_ioctl_op_t; -+ -+ -+/* vendor serial control block */ -+typedef struct -+{ -+ int fd; /* fd to Bluetooth device */ -+ struct termios termios; /* serial terminal of BT port */ -+ char port_name[256]; -+} vnd_userial_cb_t; -+ -+/**** baud rates ****/ -+#define USERIAL_BAUD_300 0 -+#define USERIAL_BAUD_600 1 -+#define USERIAL_BAUD_1200 2 -+#define USERIAL_BAUD_2400 3 -+#define USERIAL_BAUD_9600 4 -+#define USERIAL_BAUD_19200 5 -+#define USERIAL_BAUD_57600 6 -+#define USERIAL_BAUD_115200 7 -+#define USERIAL_BAUD_230400 8 -+#define USERIAL_BAUD_460800 9 -+#define USERIAL_BAUD_921600 10 -+#define USERIAL_BAUD_1M 11 -+#define USERIAL_BAUD_1_5M 12 -+#define USERIAL_BAUD_2M 13 -+#define USERIAL_BAUD_3M 14 -+#define USERIAL_BAUD_4M 15 -+#define USERIAL_BAUD_AUTO 16 -+ -+#ifndef FALSE -+#define FALSE 0 -+#endif -+ -+#ifndef TRUE -+#define TRUE (!FALSE) -+#endif -+ -+#define HCI_CHG_BAUD_CMD_OCF 0x0C -+#define HCI_VENDOR_CMD_OGF 0x3F -+#define WRITE_BDADDR_CMD_LEN 14 -+#define WRITE_BAUD_CMD_LEN 6 -+#define MAX_CMD_LEN WRITE_BDADDR_CMD_LEN -+#define GET_VERSION_OCF 0x1E -+ -+#define PS_HDR_LEN 4 -+#define HCI_VENDOR_CMD_OGF 0x3F -+#define HCI_PS_CMD_OCF 0x0B -+ -+#define HCI_COMMAND_HDR_SIZE 3 -+#define EVT_CMD_COMPLETE_SIZE 3 -+#define EVT_CMD_STATUS 0x0F -+#define EVT_CMD_STATUS_SIZE 4 -+#define HCI_EVENT_HDR_SIZE 2 -+#define HCI_EV_SUCCESS 0x00 -+/* HCI Socket options */ -+#define HCI_DATA_DIR 1 -+#define HCI_FILTER 2 -+#define HCI_TIME_STAMP 3 -+ -+#define P_ID_OFFSET (0) -+#define HCI_CMD_IND (1) -+#define EVENTCODE_OFFSET (1) -+#define EVT_PLEN (2) -+#define PLEN (3) -+#define CMD_RSP_OFFSET (3) -+#define RSP_TYPE_OFFSET (4) -+#define BAUDRATE_RSP_STATUS_OFFSET (4) -+#define CMD_STATUS_OFFSET (5) -+#define P_ROME_VER_OFFSET (4) -+#define P_BUILD_VER_OFFSET (6) -+#define P_BASE_ADDR_OFFSET (8) -+#define P_ENTRY_ADDR_OFFSET (12) -+#define P_LEN_OFFSET (16) -+#define P_CRC_OFFSET (20) -+#define P_CONTROL_OFFSET (24) -+#define PATCH_HDR_LEN (28) -+#define MAX_DATA_PER_SEGMENT (239) -+#define VSEVENT_CODE (0xFF) -+#define HC_VS_MAX_CMD_EVENT (0xFF) -+#define PATCH_PROD_ID_OFFSET (5) -+#define PATCH_PATCH_VER_OFFSET (9) -+#define PATCH_ROM_BUILD_VER_OFFSET (11) -+#define PATCH_SOC_VER_OFFSET (13) -+#define MAX_SIZE_PER_TLV_SEGMENT (243) -+ -+/* VS Opcode */ -+#define HCI_PATCH_CMD_OCF (0) -+#define EDL_SET_BAUDRATE_CMD_OCF (0x48) -+ -+/* VS Commands */ -+#define VSC_SET_BAUDRATE_REQ_LEN (1) -+#define EDL_PATCH_CMD_LEN (1) -+#define EDL_PATCH_CMD_REQ_LEN (1) -+#define EDL_PATCH_DLD_REQ_CMD (0x01) -+#define EDL_PATCH_RST_REQ_CMD (0x05) -+#define EDL_PATCH_SET_REQ_CMD (0x16) -+#define EDL_PATCH_ATCH_REQ_CMD (0x17) -+#define EDL_PATCH_VER_REQ_CMD (0x19) -+#define EDL_PATCH_TLV_REQ_CMD (0x1E) -+#define VSC_DISABLE_IBS_LEN (0x04) -+ -+/* VS Event */ -+#define EDL_CMD_REQ_RES_EVT (0x00) -+#define EDL_CMD_EXE_STATUS_EVT (0x00) -+#define EDL_SET_BAUDRATE_RSP_EVT (0x92) -+#define EDL_PATCH_VER_RES_EVT (0x19) -+#define EDL_TVL_DNLD_RES_EVT (0x04) -+#define EDL_APP_VER_RES_EVT (0x02) -+ -+/* Status Codes of HCI CMD execution*/ -+#define HCI_CMD_SUCCESS (0x0) -+#define PATCH_LEN_ERROR (0x1) -+#define PATCH_VER_ERROR (0x2) -+#define PATCH_CRC_ERROR (0x3) -+#define PATCH_NOT_FOUND (0x4) -+#define TLV_TYPE_ERROR (0x10) -+#define NVM_ACCESS_CODE (0x0B) -+#define BAUDRATE_CHANGE_SUCCESS (1) -+ -+/* TLV_TYPE */ -+#define TLV_TYPE_PATCH (1) -+#define TLV_TYPE_NVM (2) -+ -+/* NVM */ -+#define MAX_TAG_CMD 30 -+#define TAG_END 0xFF -+#define NVM_ACCESS_SET 0x01 -+#define TAG_NUM_OFFSET 5 -+#define TAG_NUM_2 2 -+#define TAG_NUM_17 (17) -+#define TAG_NUM_27 27 -+#define TAG_NUM_44 44 -+#define TAG_BDADDR_OFFSET 7 -+ -+/* FW PCM Configuration */ -+#define FWCONF_PCM_MS_OFFSET_1 9 -+#define FWCONF_PCM_MS_OFFSET_2 33 -+#define FWCONF_PCM_SLAVE 1 -+#define FWCONF_PCM_MASTER 0 -+#define FWCONF_PCM_ROLE_BIT_OFFSET 4 -+ -+/* FW HCI Transport Layer Configuration */ -+#define FWCONF_IBS_DISABLE (0) -+#define FWCONF_IBS_ENABLE (1) -+#define FWCONF_IBS_VAL_BIT (7) -+#define FWCONF_IBS_VAL_OFFSET (0) -+#define FWCONF_BAUD_VAL_OFFSET (2) -+ -+/* FW DEEP SLEEP Configuration */ -+#define FWCONF_DEEP_SLEEP_DISABLE 0 -+#define FWCONF_DEEP_SLEEP_ENABLE 1 -+#define FWCONF_DEEP_SLEEP_BYTE_OFFSET 0 -+#define FWCONF_DEEP_SLEEP_BIT_OFFSET 0 -+ -+#define MAX_RETRY_CNT 1 -+#define SELECT_TIMEOUT 3 -+ -+/* NVM Tags specifically used for ROME 1.0 */ -+#define ROME_1_0_100022_1 0x101000221 -+#define ROME_1_0_100019 0x101000190 -+#define ROME_1_0_6002 0x100600200 -+ -+/* Default NVM Version setting for ROME 1.0 */ -+#define NVM_VERSION ROME_1_0_100022_1 -+ -+ -+#define LSH(val, n) ((unsigned int)(val) << (n)) -+#define EXTRACT_BYTE(val, pos) (char) (((val) >> (8 * (pos))) & 0xFF) -+#define CALC_SEG_SIZE(len, max) ((plen) % (max))?((plen/max)+1) : ((plen) / (max)) -+ -+#define ROME_FW_PATH "/lib/firmware/rampatch.img" -+#define ROME_RAMPATCH_TLV_PATH "/lib/firmware/rampatch_tlv.img" -+#define ROME_NVM_TLV_PATH "/lib/firmware/nvm_tlv.bin" -+#define ROME_RAMPATCH_TLV_1_0_3_PATH "/lib/firmware/rampatch_tlv_1.3.tlv" -+#define ROME_NVM_TLV_1_0_3_PATH "/lib/firmware/nvm_tlv_1.3.bin" -+#define ROME_RAMPATCH_TLV_2_0_1_PATH "/lib/firmware/rampatch_tlv_2.1.tlv" -+#define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin" -+#define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/rampatch_tlv_3.0.tlv" -+#define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/nvm_tlv_3.0.bin" -+#define ROME_RAMPATCH_TLV_3_0_2_PATH "/lib/firmware/btfw32.tlv" -+#define ROME_NVM_TLV_3_0_2_PATH "/lib/firmware/btnv32.bin" -+#ifdef _PLATFORM_MDM_ -+#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv" -+#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin" -+#define TF_RAMPATCH_TLV_1_0_1_PATH "/lib/firmware/tfbtfw11.tlv" -+#define TF_NVM_TLV_1_0_1_PATH "/lib/firmware/tfbtnv11.bin" -+#else -+#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.0.tlv" -+#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/qca/nvm_tlv_tf_1.0.bin" -+#define TF_RAMPATCH_TLV_1_0_1_PATH "/lib/firmware/qca/tfbtfw11.tlv" -+#define TF_NVM_TLV_1_0_1_PATH "/lib/firmware/qca/tfbtnv11.bin" -+#endif -+ -+/* This header value in rampatch file decides event handling mechanism in the HOST */ -+#define ROME_SKIP_EVT_NONE 0x00 -+#define ROME_SKIP_EVT_VSE 0x01 -+#define ROME_SKIP_EVT_CC 0x02 -+#define ROME_SKIP_EVT_VSE_CC 0x03 -+ -+#define FW_CONFIG_FILE_PATH "/etc/bluetooth/firmware.conf" -+/****************************************************************************** -+** Local type definitions -+******************************************************************************/ -+ -+typedef struct { -+ unsigned char ncmd; -+ unsigned short opcode; -+} __attribute__ ((packed)) evt_cmd_complete; -+ -+typedef struct { -+ unsigned char status; -+ unsigned char ncmd; -+ unsigned short opcode; -+} __attribute__ ((packed)) evt_cmd_status; -+ -+typedef struct { -+ unsigned short opcode; -+ unsigned char plen; -+} __attribute__ ((packed)) hci_command_hdr; -+ -+typedef struct { -+ unsigned char evt; -+ unsigned char plen; -+} __attribute__ ((packed)) hci_event_hdr; -+typedef struct { -+ unsigned short rom_version; -+ unsigned short build_version; -+} __attribute__ ((packed)) patch_version; -+ -+typedef struct { -+ unsigned int patch_id; -+ patch_version patch_ver; -+ unsigned int patch_base_addr; -+ unsigned int patch_entry_addr; -+ unsigned short patch_length; -+ int patch_crc; -+ unsigned short patch_ctrl; -+} __attribute__ ((packed)) patch_info; -+ -+typedef struct { -+ unsigned int tlv_data_len; -+ unsigned int tlv_patch_data_len; -+ unsigned char sign_ver; -+ unsigned char sign_algorithm; -+ unsigned char dwnd_cfg; -+ unsigned char reserved1; -+ unsigned short prod_id; -+ unsigned short build_ver; -+ unsigned short patch_ver; -+ unsigned short reserved2; -+ unsigned int patch_entry_addr; -+} __attribute__ ((packed)) tlv_patch_hdr; -+ -+typedef struct { -+ unsigned short tag_id; -+ unsigned short tag_len; -+ unsigned int tag_ptr; -+ unsigned int tag_ex_flag; -+} __attribute__ ((packed)) tlv_nvm_hdr; -+ -+typedef struct { -+ unsigned char tlv_type; -+ unsigned char tlv_length1; -+ unsigned char tlv_length2; -+ unsigned char tlv_length3; -+ -+ union{ -+ tlv_patch_hdr patch; -+ tlv_nvm_hdr nvm; -+ }tlv; -+} __attribute__ ((packed)) tlv_patch_info; -+ -+enum{ -+ BAUDRATE_115200 = 0x00, -+ BAUDRATE_57600 = 0x01, -+ BAUDRATE_38400 = 0x02, -+ BAUDRATE_19200 = 0x03, -+ BAUDRATE_9600 = 0x04, -+ BAUDRATE_230400 = 0x05, -+ BAUDRATE_250000 = 0x06, -+ BAUDRATE_460800 = 0x07, -+ BAUDRATE_500000 = 0x08, -+ BAUDRATE_720000 = 0x09, -+ BAUDRATE_921600 = 0x0A, -+ BAUDRATE_1000000 = 0x0B, -+ BAUDRATE_1250000 = 0x0C, -+ BAUDRATE_2000000 = 0x0D, -+ BAUDRATE_3000000 = 0x0E, -+ BAUDRATE_4000000 = 0x0F, -+ BAUDRATE_1600000 = 0x10, -+ BAUDRATE_3200000 = 0x11, -+ BAUDRATE_3500000 = 0x12, -+ BAUDRATE_AUTO = 0xFE, -+ BAUDRATE_Reserved = 0xFF -+}; -+ -+enum{ -+ ROME_PATCH_VER_0100 = 0x0100, -+ ROME_PATCH_VER_0101 = 0x0101, -+ ROME_PATCH_VER_0200 = 0x0200, -+ ROME_PATCH_VER_0300 = 0x0300, -+ ROME_PATCH_VER_0302 = 0x0302 -+ }; -+ -+enum{ -+ ROME_SOC_ID_00 = 0x00000000, -+ ROME_SOC_ID_11 = 0x00000011, -+ ROME_SOC_ID_13 = 0x00000013, -+ ROME_SOC_ID_22 = 0x00000022, -+ ROME_SOC_ID_23 = 0x00000023, -+ ROME_SOC_ID_44 = 0x00000044 -+}; -+ -+enum{ -+ ROME_VER_UNKNOWN = 0, -+ ROME_VER_1_0 = ((ROME_PATCH_VER_0100 << 16 ) | ROME_SOC_ID_00 ), -+ ROME_VER_1_1 = ((ROME_PATCH_VER_0101 << 16 ) | ROME_SOC_ID_00 ), -+ ROME_VER_1_3 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_00 ), -+ ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ), -+ ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ), -+ ROME_VER_3_2 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_44 ), -+ TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ), -+ TUFELLO_VER_1_1 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_23 ) -+}; -+#endif /* HW_ROME_H */ diff --git a/packages/network/bluez/patches/bluez-40-Add-support-for-sprd-type-in-hciattach.patch b/packages/network/bluez/patches/bluez-40-Add-support-for-sprd-type-in-hciattach.patch deleted file mode 100644 index 8586dde382..0000000000 --- a/packages/network/bluez/patches/bluez-40-Add-support-for-sprd-type-in-hciattach.patch +++ /dev/null @@ -1,962 +0,0 @@ -From 8db209b20b58ce1915b1366d29ae85c79dc1c4ea Mon Sep 17 00:00:00 2001 -From: Peter Vicman -Date: Tue, 28 Jun 2022 10:10:12 +0200 -Subject: [PATCH] Add support for sprd type in hciattach - -/usr/bin/hciattach -s 1500000 /dev/ttyBT0 sprd - -hciattach_sprd.c file come from -https://github.com/orangepi-xunlong/orangepi-build/commit/cbface3801e14c3f99cdabb53f57a0baff4319a1 -https://github.com/orangepi-xunlong/orangepi-build/blob/main/external/cache/sources/hcitools/hciattach_sprd.c -BT_CONFIG_PATH changed to "/lib/firmware/unisoc" ---- - Makefile.tools | 3 +- - tools/hciattach.c | 30 +- - tools/hciattach.h | 18 + - tools/hciattach_sprd.c | 832 +++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 868 insertions(+), 15 deletions(-) - create mode 100644 tools/hciattach_sprd.c - -diff --git a/Makefile.tools b/Makefile.tools -index 4b513366f..1842e6285 100644 ---- a/Makefile.tools -+++ b/Makefile.tools -@@ -378,7 +378,8 @@ tools_hciattach_SOURCES = tools/hciattach.c tools/hciattach.h \ - tools/hciattach_ath3k.c \ - tools/hciattach_qualcomm.c \ - tools/hciattach_intel.c \ -- tools/hciattach_bcm43xx.c -+ tools/hciattach_bcm43xx.c \ -+ tools/hciattach_sprd.c - tools_hciattach_LDADD = lib/libbluetooth-internal.la - - tools_hciconfig_SOURCES = tools/hciconfig.c -diff --git a/tools/hciattach.c b/tools/hciattach.c -index 276a4e56e..a3267a962 100644 ---- a/tools/hciattach.c -+++ b/tools/hciattach.c -@@ -38,20 +38,6 @@ - - #include "hciattach.h" - --struct uart_t { -- char *type; -- int m_id; -- int p_id; -- int proto; -- int init_speed; -- int speed; -- int flags; -- int pm; -- char *bdaddr; -- int (*init) (int fd, struct uart_t *u, struct termios *ti); -- int (*post) (int fd, struct uart_t *u, struct termios *ti); --}; -- - #define FLOW_CTL 0x0001 - #define AMP_DEV 0x0002 - #define ENABLE_PM 1 -@@ -266,6 +252,19 @@ static int bcm43xx(int fd, struct uart_t *u, struct termios *ti) - return bcm43xx_init(fd, u->init_speed, u->speed, ti, u->bdaddr); - } - -+/* add sprd init and post function */ -+static int sprd_init(int fd, struct uart_t *u, struct termios *ti) -+{ -+ fprintf(stderr, "SPRD Bluetooth init uart with init speed:%d, final_speed:%d, type:HCI UART %s\n", u->init_speed, u->speed, (u->proto == HCI_UART_H4)? "H4":"H5" ); -+ return sprd_config_init(fd, u, ti); -+} -+ -+static int sprd_post(int fd, struct uart_t *u, struct termios *ti) -+{ -+ fprintf(stderr, "SPRD Bluetooth post process\n"); -+ return sprd_config_post(fd, u, ti); -+} -+ - static int read_check(int fd, void *buf, int count) - { - int res; -@@ -1097,6 +1096,9 @@ struct uart_t uart[] = { - { "amp", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, - AMP_DEV, DISABLE_PM, NULL, NULL, NULL }, - -+ /* Bluetooth chip (UWE5622)*/ -+ { "sprd", 0x0000, 0x0000, NULL, 115200, 1500000, -+ FLOW_CTL, DISABLE_PM, NULL, sprd_init, sprd_post}, - { NULL, 0 } - }; - -diff --git a/tools/hciattach.h b/tools/hciattach.h -index 26c0d5424..69bc0ccef 100644 ---- a/tools/hciattach.h -+++ b/tools/hciattach.h -@@ -40,6 +40,20 @@ - #define HCI_UART_EXT_CONFIG 4 - #define HCI_UART_VND_DETECT 5 - -+struct uart_t { -+ char *type; -+ int m_id; -+ int p_id; -+ int proto; -+ int init_speed; -+ int speed; -+ int flags; -+ int pm; -+ char *bdaddr; -+ int (*init) (int fd, struct uart_t *u, struct termios *ti); -+ int (*post) (int fd, struct uart_t *u, struct termios *ti); -+}; -+ - int read_hci_event(int fd, unsigned char *buf, int size); - int set_speed(int fd, struct termios *ti, int speed); - int uart_speed(int speed); -@@ -56,3 +70,7 @@ int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr); - int intel_init(int fd, int init_speed, int *speed, struct termios *ti); - int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, - const char *bdaddr); -+ -+/* add sprd init and post process for sprd Bluetooth chip (UWE5622) */ -+int sprd_config_init(int fd, struct uart_t *u, struct termios *ti); -+int sprd_config_post(int fd, struct uart_t *u, struct termios *ti); -diff --git a/tools/hciattach_sprd.c b/tools/hciattach_sprd.c -new file mode 100644 -index 000000000..12b4795de ---- /dev/null -+++ b/tools/hciattach_sprd.c -@@ -0,0 +1,832 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "lib/bluetooth.h" -+#include "hciattach.h" -+ -+/****************************************************************************** -+** Constants & Macros -+******************************************************************************/ -+#define LOG_STR "SPRD Bluetooth" -+#define DBG_ON 1 -+ -+#define SPRD_DBG(fmt, arg...) \ -+ do { \ -+ if (DBG_ON) \ -+ fprintf(stderr, "%s: " fmt "\n" , LOG_STR, ##arg); \ -+ } while(0) -+ -+#define SPRD_ERR(fmt, arg...) \ -+ do { \ -+ fprintf(stderr, "%s ERROR: " fmt "\n", LOG_STR, ##arg);\ -+ perror(LOG_STR" ERROR reason"); \ -+ } while(0) -+ -+#define SPRD_DUMP(buffer, len) \ -+ fprintf(stderr, "%s: ", LOG_STR); \ -+ do { \ -+ int i = 0; \ -+ for (i = 0; i < len; i++) { \ -+ if (i && !(i % 16)) { \ -+ fprintf(stderr, "\n"); \ -+ fprintf(stderr, "%s: ", LOG_STR); \ -+ } \ -+ fprintf(stderr, "%02x ", buffer[i]); \ -+ } \ -+ fprintf(stderr, "\n"); \ -+ } while (0) -+ -+#define CONF_ITEM_TABLE(ITEM, ACTION, BUF, LEN) \ -+ { #ITEM, ACTION, &(BUF.ITEM), LEN, (sizeof(BUF.ITEM) / LEN) } -+ -+#define UINT8_TO_STREAM(p, u8) \ -+ { *(p)++ = (uint8_t)(u8); } -+ -+#define STREAM_TO_UINT8(u8, p) \ -+ { \ -+ (u8) = (uint8_t)(*(p)); \ -+ (p) += 1; \ -+ } -+ -+#define UINT16_TO_STREAM(p, u16) \ -+ { \ -+ *(p)++ = (uint8_t)(u16); \ -+ *(p)++ = (uint8_t)((u16) >> 8); \ -+ } -+ -+#define STREAM_TO_UINT16(u16, p) \ -+ { \ -+ (u16) = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); \ -+ (p) += 2; \ -+ } -+ -+#define UINT32_TO_STREAM(p, u32) \ -+ { \ -+ *(p)++ = (uint8_t)(u32); \ -+ *(p)++ = (uint8_t)((u32) >> 8); \ -+ *(p)++ = (uint8_t)((u32) >> 16); \ -+ *(p)++ = (uint8_t)((u32) >> 24); \ -+ } -+ -+#define CONF_COMMENT '#' -+#define CONF_DELIMITERS " =\n\r\t" -+#define CONF_VALUES_DELIMITERS "=\n\r\t#" -+#define CONF_VALUES_PARTITION " ,=\n\r\t#" -+#define CONF_MAX_LINE_LEN 255 -+ -+#define HCI_PSKEY 0xFCA0 -+#define HCI_VSC_ENABLE_COMMMAND 0xFCA1 -+#define HCI_RF_PARA 0xFCA2 -+ -+#define RESPONSE_LENGTH 100 -+#define HCI_CMD_MAX_LEN 258 -+#define HCI_EVT_CMD_CMPL_OPCODE 3 -+#define HCI_PACKET_TYPE_COMMAND 1 -+#define HCI_CMD_PREAMBLE_SIZE 3 -+ -+#define FW_NODE_BYTE 6 -+#define FW_DATE_D_BYTE 8 -+#define FW_DATE_M_BYTE 9 -+#define FW_DATE_Y_BYTE 10 -+ -+//#define BT_CONFIG_PATH "/lib/firmware" -+#define BT_CONFIG_PATH "/lib/firmware/unisoc" -+#define BT_HC_HDR_SIZE (sizeof(HC_BT_HDR)) -+#define BT_VND_OP_RESULT_SUCCESS 0 -+#define BT_VND_OP_RESULT_FAIL 1 -+#define MSG_STACK_TO_HC_HCI_CMD 0x2000 -+#define START_STOP_CMD_SIZE 3 -+#define DUAL_MODE 0 -+#define DISABLE_BT 0 -+#define ENABLE_BT 1 -+ -+typedef void (*hci_cback)(void *); -+typedef int (conf_action_t)(char *p_conf_name, char *p_conf_value, void *buf, int len, int size); -+ -+typedef struct { -+ uint16_t event; -+ uint16_t len; -+ uint16_t offset; -+ uint16_t layer_specific; -+ uint8_t data[]; -+} HC_BT_HDR; -+ -+typedef struct { -+ uint32_t device_class; -+ uint8_t feature_set[16]; -+ uint8_t device_addr[6]; -+ uint16_t comp_id; -+ uint8_t g_sys_uart0_communication_supported; -+ uint8_t cp2_log_mode; -+ uint8_t LogLevel; -+ uint8_t g_central_or_perpheral; -+ uint16_t Log_BitMask; -+ uint8_t super_ssp_enable; -+ uint8_t common_rfu_b3; -+ uint32_t common_rfu_w[2]; -+ uint32_t le_rfu_w[2]; -+ uint32_t lmp_rfu_w[2]; -+ uint32_t lc_rfu_w[2]; -+ uint16_t g_wbs_nv_117; -+ uint16_t g_wbs_nv_118; -+ uint16_t g_nbv_nv_117; -+ uint16_t g_nbv_nv_118; -+ uint8_t g_sys_sco_transmit_mode; -+ uint8_t audio_rfu_b1; -+ uint8_t audio_rfu_b2; -+ uint8_t audio_rfu_b3; -+ uint32_t audio_rfu_w[2]; -+ uint8_t g_sys_sleep_in_standby_supported; -+ uint8_t g_sys_sleep_master_supported; -+ uint8_t g_sys_sleep_slave_supported; -+ uint8_t power_rfu_b1; -+ uint32_t power_rfu_w[2]; -+ uint32_t win_ext; -+ uint8_t edr_tx_edr_delay; -+ uint8_t edr_rx_edr_delay; -+ uint8_t tx_delay; -+ uint8_t rx_delay; -+ uint32_t bb_rfu_w[2]; -+ uint8_t agc_mode; -+ uint8_t diff_or_eq; -+ uint8_t ramp_mode; -+ uint8_t modem_rfu_b1; -+ uint32_t modem_rfu_w[2]; -+ uint32_t BQB_BitMask_1; -+ uint32_t BQB_BitMask_2; -+ uint16_t bt_coex_threshold[8]; -+ uint32_t other_rfu_w[6]; -+} pskey_config_t; -+ -+typedef struct { -+ uint16_t g_GainValue_A[6]; -+ uint16_t g_ClassicPowerValue_A[10]; -+ uint16_t g_LEPowerValue_A[16]; -+ uint16_t g_BRChannelpwrvalue_A[8]; -+ uint16_t g_EDRChannelpwrvalue_A[8]; -+ uint16_t g_LEChannelpwrvalue_A[8]; -+ uint16_t g_GainValue_B[6]; -+ uint16_t g_ClassicPowerValue_B[10]; -+ uint16_t g_LEPowerValue_B[16]; -+ uint16_t g_BRChannelpwrvalue_B[8]; -+ uint16_t g_EDRChannelpwrvalue_B[8]; -+ uint16_t g_LEChannelpwrvalue_B[8]; -+ uint16_t LE_fix_powerword; -+ uint8_t Classic_pc_by_channel; -+ uint8_t LE_pc_by_channel; -+ uint8_t RF_switch_mode; -+ uint8_t Data_Capture_Mode; -+ uint8_t Analog_IQ_Debug_Mode; -+ uint8_t RF_common_rfu_b3; -+ uint32_t RF_common_rfu_w[5]; -+} rf_config_t; -+ -+typedef struct { -+ const char *conf_entry; -+ conf_action_t *p_action; -+ void *buf; -+ int len; -+ int size; -+} conf_entry_t; -+ -+static uint8_t local_bdaddr[6]={0x10, 0x11, 0x12, 0x13, 0x14, 0x15}; -+static pskey_config_t marlin3_pskey; -+static rf_config_t marlin3_rf_config; -+static int s_bt_fd = -1; -+ -+static const conf_entry_t marlin3_pksey_table[] = { -+ CONF_ITEM_TABLE(device_class, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(feature_set, 0, marlin3_pskey, 16), -+ CONF_ITEM_TABLE(device_addr, 0, marlin3_pskey, 6), -+ CONF_ITEM_TABLE(comp_id, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(g_sys_uart0_communication_supported, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(cp2_log_mode, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(LogLevel, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(g_central_or_perpheral, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(Log_BitMask, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(super_ssp_enable, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(common_rfu_b3, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(common_rfu_w, 0, marlin3_pskey, 2), -+ CONF_ITEM_TABLE(le_rfu_w, 0, marlin3_pskey, 2), -+ CONF_ITEM_TABLE(lmp_rfu_w, 0, marlin3_pskey, 2), -+ CONF_ITEM_TABLE(lc_rfu_w, 0, marlin3_pskey, 2), -+ CONF_ITEM_TABLE(g_wbs_nv_117, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(g_wbs_nv_118, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(g_nbv_nv_117, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(g_nbv_nv_118, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(g_sys_sco_transmit_mode, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(audio_rfu_b1, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(audio_rfu_b2, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(audio_rfu_b3, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(audio_rfu_w, 0, marlin3_pskey, 2), -+ CONF_ITEM_TABLE(g_sys_sleep_in_standby_supported, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(g_sys_sleep_master_supported, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(g_sys_sleep_slave_supported, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(power_rfu_b1, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(power_rfu_w, 0, marlin3_pskey, 2), -+ CONF_ITEM_TABLE(win_ext, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(edr_tx_edr_delay, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(edr_rx_edr_delay, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(tx_delay, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(rx_delay, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(bb_rfu_w, 0, marlin3_pskey, 2), -+ CONF_ITEM_TABLE(agc_mode, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(diff_or_eq, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(ramp_mode, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(modem_rfu_b1, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(modem_rfu_w, 0, marlin3_pskey, 2), -+ CONF_ITEM_TABLE(BQB_BitMask_1, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(BQB_BitMask_2, 0, marlin3_pskey, 1), -+ CONF_ITEM_TABLE(bt_coex_threshold, 0, marlin3_pskey, 8), -+ CONF_ITEM_TABLE(other_rfu_w, 0, marlin3_pskey, 6), -+ {0, 0, 0, 0, 0} -+}; -+ -+static const conf_entry_t marlin3_rf_table[] = { -+ CONF_ITEM_TABLE(g_GainValue_A, 0, marlin3_rf_config, 6), -+ CONF_ITEM_TABLE(g_ClassicPowerValue_A, 0, marlin3_rf_config, 10), -+ CONF_ITEM_TABLE(g_LEPowerValue_A, 0, marlin3_rf_config, 16), -+ CONF_ITEM_TABLE(g_BRChannelpwrvalue_A, 0, marlin3_rf_config, 8), -+ CONF_ITEM_TABLE(g_EDRChannelpwrvalue_A, 0, marlin3_rf_config, 8), -+ CONF_ITEM_TABLE(g_LEChannelpwrvalue_A, 0, marlin3_rf_config, 8), -+ CONF_ITEM_TABLE(g_GainValue_B, 0, marlin3_rf_config, 6), -+ CONF_ITEM_TABLE(g_ClassicPowerValue_B, 0, marlin3_rf_config, 10), -+ CONF_ITEM_TABLE(g_LEPowerValue_B, 0, marlin3_rf_config, 16), -+ CONF_ITEM_TABLE(g_BRChannelpwrvalue_B, 0, marlin3_rf_config, 8), -+ CONF_ITEM_TABLE(g_EDRChannelpwrvalue_B, 0, marlin3_rf_config, 8), -+ CONF_ITEM_TABLE(g_LEChannelpwrvalue_B, 0, marlin3_rf_config, 8), -+ CONF_ITEM_TABLE(LE_fix_powerword, 0, marlin3_rf_config, 1), -+ CONF_ITEM_TABLE(Classic_pc_by_channel, 0, marlin3_rf_config, 1), -+ CONF_ITEM_TABLE(LE_pc_by_channel, 0, marlin3_rf_config, 1), -+ CONF_ITEM_TABLE(RF_switch_mode, 0, marlin3_rf_config, 1), -+ CONF_ITEM_TABLE(Data_Capture_Mode, 0, marlin3_rf_config, 1), -+ CONF_ITEM_TABLE(Analog_IQ_Debug_Mode, 0, marlin3_rf_config, 1), -+ CONF_ITEM_TABLE(RF_common_rfu_b3, 0, marlin3_rf_config, 1), -+ CONF_ITEM_TABLE(RF_common_rfu_w, 0, marlin3_rf_config, 5), -+ {0, 0, 0, 0, 0} -+}; -+ -+static void log_bin_to_hexstr(uint8_t *bin, uint8_t binsz, const char *log_tag) -+{ -+ SPRD_DBG("%s", log_tag); -+ SPRD_DUMP(bin, binsz); -+} -+ -+static void parse_number(char *p_conf_name, char *p_conf_value, void *buf, int len, int size) -+{ -+ uint8_t *dest = (uint8_t *)buf; -+ char *sub_value, *p; -+ uint32_t value; -+ (void)p_conf_name; -+ sub_value = strtok_r(p_conf_value, CONF_VALUES_PARTITION, &p); -+ do { -+ if (sub_value == NULL) -+ break; -+ -+ if (sub_value[0] == '0' && (sub_value[1] == 'x' || sub_value[1] == 'X')) -+ value = strtoul(sub_value, 0, 16) & 0xFFFFFFFF; -+ else -+ value = strtoul(sub_value, 0, 10) & 0xFFFFFFFF; -+ -+ switch (size) { -+ case sizeof(uint8_t): -+ *dest = value & 0xFF; -+ dest += size; -+ break; -+ -+ case sizeof(uint16_t): -+ *((uint16_t *)dest) = value & 0xFFFF; -+ dest += size; -+ break; -+ -+ case sizeof(uint32_t): -+ *((uint32_t *)dest) = value & 0xFFFFFFFF; -+ dest += size; -+ break; -+ -+ default: -+ break; -+ } -+ sub_value = strtok_r(NULL, CONF_VALUES_PARTITION, &p); -+ } while (--len); -+} -+ -+static unsigned char compare_char(unsigned char ch) -+{ -+ unsigned char data = 0x0; -+ -+ switch(ch) -+ { -+ case 0: -+ case '0': -+ data = 0x0; -+ break; -+ case 1: -+ case '1': -+ data = 0x1; -+ break; -+ case 2: -+ case '2': -+ data = 0x2; -+ break; -+ case 3: -+ case '3': -+ data = 0x3; -+ break; -+ case 4: -+ case '4': -+ data = 0x4; -+ break; -+ case 5: -+ case '5': -+ data = 0x5; -+ break; -+ case 6: -+ case '6': -+ data = 0x6; -+ break; -+ case 7: -+ case '7': -+ data = 0x7; -+ break; -+ case 8: -+ case '8': -+ data = 0x8; -+ break; -+ case 9: -+ case '9': -+ data = 0x9; -+ break; -+ case 10: -+ case 'a': -+ case 'A': -+ data = 0xA; -+ break; -+ case 11: -+ case 'b': -+ case 'B': -+ data = 0xB; -+ break; -+ case 12: -+ case 'c': -+ case 'C': -+ data = 0xC; -+ break; -+ case 13: -+ case 'd': -+ case 'D': -+ data = 0xD; -+ break; -+ case 14: -+ case 'e': -+ case 'E': -+ data = 0xE; -+ break; -+ case 15: -+ case 'f': -+ case 'F': -+ data = 0xF; -+ break; -+ } -+ return data; -+} -+ -+static void set_mac_address(uint8_t *addr) -+{ -+ int i = 0; -+ SPRD_DBG("%s", __func__); -+ //for (i = 0; i < 6; i++) -+ // addr[5-i] = (unsigned char)local_bdaddr[i]; -+ -+ FILE *fp = fopen("/sys/class/addr_mgt/addr_bt", "r+"); -+ unsigned char buff[255]; -+ fscanf(fp, "%s", buff); -+ fclose(fp); -+ int k = 0; -+ -+ unsigned char tmp[5]; -+ sprintf(tmp, "%c%c", buff[0], buff[1]); -+ unsigned char str = compare_char(tmp[0]); -+ unsigned char str2 = compare_char(tmp[1]); -+ local_bdaddr[0] = (str << 4) | str2; -+ -+ sprintf(tmp, "%c%c", buff[3], buff[4]); -+ str = compare_char(tmp[0]); -+ str2 = compare_char(tmp[1]); -+ local_bdaddr[1] = (str << 4) | str2; -+ -+ sprintf(tmp, "%c%c", buff[6], buff[7]); -+ str = compare_char(tmp[0]); -+ str2 = compare_char(tmp[1]); -+ local_bdaddr[2] = (str << 4) | str2; -+ -+ sprintf(tmp, "%c%c", buff[9], buff[10]); -+ str = compare_char(tmp[0]); -+ str2 = compare_char(tmp[1]); -+ local_bdaddr[3] = (str << 4) | str2; -+ -+ sprintf(tmp, "%c%c", buff[12], buff[13]); -+ str = compare_char(tmp[0]); -+ str2 = compare_char(tmp[1]); -+ local_bdaddr[4] = (str << 4) | str2; -+ -+ sprintf(tmp, "%c%c", buff[15], buff[16]); -+ str = compare_char(tmp[0]); -+ str2 = compare_char(tmp[1]); -+ local_bdaddr[5] = (str << 4) | str2; -+ -+ { -+ for (i = 0; i < 6; i++) -+ addr[5-i] = (unsigned char)local_bdaddr[i]; -+ } -+ -+} -+ -+static void vnd_load_configure(const char *p_path, const conf_entry_t *entry) -+{ -+ FILE *p_file; -+ char *p_name, *p_value, *p; -+ conf_entry_t *p_entry; -+ char line[CONF_MAX_LINE_LEN + 1]; /* add 1 for \0 char */ -+ -+ SPRD_DBG("Attempt to load conf from %s", p_path); -+ -+ if ((p_file = fopen(p_path, "r")) != NULL) { -+ /* read line by line */ -+ while (fgets(line, CONF_MAX_LINE_LEN + 1, p_file) != NULL) { -+ if (line[0] == CONF_COMMENT) continue; -+ -+ p_name = strtok_r(line, CONF_DELIMITERS, &p); -+ -+ if (NULL == p_name) { -+ continue; -+ } -+ -+ p_value = strtok_r(NULL, CONF_VALUES_DELIMITERS, &p); -+ -+ if (NULL == p_value) { -+ SPRD_DBG("vnd_load_conf: missing value for name: %s", p_name); -+ continue; -+ } -+ -+ p_entry = (conf_entry_t*)entry; -+ -+ while (p_entry->conf_entry != NULL) { -+ if (strcmp(p_entry->conf_entry, (const char *)p_name) == 0) { -+ if (p_entry->p_action) { -+ p_entry->p_action(p_name, p_value, p_entry->buf, p_entry->len, -+ p_entry->size); -+ } else { -+ SPRD_DBG("%s -> %s", p_name, p_value); -+ parse_number(p_name, p_value, p_entry->buf, p_entry->len, -+ p_entry->size); -+ } -+ break; -+ } -+ -+ p_entry++; -+ } -+ } -+ -+ fclose(p_file); -+ } else { -+ SPRD_DBG("vnd_load_conf file >%s< not found", p_path); -+ } -+} -+ -+static size_t H4Protocol_Send(uint8_t type, const uint8_t* data, size_t length) -+{ -+ struct iovec iov[] = { -+ {&type, sizeof(type)}, -+ {(uint8_t *)data, length}}; -+ -+ ssize_t ret = 0; -+ do { -+ ret = writev(s_bt_fd, iov, sizeof(iov) / sizeof(iov[0])); -+ } while (-1 == ret && EAGAIN == errno); -+ -+ if (ret == -1) { -+ SPRD_ERR("%s error writing to UART (%s)", __func__, strerror(errno)); -+ } else if (ret < length + 1) { -+ SPRD_ERR("%s: %d / %d bytes written - something went wrong...", __func__, ret, length + 1); -+ } -+ -+ return ret; -+} -+ -+static void *bt_vendor_alloc(int size) -+{ -+ void *p = (uint8_t *)malloc(size); -+ return p; -+} -+ -+static void bt_vendor_free(void *buffer) -+{ -+ free(buffer); -+} -+ -+static uint8_t bt_vendor_xmit(uint16_t opcode, void* buffer, hci_cback callback) -+{ -+ uint8_t type = HCI_PACKET_TYPE_COMMAND; -+ (void)opcode; -+ HC_BT_HDR* bt_hdr = (HC_BT_HDR *)buffer; -+ H4Protocol_Send(type, bt_hdr->data, bt_hdr->len); -+ return BT_VND_OP_RESULT_SUCCESS; -+} -+ -+static uint8_t sprd_vnd_send_hci_vsc(uint16_t cmd, uint8_t *payload, uint8_t len, hci_cback cback) -+{ -+ HC_BT_HDR *p_buf; -+ uint8_t *p, ret; -+ -+ p_buf = (HC_BT_HDR *)bt_vendor_alloc( -+ BT_HC_HDR_SIZE + HCI_CMD_PREAMBLE_SIZE + len); -+ if (p_buf) { -+ p_buf->event = MSG_STACK_TO_HC_HCI_CMD; -+ p_buf->offset = 0; -+ p_buf->layer_specific = 0; -+ p_buf->len = HCI_CMD_PREAMBLE_SIZE + len; -+ p = (uint8_t *)(p_buf + 1); -+ -+ UINT16_TO_STREAM(p, cmd); -+ *p++ = len; -+ memcpy(p, payload, len); -+ log_bin_to_hexstr((uint8_t *)(p_buf + 1), HCI_CMD_PREAMBLE_SIZE + len, __FUNCTION__); -+ ret = bt_vendor_xmit(cmd, p_buf, cback); -+ bt_vendor_free(p_buf); -+ return ret; -+ } -+ return BT_VND_OP_RESULT_FAIL; -+} -+ -+static void hw_core_cback(void *p_mem) -+{ -+ uint8_t *p_evt_buf = (uint8_t *)p_mem; -+ uint8_t *p, status; -+ uint16_t opcode, mode; -+ -+ p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE; -+ STREAM_TO_UINT16(opcode,p); -+ STREAM_TO_UINT16(mode,p); -+ STREAM_TO_UINT8(status,p); -+ SPRD_DBG("%s hw_core_cback response: [0x%04X, 0x%04X, 0x%02X]", __func__, opcode, mode, status); -+ bt_vendor_free(p_evt_buf); -+} -+ -+static void hw_core_enable(unsigned char enable) -+{ -+ uint8_t *p, msg_req[HCI_CMD_MAX_LEN]; -+ p = msg_req; -+ UINT16_TO_STREAM(p, DUAL_MODE); -+ UINT8_TO_STREAM(p, enable ? ENABLE_BT : DISABLE_BT); -+ sprd_vnd_send_hci_vsc(HCI_VSC_ENABLE_COMMMAND, msg_req, (uint8_t)(p - msg_req), NULL); -+} -+ -+static void hw_rf_cback(void *p_mem) -+{ -+ uint8_t *p_evt_buf = (uint8_t *)p_mem, len; -+ uint8_t *p, status; -+ uint16_t opcode, mode = 0; -+ -+ p = (uint8_t *)(p_evt_buf + 1) + 1; -+ STREAM_TO_UINT8(len, p); -+ -+ p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE; -+ STREAM_TO_UINT16(opcode, p); -+ if (len == 6) -+ STREAM_TO_UINT16(mode, p); -+ -+ STREAM_TO_UINT8(status, p); -+ -+ SPRD_DBG("%s hw_rf_cback response: [0x%04X, 0x%04X, 0x%02X]", __func__, opcode, mode, status); -+ /* Must free the RX event buffer */ -+ bt_vendor_free(p_evt_buf); -+} -+ -+static int marlin3_rf_preload() -+{ -+ uint8_t *p, msg_req[HCI_CMD_MAX_LEN]; -+ int i; -+ -+ SPRD_DBG("yujian.qin %s", __FUNCTION__); -+ p = msg_req; -+ -+ for (i = 0; i < 6; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_GainValue_A[i]); -+ -+ for (i = 0; i < 10; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_ClassicPowerValue_A[i]); -+ -+ for (i = 0; i < 16; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_LEPowerValue_A[i]); -+ -+ for (i = 0; i < 8; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_BRChannelpwrvalue_A[i]); -+ -+ for (i = 0; i < 8; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_EDRChannelpwrvalue_A[i]); -+ -+ for (i = 0; i < 8; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_LEChannelpwrvalue_A[i]); -+ -+ for (i = 0; i < 6; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_GainValue_B[i]); -+ -+ for (i = 0; i < 10; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_ClassicPowerValue_B[i]); -+ -+ for (i = 0; i < 16; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_LEPowerValue_B[i]); -+ -+ for (i = 0; i < 8; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_BRChannelpwrvalue_B[i]); -+ -+ for (i = 0; i < 8; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_EDRChannelpwrvalue_B[i]); -+ -+ for (i = 0; i < 8; i++) -+ UINT16_TO_STREAM(p, marlin3_rf_config.g_LEChannelpwrvalue_B[i]); -+ -+ UINT16_TO_STREAM(p, marlin3_rf_config.LE_fix_powerword); -+ -+ UINT8_TO_STREAM(p, marlin3_rf_config.Classic_pc_by_channel); -+ UINT8_TO_STREAM(p, marlin3_rf_config.LE_pc_by_channel); -+ UINT8_TO_STREAM(p, marlin3_rf_config.RF_switch_mode); -+ UINT8_TO_STREAM(p, marlin3_rf_config.Data_Capture_Mode); -+ UINT8_TO_STREAM(p, marlin3_rf_config.Analog_IQ_Debug_Mode); -+ UINT8_TO_STREAM(p, marlin3_rf_config.RF_common_rfu_b3); -+ -+ for (i = 0; i < 5; i++) -+ UINT32_TO_STREAM(p, marlin3_rf_config.RF_common_rfu_w[i]); -+ -+ sprd_vnd_send_hci_vsc(HCI_RF_PARA, msg_req, (uint8_t)(p - msg_req), NULL); -+ return 0; -+} -+ -+static void marlin3_pskey_cback(void *p_mem) -+{ -+ uint8_t *p_evt_buf = (uint8_t *)p_mem; -+ -+ uint16_t opcode, node, year; -+ uint8_t *p, month, day; -+ (void)opcode; -+ -+ p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE; -+ STREAM_TO_UINT16(opcode, p); -+ -+ p = (uint8_t *)(p_evt_buf + 1) + FW_NODE_BYTE; -+ STREAM_TO_UINT16(node, p); -+ p = (uint8_t *)(p_evt_buf + 1) + FW_DATE_Y_BYTE; -+ STREAM_TO_UINT16(year, p); -+ p = (uint8_t *)(p_evt_buf + 1) + FW_DATE_M_BYTE; -+ STREAM_TO_UINT8(month, p); -+ p = (uint8_t *)(p_evt_buf + 1) + FW_DATE_D_BYTE; -+ STREAM_TO_UINT8(day, p); -+ -+ SPRD_DBG("Bluetooth Firmware Node: %04X Date: %04x-%02x-%02x", node, year, month, day); -+ -+ /* Must free the RX event buffer */ -+ bt_vendor_free(p_evt_buf); -+} -+ -+static int marlin3_pskey_preload(void *arg) -+{ -+ uint8_t *p, msg_req[HCI_CMD_MAX_LEN]; -+ int i; -+ (void)arg; -+ -+ SPRD_DBG("%s", __FUNCTION__); -+ p = msg_req; -+ UINT32_TO_STREAM(p, marlin3_pskey.device_class); -+ -+ for (i = 0; i < 16; i++) -+ UINT8_TO_STREAM(p, marlin3_pskey.feature_set[i]); -+ -+ for (i = 0; i < 6; i++) -+ UINT8_TO_STREAM(p, marlin3_pskey.device_addr[i]); -+ -+ UINT16_TO_STREAM(p, marlin3_pskey.comp_id); -+ UINT8_TO_STREAM(p, marlin3_pskey.g_sys_uart0_communication_supported); -+ UINT8_TO_STREAM(p, marlin3_pskey.cp2_log_mode); -+ UINT8_TO_STREAM(p, marlin3_pskey.LogLevel); -+ UINT8_TO_STREAM(p, marlin3_pskey.g_central_or_perpheral); -+ -+ UINT16_TO_STREAM(p, marlin3_pskey.Log_BitMask); -+ UINT8_TO_STREAM(p, marlin3_pskey.super_ssp_enable); -+ UINT8_TO_STREAM(p, marlin3_pskey.common_rfu_b3); -+ -+ for (i = 0; i < 2; i++) -+ UINT32_TO_STREAM(p, marlin3_pskey.common_rfu_w[i]); -+ -+ for (i = 0; i < 2; i++) -+ UINT32_TO_STREAM(p, marlin3_pskey.le_rfu_w[i]); -+ -+ for (i = 0; i < 2; i++) -+ UINT32_TO_STREAM(p, marlin3_pskey.lmp_rfu_w[i]); -+ -+ for (i = 0; i < 2; i++) -+ UINT32_TO_STREAM(p, marlin3_pskey.lc_rfu_w[i]); -+ -+ UINT16_TO_STREAM(p, marlin3_pskey.g_wbs_nv_117); -+ UINT16_TO_STREAM(p, marlin3_pskey.g_wbs_nv_118); -+ UINT16_TO_STREAM(p, marlin3_pskey.g_nbv_nv_117); -+ UINT16_TO_STREAM(p, marlin3_pskey.g_nbv_nv_118); -+ -+ UINT8_TO_STREAM(p, marlin3_pskey.g_sys_sco_transmit_mode); -+ UINT8_TO_STREAM(p, marlin3_pskey.audio_rfu_b1); -+ UINT8_TO_STREAM(p, marlin3_pskey.audio_rfu_b2); -+ UINT8_TO_STREAM(p, marlin3_pskey.audio_rfu_b3); -+ -+ for (i = 0; i < 2; i++) -+ UINT32_TO_STREAM(p, marlin3_pskey.audio_rfu_w[i]); -+ -+ UINT8_TO_STREAM(p, marlin3_pskey.g_sys_sleep_in_standby_supported); -+ UINT8_TO_STREAM(p, marlin3_pskey.g_sys_sleep_master_supported); -+ UINT8_TO_STREAM(p, marlin3_pskey.g_sys_sleep_slave_supported); -+ UINT8_TO_STREAM(p, marlin3_pskey.power_rfu_b1); -+ -+ for (i = 0; i < 2; i++) -+ UINT32_TO_STREAM(p, marlin3_pskey.power_rfu_w[i]); -+ -+ UINT32_TO_STREAM(p, marlin3_pskey.win_ext); -+ -+ UINT8_TO_STREAM(p, marlin3_pskey.edr_tx_edr_delay); -+ UINT8_TO_STREAM(p, marlin3_pskey.edr_rx_edr_delay); -+ UINT8_TO_STREAM(p, marlin3_pskey.tx_delay); -+ UINT8_TO_STREAM(p, marlin3_pskey.rx_delay); -+ -+ for (i = 0; i < 2; i++) -+ UINT32_TO_STREAM(p, marlin3_pskey.bb_rfu_w[i]); -+ -+ UINT8_TO_STREAM(p, marlin3_pskey.agc_mode); -+ UINT8_TO_STREAM(p, marlin3_pskey.diff_or_eq); -+ UINT8_TO_STREAM(p, marlin3_pskey.ramp_mode); -+ UINT8_TO_STREAM(p, marlin3_pskey.modem_rfu_b1); -+ -+ for (i = 0; i < 2; i++) -+ UINT32_TO_STREAM(p, marlin3_pskey.modem_rfu_w[i]); -+ -+ UINT32_TO_STREAM(p, marlin3_pskey.BQB_BitMask_1); -+ UINT32_TO_STREAM(p, marlin3_pskey.BQB_BitMask_2); -+ for (i = 0; i < 8; i++) -+ UINT16_TO_STREAM(p, marlin3_pskey.bt_coex_threshold[i]); -+ -+ for (i = 0; i < 6; i++) -+ UINT32_TO_STREAM(p, marlin3_pskey.other_rfu_w[i]); -+ -+ sprd_vnd_send_hci_vsc(HCI_PSKEY, msg_req, (uint8_t)(p - msg_req), NULL); -+ return 0; -+} -+ -+ -+int sprd_config_init(int fd, struct uart_t *u, struct termios *ti) -+{ -+ uint8_t *recv = NULL; -+ int len = 0; -+ -+ s_bt_fd = fd; -+ -+ memset(&marlin3_pskey, 0, sizeof(marlin3_pskey)); -+ memset(&marlin3_rf_config, 0, sizeof(marlin3_rf_config)); -+ vnd_load_configure(BT_CONFIG_PATH "/bt_configure_pskey.ini", &marlin3_pksey_table[0]); -+ vnd_load_configure(BT_CONFIG_PATH "/bt_configure_rf.ini", &marlin3_rf_table[0]); -+ //set_mac_address(marlin3_pskey.device_addr); -+ -+ marlin3_pskey_preload(NULL); -+ recv = bt_vendor_alloc(RESPONSE_LENGTH); -+ len = read_hci_event(s_bt_fd, recv, RESPONSE_LENGTH); -+ SPRD_DBG("Received event, len: %d", len); -+ SPRD_DUMP(recv, len); -+ marlin3_pskey_cback(recv); -+ -+ marlin3_rf_preload(); -+ recv = bt_vendor_alloc(RESPONSE_LENGTH); -+ len = read_hci_event(s_bt_fd, recv, RESPONSE_LENGTH); -+ SPRD_DBG("Received event, len: %d", len); -+ SPRD_DUMP(recv, len); -+ hw_rf_cback(recv); -+ -+ hw_core_enable(1); -+ recv = bt_vendor_alloc(RESPONSE_LENGTH); -+ len = read_hci_event(s_bt_fd, recv, RESPONSE_LENGTH); -+ SPRD_DBG("Received event, len: %d", len); -+ SPRD_DUMP(recv, len); -+ hw_core_cback(recv); -+ -+ return 0; -+} -+ -+int sprd_config_post(int fd, struct uart_t *u, struct termios *ti) -+{ -+ SPRD_DBG("Done setting line discpline"); -+ return 0; -+} --- -2.30.2 - diff --git a/packages/network/bluez/patches/bluez-50-fix-device_prove-failing.patch b/packages/network/bluez/patches/bluez-50-fix-device_prove-failing.patch deleted file mode 100644 index 8552d4125e..0000000000 --- a/packages/network/bluez/patches/bluez-50-fix-device_prove-failing.patch +++ /dev/null @@ -1,307 +0,0 @@ -From 3a9c637010f8dc1ba3e8382abe01065761d4f5bb Mon Sep 17 00:00:00 2001 -From: Luiz Augusto von Dentz -Date: Tue, 10 Oct 2023 12:38:29 -0700 -Subject: [PATCH] input: Fix .device_probe failing if SDP record is not found - -Due to changes introduced by 67a26abe53bf -("profile: Add probe_on_discover flag") profiles may get probed when -their profile UUID are discovered, rather than resolved, which means -the SDP record may not be available. - -Fixes: https://github.com/bluez/bluez/issues/614 ---- - profiles/input/device.c | 182 +++++++++++++++++++--------------------- - 1 file changed, 84 insertions(+), 98 deletions(-) - -diff --git a/profiles/input/device.c b/profiles/input/device.c -index e2ac6ea603..4a50ea9921 100644 ---- a/profiles/input/device.c -+++ b/profiles/input/device.c -@@ -60,7 +60,7 @@ struct input_device { - char *path; - bdaddr_t src; - bdaddr_t dst; -- uint32_t handle; -+ const sdp_record_t *rec; - GIOChannel *ctrl_io; - GIOChannel *intr_io; - guint ctrl_watch; -@@ -754,7 +754,8 @@ static void epox_endian_quirk(unsigned char *data, int size) - } - } - --static int create_hid_dev_name(sdp_record_t *rec, struct hidp_connadd_req *req) -+static int create_hid_dev_name(const sdp_record_t *rec, -+ struct hidp_connadd_req *req) - { - char sdesc[sizeof(req->name) / 2]; - -@@ -776,7 +777,7 @@ static int create_hid_dev_name(sdp_record_t *rec, struct hidp_connadd_req *req) - - /* See HID profile specification v1.0, "7.11.6 HIDDescriptorList" for details - * on the attribute format. */ --static int extract_hid_desc_data(sdp_record_t *rec, -+static int extract_hid_desc_data(const sdp_record_t *rec, - struct hidp_connadd_req *req) - { - sdp_data_t *d; -@@ -817,36 +818,40 @@ static int extract_hid_desc_data(sdp_record_t *rec, - return -EINVAL; - } - --static int extract_hid_record(sdp_record_t *rec, struct hidp_connadd_req *req) -+static int extract_hid_record(struct input_device *idev, -+ struct hidp_connadd_req *req) - { - sdp_data_t *pdlist; - uint8_t attr_val; - int err; - -- err = create_hid_dev_name(rec, req); -+ if (!idev->rec) -+ return -ENOENT; -+ -+ err = create_hid_dev_name(idev->rec, req); - if (err < 0) - DBG("No valid Service Name or Service Description found"); - -- pdlist = sdp_data_get(rec, SDP_ATTR_HID_PARSER_VERSION); -+ pdlist = sdp_data_get(idev->rec, SDP_ATTR_HID_PARSER_VERSION); - req->parser = pdlist ? pdlist->val.uint16 : 0x0100; - -- pdlist = sdp_data_get(rec, SDP_ATTR_HID_DEVICE_SUBCLASS); -+ pdlist = sdp_data_get(idev->rec, SDP_ATTR_HID_DEVICE_SUBCLASS); - req->subclass = pdlist ? pdlist->val.uint8 : 0; - -- pdlist = sdp_data_get(rec, SDP_ATTR_HID_COUNTRY_CODE); -+ pdlist = sdp_data_get(idev->rec, SDP_ATTR_HID_COUNTRY_CODE); - req->country = pdlist ? pdlist->val.uint8 : 0; - -- pdlist = sdp_data_get(rec, SDP_ATTR_HID_VIRTUAL_CABLE); -+ pdlist = sdp_data_get(idev->rec, SDP_ATTR_HID_VIRTUAL_CABLE); - attr_val = pdlist ? pdlist->val.uint8 : 0; - if (attr_val) - req->flags |= (1 << HIDP_VIRTUAL_CABLE_UNPLUG); - -- pdlist = sdp_data_get(rec, SDP_ATTR_HID_BOOT_DEVICE); -+ pdlist = sdp_data_get(idev->rec, SDP_ATTR_HID_BOOT_DEVICE); - attr_val = pdlist ? pdlist->val.uint8 : 0; - if (attr_val) - req->flags |= (1 << HIDP_BOOT_PROTOCOL_MODE); - -- err = extract_hid_desc_data(rec, req); -+ err = extract_hid_desc_data(idev->rec, req); - if (err < 0) - return err; - -@@ -1035,11 +1040,6 @@ static gboolean encrypt_notify(GIOChannel *io, GIOCondition condition, - static int hidp_add_connection(struct input_device *idev) - { - struct hidp_connadd_req *req; -- sdp_record_t *rec; -- char src_addr[18], dst_addr[18]; -- char filename[PATH_MAX]; -- GKeyFile *key_file; -- char handle[11], *str; - GError *gerr = NULL; - int err; - -@@ -1049,33 +1049,7 @@ static int hidp_add_connection(struct input_device *idev) - req->flags = 0; - req->idle_to = idle_timeout; - -- ba2str(&idev->src, src_addr); -- ba2str(&idev->dst, dst_addr); -- -- snprintf(filename, PATH_MAX, STORAGEDIR "/%s/cache/%s", src_addr, -- dst_addr); -- sprintf(handle, "0x%8.8X", idev->handle); -- -- key_file = g_key_file_new(); -- if (!g_key_file_load_from_file(key_file, filename, 0, &gerr)) { -- error("Unable to load key file from %s: (%s)", filename, -- gerr->message); -- g_clear_error(&gerr); -- } -- str = g_key_file_get_string(key_file, "ServiceRecords", handle, NULL); -- g_key_file_free(key_file); -- -- if (!str) { -- error("Rejected connection from unknown device %s", dst_addr); -- err = -EPERM; -- goto cleanup; -- } -- -- rec = record_from_string(str); -- g_free(str); -- -- err = extract_hid_record(rec, req); -- sdp_record_free(rec); -+ err = extract_hid_record(idev, req); - if (err < 0) { - error("Could not parse HID SDP record: %s (%d)", strerror(-err), - -err); -@@ -1091,7 +1065,7 @@ static int hidp_add_connection(struct input_device *idev) - - /* Make sure the device is bonded if required */ - if (classic_bonded_only && !input_device_bonded(idev)) { -- error("Rejected connection from !bonded device %s", dst_addr); -+ error("Rejected connection from !bonded device %s", idev->path); - goto cleanup; - } - -@@ -1161,6 +1135,68 @@ static int connection_disconnect(struct input_device *idev, uint32_t flags) - return ioctl_disconnect(idev, flags); - } - -+static bool is_device_sdp_disable(const sdp_record_t *rec) -+{ -+ sdp_data_t *data; -+ -+ data = sdp_data_get(rec, SDP_ATTR_HID_SDP_DISABLE); -+ -+ return data && data->val.uint8; -+} -+ -+static enum reconnect_mode_t hid_reconnection_mode(bool reconnect_initiate, -+ bool normally_connectable) -+{ -+ if (!reconnect_initiate && !normally_connectable) -+ return RECONNECT_NONE; -+ else if (!reconnect_initiate && normally_connectable) -+ return RECONNECT_HOST; -+ else if (reconnect_initiate && !normally_connectable) -+ return RECONNECT_DEVICE; -+ else /* (reconnect_initiate && normally_connectable) */ -+ return RECONNECT_ANY; -+} -+ -+static void extract_hid_props(struct input_device *idev, -+ const sdp_record_t *rec) -+{ -+ /* Extract HID connectability */ -+ bool reconnect_initiate, normally_connectable; -+ sdp_data_t *pdlist; -+ -+ /* HIDNormallyConnectable is optional and assumed FALSE if not -+ * present. -+ */ -+ pdlist = sdp_data_get(rec, SDP_ATTR_HID_RECONNECT_INITIATE); -+ reconnect_initiate = pdlist ? pdlist->val.uint8 : TRUE; -+ -+ pdlist = sdp_data_get(rec, SDP_ATTR_HID_NORMALLY_CONNECTABLE); -+ normally_connectable = pdlist ? pdlist->val.uint8 : FALSE; -+ -+ /* Update local values */ -+ idev->reconnect_mode = -+ hid_reconnection_mode(reconnect_initiate, normally_connectable); -+} -+ -+static void input_device_update_rec(struct input_device *idev) -+{ -+ struct btd_profile *p = btd_service_get_profile(idev->service); -+ const sdp_record_t *rec; -+ -+ rec = btd_device_get_record(idev->device, p->remote_uuid); -+ if (!rec || idev->rec == rec) -+ return; -+ -+ idev->rec = rec; -+ idev->disable_sdp = is_device_sdp_disable(rec); -+ -+ /* Initialize device properties */ -+ extract_hid_props(idev, rec); -+ -+ if (idev->disable_sdp) -+ device_set_refresh_discovery(idev->device, false); -+} -+ - static int input_device_connected(struct input_device *idev) - { - int err; -@@ -1168,6 +1204,9 @@ static int input_device_connected(struct input_device *idev) - if (idev->intr_io == NULL || idev->ctrl_io == NULL) - return -ENOTCONN; - -+ /* Attempt to update SDP record if it had changed */ -+ input_device_update_rec(idev); -+ - err = hidp_add_connection(idev); - if (err < 0) - return err; -@@ -1411,74 +1450,21 @@ int input_device_disconnect(struct btd_service *service) - return 0; - } - --static bool is_device_sdp_disable(const sdp_record_t *rec) --{ -- sdp_data_t *data; -- -- data = sdp_data_get(rec, SDP_ATTR_HID_SDP_DISABLE); -- -- return data && data->val.uint8; --} -- --static enum reconnect_mode_t hid_reconnection_mode(bool reconnect_initiate, -- bool normally_connectable) --{ -- if (!reconnect_initiate && !normally_connectable) -- return RECONNECT_NONE; -- else if (!reconnect_initiate && normally_connectable) -- return RECONNECT_HOST; -- else if (reconnect_initiate && !normally_connectable) -- return RECONNECT_DEVICE; -- else /* (reconnect_initiate && normally_connectable) */ -- return RECONNECT_ANY; --} -- --static void extract_hid_props(struct input_device *idev, -- const sdp_record_t *rec) --{ -- /* Extract HID connectability */ -- bool reconnect_initiate, normally_connectable; -- sdp_data_t *pdlist; -- -- /* HIDNormallyConnectable is optional and assumed FALSE -- * if not present. */ -- pdlist = sdp_data_get(rec, SDP_ATTR_HID_RECONNECT_INITIATE); -- reconnect_initiate = pdlist ? pdlist->val.uint8 : TRUE; -- -- pdlist = sdp_data_get(rec, SDP_ATTR_HID_NORMALLY_CONNECTABLE); -- normally_connectable = pdlist ? pdlist->val.uint8 : FALSE; -- -- /* Update local values */ -- idev->reconnect_mode = -- hid_reconnection_mode(reconnect_initiate, normally_connectable); --} -- - static struct input_device *input_device_new(struct btd_service *service) - { - struct btd_device *device = btd_service_get_device(service); -- struct btd_profile *p = btd_service_get_profile(service); - const char *path = device_get_path(device); -- const sdp_record_t *rec = btd_device_get_record(device, p->remote_uuid); - struct btd_adapter *adapter = device_get_adapter(device); - struct input_device *idev; - -- if (!rec) -- return NULL; -- - idev = g_new0(struct input_device, 1); - bacpy(&idev->src, btd_adapter_get_address(adapter)); - bacpy(&idev->dst, device_get_address(device)); - idev->service = btd_service_ref(service); - idev->device = btd_device_ref(device); - idev->path = g_strdup(path); -- idev->handle = rec->handle; -- idev->disable_sdp = is_device_sdp_disable(rec); -- -- /* Initialize device properties */ -- extract_hid_props(idev, rec); - -- if (idev->disable_sdp) -- device_set_refresh_discovery(device, false); -+ input_device_update_rec(idev); - - return idev; - } diff --git a/packages/network/bluez/system.d/bluetooth.service b/packages/network/bluez/system.d/bluetooth.service index 0635a8b65b..3f0ff2bf9a 100644 --- a/packages/network/bluez/system.d/bluetooth.service +++ b/packages/network/bluez/system.d/bluetooth.service @@ -12,7 +12,7 @@ NotifyAccess=main EnvironmentFile=/storage/.cache/services/bluez.conf EnvironmentFile=-/run/libreelec/debug/bluez.conf ExecStart=/usr/lib/bluetooth/bluetoothd $BLUEZ_ARGS $BLUEZ_DEBUG -CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW +CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_FOWNER LimitNPROC=1 TimeoutStopSec=1s Restart=on-failure diff --git a/packages/network/samba/config/smb.conf b/packages/network/samba/config/smb.conf index b85887629e..f8c85aa616 100644 --- a/packages/network/samba/config/smb.conf +++ b/packages/network/samba/config/smb.conf @@ -55,8 +55,14 @@ browseable = yes writeable = yes -[roms] - path = /storage/roms +[games-internal] + path = /storage/games-internal + available = yes + browseable = yes + writeable = yes + +[games-external] + path = /storage/games-external available = yes browseable = yes writeable = yes diff --git a/packages/network/tailscale/package.mk b/packages/network/tailscale/package.mk index 66c4033fae..fd80beca9a 100644 --- a/packages/network/tailscale/package.mk +++ b/packages/network/tailscale/package.mk @@ -11,14 +11,16 @@ PKG_TOOLCHAIN="manual" case ${TARGET_ARCH} in aarch64) - TS_ARCH="arm64" + TS_ARCH="_arm64" + PKG_SHA256="a7c9e801f43c04290481c2f6b0baad6fcaa82db3149fac232b2601115dd65db7" ;; x86_64) - TS_ARCH="amd64" + TS_ARCH="_amd64" + PKG_SHA256="e9375a321faaba03c93e006f40318eb986937658e09287cdf0117b9e28ab8fbe" ;; esac -PKG_URL="https://pkgs.tailscale.com/stable/tailscale_${PKG_VERSION}_${TS_ARCH}.tgz" +PKG_URL="https://pkgs.tailscale.com/stable/tailscale_${PKG_VERSION}${TS_ARCH}.tgz" # Don't wildcard (X55) case ${DEVICE} in @@ -29,7 +31,7 @@ esac pre_unpack() { mkdir -p ${PKG_BUILD} - tar --strip-components=1 -xf ${SOURCES}/${PKG_NAME}/${PKG_NAME}-${PKG_VERSION}.tgz -C ${PKG_BUILD} + tar --strip-components=1 -xf $SOURCES/${PKG_NAME}/${PKG_NAME}-${PKG_VERSION}.tgz -C ${PKG_BUILD} tailscale_${PKG_VERSION}${TS_ARCH} } makeinstall_target() { diff --git a/packages/network/wireguard-tools/package.mk b/packages/network/wireguard-tools/package.mk index 1856f1f2a9..7c75f7ea81 100644 --- a/packages/network/wireguard-tools/package.mk +++ b/packages/network/wireguard-tools/package.mk @@ -27,4 +27,5 @@ makeinstall_target() { cp ${PKG_DIR}/scripts/wg-genconfig ${INSTALL}/usr/bin cp ${PKG_BUILD}/src/wg ${INSTALL}/usr/bin cp ${PKG_BUILD}/src/wg-quick/linux.bash ${INSTALL}/usr/bin/wg-quick + chmod 755 ${INSTALL}/usr/bin/* } diff --git a/packages/sysutils/busybox/package.mk b/packages/sysutils/busybox/package.mk index a806428f3d..aea453a5fc 100644 --- a/packages/sysutils/busybox/package.mk +++ b/packages/sysutils/busybox/package.mk @@ -181,10 +181,10 @@ post_install() { fi ROOT_PWD="`${TOOLCHAIN}/bin/cryptpw -m sha512 ${ROOT_PASSWORD}`" - echo "chmod 4755 ${INSTALL}/usr/bin/busybox" >> $FAKEROOT_SCRIPT - echo "chmod 000 ${INSTALL}/usr/cache/shadow" >> $FAKEROOT_SCRIPT + echo "chmod 4755 ${INSTALL}/usr/bin/busybox" >> ${FAKEROOT_SCRIPT} + echo "chmod 000 ${INSTALL}/usr/cache/shadow" >> ${FAKEROOT_SCRIPT} - add_user root "${ROOT}_PWD" 0 0 "Root User" "/storage" "/bin/sh" + add_user root "${ROOT_PWD}" 0 0 "Root User" "/storage" "/bin/sh" add_group root 0 add_group users 100 diff --git a/packages/sysutils/powerstate/profile.d/030-powerfunctions b/packages/sysutils/powerstate/profile.d/030-powerfunctions index 49a8850198..e42a1b73b9 100644 --- a/packages/sysutils/powerstate/profile.d/030-powerfunctions +++ b/packages/sysutils/powerstate/profile.d/030-powerfunctions @@ -68,6 +68,10 @@ pcie_aspm_policy() { } cpu_perftune() { + if [ -n "${1}" ] + then + DESIRED_EPP=${1} + fi CPUPOWERSAVE=$(get_setting system.power.cpu) POWERSAVEENABLED=$(get_setting system.powersave) CPU="$(awk '/vendor_id/ {print $3;exit}' /proc/cpuinfo)" @@ -91,15 +95,22 @@ cpu_perftune() { AuthenticAMD) PSTATE="amd_pstate" STATUS="active" + WARM="passive" ;; GenuineIntel) PSTATE="intel_pstate" STATUS="passive" + WARM="active" ;; esac if [ -f "/sys/devices/system/cpu/${PSTATE}/status" ] then + if [ -n "${WARM}" ] + then + # Some devices need to switch before the handles are writeable (AYANEO). + echo ${WARM} >/sys/devices/system/cpu/${PSTATE}/status + fi echo ${STATUS} >/sys/devices/system/cpu/${PSTATE}/status while [ ! -f /sys/devices/system/cpu/cpufreq/policy0/energy_performance_preference ] do @@ -110,9 +121,13 @@ cpu_perftune() { EPP=$(get_setting system.power.epp) if [ -z "${EPP}" ] then - EPP="performance" + EPP="balance_performance" set_setting system.power.epp ${EPP} fi + if [ -n "${DESIRED_EPP}" ] + then + EPP="${DESIRED_EPP}" + fi echo ${EPP} >${policy} 2>/dev/null done fi diff --git a/packages/sysutils/powerstate/sources/powerstate.sh b/packages/sysutils/powerstate/sources/powerstate.sh index 665ead278b..93997dcff0 100755 --- a/packages/sysutils/powerstate/sources/powerstate.sh +++ b/packages/sysutils/powerstate/sources/powerstate.sh @@ -11,14 +11,16 @@ . /etc/profile BATCNT=0 +unset CURRENT_MODE +unset AC_STATUS while true do if [ "$(get_setting system.powersave)" = 1 ] then - STATUS="$(cat /sys/class/power_supply/{BAT*,bat*}/status 2>/dev/null)" - if [ ! "${STATUS}" = "${CURRENT_MODE}" ] + AC_STATUS="$(cat /sys/class/power_supply/[bB][aA][tT]*/status 2>/dev/null)" + if [[ ! "${CURRENT_MODE}" =~ ${AC_STATUS} ]] then - case ${STATUS} in + case ${AC_STATUS} in Disch*) log $0 "Switching to battery mode." if [ -e "/tmp/.gpu_performance_level" ] @@ -56,7 +58,7 @@ do ;; esac fi - CURRENT_MODE="${STATUS}" + CURRENT_MODE="${AC_STATUS}" fi ### Until we have an overlay. :rofl: if (( "${BATCNT}" >= "90" )) && diff --git a/packages/sysutils/system-utils/sources/devices/AMD64/set_epp b/packages/sysutils/system-utils/sources/devices/AMD64/set_epp index 1128a580b1..2acb8dcb33 100755 --- a/packages/sysutils/system-utils/sources/devices/AMD64/set_epp +++ b/packages/sysutils/system-utils/sources/devices/AMD64/set_epp @@ -15,7 +15,7 @@ then PROFILE=$(get_setting system.power.epp) if [ -z "${PROFILE}" ] then - PROFILE="performance" + PROFILE="balance_performance" set_setting system.power.epp ${PROFILE} fi else diff --git a/packages/sysutils/udevil/config/udevil.conf b/packages/sysutils/udevil/config/udevil.conf index a364116875..99d6e29fe1 100644 --- a/packages/sysutils/udevil/config/udevil.conf +++ b/packages/sysutils/udevil/config/udevil.conf @@ -119,7 +119,7 @@ allowed_media_dirs = /var/media, /media, /run/media/$USER # allowed_devices = /dev/* # WARNING: ALLOWING USERS TO MOUNT DEVICES OUTSIDE OF /dev CAN CAUSE SERIOUS # SECURITY PROBLEMS. DO NOT ALLOW DEVICES IN /dev/shm -allowed_devices = /dev/* +allowed_devices = /dev/sd* /dev/nvme* # allowed_internal_devices causes udevil to treat any listed block devices as diff --git a/packages/sysutils/udevil/udev.d/95-udevil-mount.rules b/packages/sysutils/udevil/udev.d/95-udevil-mount.rules index 64065d04b7..ddf15659b1 100644 --- a/packages/sysutils/udevil/udev.d/95-udevil-mount.rules +++ b/packages/sysutils/udevil/udev.d/95-udevil-mount.rules @@ -2,15 +2,15 @@ IMPORT{cmdline}="installer" ENV{installer}=="1", GOTO="exit" -# check for blockdevices, /dev/sd*, /dev/sr* and /dev/mmc* -SUBSYSTEM!="block", KERNEL!="sd*|sr*|mmc*", GOTO="exit" +# check for blockdevices, /dev/sd*, /dev/sr* +SUBSYSTEM!="block", KERNEL!="sd*|sr*", GOTO="exit" # check for special partitions we dont want mount IMPORT{builtin}="blkid" ENV{ID_FS_LABEL}=="EFI|BOOT|Recovery|RECOVERY|SETTINGS|boot|root0|share0", GOTO="exit" -# /dev/sd* and /dev/mmc* ith partitions/disk and filesystems only and /dev/sr* disks only -KERNEL=="sd*|mmc*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk" +# /dev/sd* with partitions/disk and filesystems only and /dev/sr* disks only +KERNEL=="sd*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk" KERNEL=="sr*", ENV{DEVTYPE}=="disk", GOTO="optical" GOTO="exit" diff --git a/packages/ui/emulationstation/package.mk b/packages/ui/emulationstation/package.mk index 5c19334286..3b5316a080 100644 --- a/packages/ui/emulationstation/package.mk +++ b/packages/ui/emulationstation/package.mk @@ -3,7 +3,7 @@ # Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) PKG_NAME="emulationstation" -PKG_VERSION="6c712ff" +PKG_VERSION="ac666f2" PKG_GIT_CLONE_BRANCH="main" PKG_REV="1" PKG_ARCH="any" diff --git a/packages/virtual/emulators/package.mk b/packages/virtual/emulators/package.mk index 2bd004480f..3d33c99dca 100644 --- a/packages/virtual/emulators/package.mk +++ b/packages/virtual/emulators/package.mk @@ -1235,3 +1235,4 @@ makeinstall_target() { cp ${PKG_DIR}/autostart/* ${INSTALL}/usr/lib/autostart/common chmod 0755 ${INSTALL}/usr/lib/autostart/common/* } + diff --git a/packages/virtual/emulators/system.d/storage-roms.mount b/packages/virtual/emulators/system.d/storage-roms.mount new file mode 100644 index 0000000000..e93769cbf5 --- /dev/null +++ b/packages/virtual/emulators/system.d/storage-roms.mount @@ -0,0 +1,13 @@ +[Unit] +Description=Overlays directory +After=systemd-tmpfiles-setup.service +DefaultDependencies=no + +[Mount] +What=none +Where=/storage/roms +Type=overlay +Options=lowerdir=/storage/games-external,upperdir=/storage/games-internal,workdir=/storage/.tmp/games-workdir + +[Install] +WantedBy=jelos.target diff --git a/packages/virtual/emulators/tmpfiles.d/jelos-dirs.conf b/packages/virtual/emulators/tmpfiles.d/jelos-dirs.conf index 81f731a36c..80cb02100a 100644 --- a/packages/virtual/emulators/tmpfiles.d/jelos-dirs.conf +++ b/packages/virtual/emulators/tmpfiles.d/jelos-dirs.conf @@ -2,5 +2,8 @@ # Copyright (C) 2021-present 351ELEC (https://github.com/351ELEC) # Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) +d /storage/.tmp/games-workdir 0777 root root - - +d /storage/games-internal 0777 root root - - +d /storage/games-external 0777 root root - - d /storage/roms 0777 root root - - d /tmp/cache 0777 root root - - diff --git a/packages/virtual/emulators/udev.d/99-automount.rules b/packages/virtual/emulators/udev.d/99-automount.rules new file mode 100644 index 0000000000..ca3eba0554 --- /dev/null +++ b/packages/virtual/emulators/udev.d/99-automount.rules @@ -0,0 +1,21 @@ +# dont run in "installer" mode +IMPORT{cmdline}="installer" +ENV{installer}=="1", GOTO="exit" + +SUBSYSTEM!="block", KERNEL!="mmc*", GOTO="exit" + +# check for special partitions we dont want mount +IMPORT{builtin}="blkid" +ENV{ID_FS_LABEL}=="EFI|BOOT|Recovery|RECOVERY|SETTINGS|boot|root0|share0", GOTO="exit" + +# /dev/mmc* partitions/disk and filesystems only +KERNEL=="mmc*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk" +GOTO="exit" + +# mount or umount for hdds +LABEL="harddisk" +ACTION=="add", PROGRAM="/usr/bin/sh -c '/usr/bin/grep -E ^/dev/%k\ /proc/mounts || true'", RESULT=="", RUN+="/usr/bin/systemctl stop storage-roms.mount", RUN+="/usr/bin/systemctl restart jelos-automount.service" +GOTO="exit" + +# Exit +LABEL="exit" diff --git a/projects/Amlogic/devices/S922X/linux/linux.aarch64.conf b/projects/Amlogic/devices/S922X/linux/linux.aarch64.conf index ceb8a37ea6..4e84e5d807 100644 --- a/projects/Amlogic/devices/S922X/linux/linux.aarch64.conf +++ b/projects/Amlogic/devices/S922X/linux/linux.aarch64.conf @@ -6502,7 +6502,7 @@ CONFIG_FUSE_FS=m # CONFIG_CUSE is not set # CONFIG_VIRTIO_FS is not set CONFIG_OVERLAY_FS=m -# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set +CONFIG_OVERLAY_FS_REDIRECT_DIR=y CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y # CONFIG_OVERLAY_FS_INDEX is not set # CONFIG_OVERLAY_FS_XINO_AUTO is not set diff --git a/projects/Amlogic/packages/linux/package.mk b/projects/Amlogic/packages/linux/package.mk index 491a864acb..c2f8e2dfe8 100644 --- a/projects/Amlogic/packages/linux/package.mk +++ b/projects/Amlogic/packages/linux/package.mk @@ -18,7 +18,7 @@ PKG_PATCH_DIRS+="${DEVICE}" case ${DEVICE} in S922X*) - PKG_VERSION="6.1.63" + PKG_VERSION="6.1.64" PKG_URL="https://www.kernel.org/pub/linux/kernel/v6.x/${PKG_NAME}-${PKG_VERSION}.tar.xz" ;; esac diff --git a/projects/Amlogic/packages/linux/patches/S922X/001.02-Add-ODROID-GO-Ultra-device-tree.patch b/projects/Amlogic/packages/linux/patches/S922X/001.02-Add-ODROID-GO-Ultra-device-tree.patch index a85bca7892..d4cf366254 100644 --- a/projects/Amlogic/packages/linux/patches/S922X/001.02-Add-ODROID-GO-Ultra-device-tree.patch +++ b/projects/Amlogic/packages/linux/patches/S922X/001.02-Add-ODROID-GO-Ultra-device-tree.patch @@ -1,9 +1,9 @@ diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts new file mode 100644 -index 000000000000..d0a7ba2c2bd4 +index 000000000000..f42ebb59a59c --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts -@@ -0,0 +1,935 @@ +@@ -0,0 +1,1001 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Neil Armstrong @@ -11,7 +11,7 @@ index 000000000000..d0a7ba2c2bd4 + +/dts-v1/; + -+#include "meson-g12b-s922x.dtsi" ++#include "meson-g12b-a311d.dtsi" +#include +#include +#include @@ -361,6 +361,72 @@ index 000000000000..d0a7ba2c2bd4 + clock-latency = <50000>; +}; + ++/* RK817 only supports 12.5mV steps, round up the values */ ++&cpu_opp_table_0 { ++ opp-1000000000 { ++ opp-microvolt = <737500>; ++ }; ++ opp-1200000000 { ++ opp-microvolt = <737500>; ++ }; ++ opp-1398000000 { ++ opp-microvolt = <762500>; ++ }; ++ opp-1512000000 { ++ opp-microvolt = <800000>; ++ }; ++ opp-1608000000 { ++ opp-microvolt = <837500>; ++ }; ++ opp-1704000000 { ++ opp-microvolt = <862500>; ++ }; ++ opp-1800000000 { ++ opp-microvolt = <987500>; ++ }; ++ opp-1908000000 { ++ opp-hz = /bits/ 64 <1908000000>; ++ opp-microvolt = <1050000>; ++ }; ++}; ++ ++/* RK818 only supports 12.5mV steps, round up the values */ ++&cpub_opp_table_1 { ++ opp-1000000000 { ++ opp-microvolt = <775000>; ++ }; ++ opp-1200000000 { ++ opp-microvolt = <775000>; ++ }; ++ opp-1398000000 { ++ opp-microvolt = <800000>; ++ }; ++ opp-1512000000 { ++ opp-microvolt = <825000>; ++ }; ++ opp-1608000000 { ++ opp-microvolt = <862500>; ++ }; ++ opp-1704000000 { ++ opp-microvolt = <900000>; ++ }; ++ opp-1800000000 { ++ opp-microvolt = <987500>; ++ }; ++ opp-1908000000 { ++ opp-microvolt = <1025000>; ++ }; ++ opp-2016000000 { ++ opp-microvolt = <1025000>; ++ }; ++ opp-2108000000 { ++ opp-microvolt = <1025000>; ++ }; ++ opp-2208000000 { ++ opp-microvolt = <1050000>; ++ }; ++}; ++ +&i2c_AO { + status = "okay"; + pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>; diff --git a/projects/Amlogic/packages/linux/patches/S922X/001.03-Add-Powkiddy-RGB10-MAX-3-device-tree.patch b/projects/Amlogic/packages/linux/patches/S922X/001.03-Add-Powkiddy-RGB10-MAX-3-device-tree.patch index 52528e24f3..dc18916df9 100644 --- a/projects/Amlogic/packages/linux/patches/S922X/001.03-Add-Powkiddy-RGB10-MAX-3-device-tree.patch +++ b/projects/Amlogic/packages/linux/patches/S922X/001.03-Add-Powkiddy-RGB10-MAX-3-device-tree.patch @@ -1,9 +1,9 @@ diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-powkiddy-rgb10-max-3.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-powkiddy-rgb10-max-3.dts new file mode 100644 -index 000000000000..fd4f97b5ccd3 +index 000000000000..877663f6fb7c --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-powkiddy-rgb10-max-3.dts -@@ -0,0 +1,924 @@ +@@ -0,0 +1,986 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Neil Armstrong @@ -350,6 +350,68 @@ index 000000000000..fd4f97b5ccd3 + clock-latency = <50000>; +}; + ++/* RK817 only supports 12.5mV steps, round up the values */ ++&cpu_opp_table_0 { ++ opp-1000000000 { ++ opp-microvolt = <760000>; ++ }; ++ opp-1200000000 { ++ opp-microvolt = <780000>; ++ }; ++ opp-1398000000 { ++ opp-microvolt = <800000>; ++ }; ++ opp-1512000000 { ++ opp-microvolt = <860000>; ++ }; ++ opp-1608000000 { ++ opp-microvolt = <900000>; ++ }; ++ opp-1704000000 { ++ opp-microvolt = <950000>; ++ }; ++ opp-1800000000 { ++ opp-microvolt = <1000000>; ++ }; ++}; ++ ++/* RK818 only supports 12.5mV steps, round up the values */ ++&cpub_opp_table_1 { ++ opp-1000000000 { ++ opp-microvolt = <775000>; ++ }; ++ opp-1200000000 { ++ opp-microvolt = <775000>; ++ }; ++ opp-1398000000 { ++ opp-microvolt = <800000>; ++ }; ++ opp-1512000000 { ++ opp-microvolt = <825000>; ++ }; ++ opp-1608000000 { ++ opp-microvolt = <862500>; ++ }; ++ opp-1704000000 { ++ opp-microvolt = <900000>; ++ }; ++ opp-1800000000 { ++ opp-microvolt = <987500>; ++ }; ++ opp-1908000000 { ++ opp-microvolt = <1025000>; ++ }; ++ opp-2016000000 { ++ opp-microvolt = <1025000>; ++ }; ++ opp-2108000000 { ++ opp-microvolt = <1025000>; ++ }; ++ opp-2208000000 { ++ opp-microvolt = <1050000>; ++ }; ++}; ++ +&i2c_AO { + status = "okay"; + pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>; diff --git a/projects/Rockchip/devices/RK3326/linux/linux.aarch64.conf b/projects/Rockchip/devices/RK3326/linux/linux.aarch64.conf index 0492efde51..939f35d345 100644 --- a/projects/Rockchip/devices/RK3326/linux/linux.aarch64.conf +++ b/projects/Rockchip/devices/RK3326/linux/linux.aarch64.conf @@ -1,15 +1,15 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 6.1.28 Kernel Configuration +# Linux/arm64 6.1.64 Kernel Configuration # CONFIG_CC_VERSION_TEXT="aarch64-libreelec-linux-gnueabi-gcc-12.3.0 (GCC) 12.3.0" CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=120300 CONFIG_CLANG_VERSION=0 CONFIG_AS_IS_GNU=y -CONFIG_AS_VERSION=24000 +CONFIG_AS_VERSION=24100 CONFIG_LD_IS_BFD=y -CONFIG_LD_VERSION=24000 +CONFIG_LD_VERSION=24100 CONFIG_LLD_VERSION=0 CONFIG_CC_CAN_LINK=y CONFIG_CC_CAN_LINK_STATIC=y @@ -196,7 +196,7 @@ CONFIG_SCHED_AUTOGROUP=y # CONFIG_SYSFS_DEPRECATED is not set CONFIG_RELAY=y CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="" +CONFIG_INITRAMFS_SOURCE="@INITRAMFS_SOURCE@" CONFIG_INITRAMFS_ROOT_UID=0 CONFIG_INITRAMFS_ROOT_GID=0 CONFIG_RD_GZIP=y @@ -340,6 +340,7 @@ CONFIG_ARCH_ROCKCHIP=y # # ARM errata workarounds via the alternatives framework # +CONFIG_AMPERE_ERRATUM_AC03_CPU_38=y CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y CONFIG_ARM64_ERRATUM_826319=y CONFIG_ARM64_ERRATUM_827319=y @@ -370,6 +371,7 @@ CONFIG_ARM64_ERRATUM_2054223=y CONFIG_ARM64_ERRATUM_2067961=y CONFIG_ARM64_ERRATUM_2441009=y CONFIG_ARM64_ERRATUM_2457168=y +CONFIG_ARM64_ERRATUM_2966298=y CONFIG_CAVIUM_ERRATUM_22375=y CONFIG_CAVIUM_ERRATUM_23154=y CONFIG_CAVIUM_ERRATUM_27456=y @@ -569,14 +571,14 @@ CONFIG_CPU_FREQ_STAT=y # CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y # @@ -930,6 +932,7 @@ CONFIG_ARCH_HAS_PTE_SPECIAL=y # CONFIG_ANON_VMA_NAME is not set # CONFIG_USERFAULTFD is not set # CONFIG_LRU_GEN is not set +CONFIG_LOCK_MM_AND_FIND_VMA=y # # Data Access Monitoring @@ -1999,12 +2002,13 @@ CONFIG_WLCORE=m # CONFIG_WLCORE_SDIO is not set # CONFIG_WLAN_VENDOR_ZYDAS is not set CONFIG_WLAN_VENDOR_QUANTENNA=y +CONFIG_ESP8089=m +CONFIG_ESP8089_DEBUG_FS=y # CONFIG_MAC80211_HWSIM is not set CONFIG_USB_NET_RNDIS_WLAN=m # CONFIG_VIRT_WIFI is not set # CONFIG_WAN is not set -CONFIG_ESP8089=m -CONFIG_ESP8089_DEBUG_FS=y + # # Wireless WAN # @@ -3282,7 +3286,7 @@ CONFIG_VIDEO_CX25840=m # Graphics support # CONFIG_DRM=y -CONFIG_DRM_MIPI_DBI=y +CONFIG_DRM_MIPI_DBI=m CONFIG_DRM_MIPI_DSI=y # CONFIG_DRM_DEBUG_MM is not set CONFIG_DRM_KMS_HELPER=y @@ -4815,8 +4819,8 @@ CONFIG_DEVFREQ_GOV_PASSIVE=y # # DEVFREQ Drivers # -CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ=y CONFIG_ARM_RK3399_DMC_DEVFREQ=y +CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ=y CONFIG_PM_DEVFREQ_EVENT=y CONFIG_DEVFREQ_EVENT_ROCKCHIP_DFI=y CONFIG_EXTCON=y @@ -5555,7 +5559,7 @@ CONFIG_FUSE_FS=m CONFIG_CUSE=m # CONFIG_VIRTIO_FS is not set CONFIG_OVERLAY_FS=y -# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set +CONFIG_OVERLAY_FS_REDIRECT_DIR=y CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y # CONFIG_OVERLAY_FS_INDEX is not set # CONFIG_OVERLAY_FS_XINO_AUTO is not set diff --git a/projects/Rockchip/devices/RK3399/linux/linux.aarch64.conf b/projects/Rockchip/devices/RK3399/linux/linux.aarch64.conf index 5b65575ac2..ba9f09a05c 100644 --- a/projects/Rockchip/devices/RK3399/linux/linux.aarch64.conf +++ b/projects/Rockchip/devices/RK3399/linux/linux.aarch64.conf @@ -5156,7 +5156,7 @@ CONFIG_FUSE_FS=y # CONFIG_CUSE is not set # CONFIG_VIRTIO_FS is not set CONFIG_OVERLAY_FS=y -# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set +CONFIG_OVERLAY_FS_REDIRECT_DIR=y CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y # CONFIG_OVERLAY_FS_INDEX is not set # CONFIG_OVERLAY_FS_XINO_AUTO is not set diff --git a/projects/Rockchip/devices/RK3566-X55/linux/linux.aarch64.conf b/projects/Rockchip/devices/RK3566-X55/linux/linux.aarch64.conf index 1e3a090b3c..b734999e09 100644 --- a/projects/Rockchip/devices/RK3566-X55/linux/linux.aarch64.conf +++ b/projects/Rockchip/devices/RK3566-X55/linux/linux.aarch64.conf @@ -5341,7 +5341,7 @@ CONFIG_INOTIFY_USER=y CONFIG_FUSE_FS=y # CONFIG_CUSE is not set CONFIG_OVERLAY_FS=y -# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set +CONFIG_OVERLAY_FS_REDIRECT_DIR=y CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y # CONFIG_OVERLAY_FS_INDEX is not set # CONFIG_OVERLAY_FS_XINO_AUTO is not set diff --git a/projects/Rockchip/devices/RK3566/linux/linux.aarch64.conf b/projects/Rockchip/devices/RK3566/linux/linux.aarch64.conf index 1511567016..f64fb821c0 100644 --- a/projects/Rockchip/devices/RK3566/linux/linux.aarch64.conf +++ b/projects/Rockchip/devices/RK3566/linux/linux.aarch64.conf @@ -5507,7 +5507,7 @@ CONFIG_INOTIFY_USER=y CONFIG_FUSE_FS=y # CONFIG_CUSE is not set CONFIG_OVERLAY_FS=y -# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set +CONFIG_OVERLAY_FS_REDIRECT_DIR=y CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y # CONFIG_OVERLAY_FS_INDEX is not set # CONFIG_OVERLAY_FS_XINO_AUTO is not set diff --git a/projects/Rockchip/devices/RK3588/linux/linux.aarch64.conf b/projects/Rockchip/devices/RK3588/linux/linux.aarch64.conf index d0dde995de..5099143706 100644 --- a/projects/Rockchip/devices/RK3588/linux/linux.aarch64.conf +++ b/projects/Rockchip/devices/RK3588/linux/linux.aarch64.conf @@ -7295,7 +7295,7 @@ CONFIG_FUSE_FS=m CONFIG_CUSE=m # CONFIG_VIRTIO_FS is not set CONFIG_OVERLAY_FS=m -# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set +CONFIG_OVERLAY_FS_REDIRECT_DIR=y CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y # CONFIG_OVERLAY_FS_INDEX is not set # CONFIG_OVERLAY_FS_XINO_AUTO is not set diff --git a/projects/Rockchip/packages/linux/package.mk b/projects/Rockchip/packages/linux/package.mk index cdb2ea1169..552bdcec32 100644 --- a/projects/Rockchip/packages/linux/package.mk +++ b/projects/Rockchip/packages/linux/package.mk @@ -36,7 +36,7 @@ case ${DEVICE} in PKG_GIT_CLONE_BRANCH="main" ;; RK33*) - PKG_VERSION="6.1.63" + PKG_VERSION="6.1.64" PKG_URL="https://www.kernel.org/pub/linux/kernel/v6.x/${PKG_NAME}-${PKG_VERSION}.tar.xz" ;; esac diff --git a/projects/Rockchip/packages/linux/patches/RK3399/000-rk3399-devices.patch b/projects/Rockchip/packages/linux/patches/RK3399/000-rk3399-devices.patch index 5513702ece..b8772921c4 100644 --- a/projects/Rockchip/packages/linux/patches/RK3399/000-rk3399-devices.patch +++ b/projects/Rockchip/packages/linux/patches/RK3399/000-rk3399-devices.patch @@ -1,6 +1,6 @@ diff -rupN linux.orig/Makefile linux/Makefile ---- linux.orig/Makefile 2023-11-14 03:58:03.064741025 +0000 -+++ linux/Makefile 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/Makefile 2023-11-28 13:54:58.570108474 +0000 ++++ linux/Makefile 2023-11-28 19:50:16.215638386 +0000 @@ -826,6 +826,8 @@ KBUILD_CFLAGS += $(call cc-disable-warni KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) @@ -20,8 +20,8 @@ diff -rupN linux.orig/Makefile linux/Makefile # Require designated initializers for all marked structures KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/Makefile linux/arch/arm64/boot/dts/rockchip/Makefile ---- linux.orig/arch/arm64/boot/dts/rockchip/Makefile 2023-11-14 03:58:03.288746149 +0000 -+++ linux/arch/arm64/boot/dts/rockchip/Makefile 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/arch/arm64/boot/dts/rockchip/Makefile 2023-11-28 13:54:59.138120459 +0000 ++++ linux/arch/arm64/boot/dts/rockchip/Makefile 2023-11-28 19:50:16.215638386 +0000 @@ -21,6 +21,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-li dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-orion-r68-meta.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-px5-evb.dtb @@ -32,8 +32,8 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/Makefile linux/arch/arm64/boo dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-ficus.dtb diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi --- linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi 1970-01-01 00:00:00.000000000 +0000 -+++ linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi 2023-11-15 14:15:47.804831632 +0000 -@@ -0,0 +1,133 @@ ++++ linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi 2023-11-28 23:23:39.023319423 +0000 +@@ -0,0 +1,141 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2016-2017 Fuzhou Rockchip Electronics Co., Ltd @@ -46,24 +46,28 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dts + opp-shared; + + opp00 { -+ opp-hz = /bits/ 64 <1008000000>; -+ opp-microvolt = <925000>; ++ opp-hz = /bits/ 64 <600000000>; ++ opp-microvolt = <825000>; + }; + opp01 { -+ opp-hz = /bits/ 64 <1200000000>; -+ opp-microvolt = <1000000>; ++ opp-hz = /bits/ 64 <1008000000>; ++ opp-microvolt = <900000>; + }; + opp02 { -+ opp-hz = /bits/ 64 <1416000000>; -+ opp-microvolt = <1125000>; ++ opp-hz = /bits/ 64 <1200000000>; ++ opp-microvolt = <975000>; + }; + opp03 { -+ opp-hz = /bits/ 64 <1512000000>; -+ opp-microvolt = <1200000>; ++ opp-hz = /bits/ 64 <1416000000>; ++ opp-microvolt = <1100000>; + }; + opp04 { ++ opp-hz = /bits/ 64 <1512000000>; ++ opp-microvolt = <1150000>; ++ }; ++ opp05 { + opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <1225000>; ++ opp-microvolt = <1200000>; + }; + }; + @@ -72,30 +76,34 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dts + opp-shared; + + opp00 { -+ opp-hz = /bits/ 64 <1008000000>; -+ opp-microvolt = <875000>; ++ opp-hz = /bits/ 64 <600000000>; ++ opp-microvolt = <825000>; + }; + opp01 { -+ opp-hz = /bits/ 64 <1200000000>; -+ opp-microvolt = <950000>; ++ opp-hz = /bits/ 64 <1008000000>; ++ opp-microvolt = <850000>; + }; + opp02 { -+ opp-hz = /bits/ 64 <1416000000>; -+ opp-microvolt = <1025000>; ++ opp-hz = /bits/ 64 <1200000000>; ++ opp-microvolt = <900000>; + }; + opp03 { -+ opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <1100000>; ++ opp-hz = /bits/ 64 <1416000000>; ++ opp-microvolt = <975000>; + }; + opp04 { -+ opp-hz = /bits/ 64 <1800000000>; -+ opp-microvolt = <1200000>; ++ opp-hz = /bits/ 64 <1608000000>; ++ opp-microvolt = <1050000>; + }; + opp05 { ++ opp-hz = /bits/ 64 <1800000000>; ++ opp-microvolt = <1150000>; ++ }; ++ opp06 { + opp-hz = /bits/ 64 <1992000000>; + opp-microvolt = <1250000>; + }; -+ opp06 { ++ opp07 { + opp-hz = /bits/ 64 <2088000000>; + opp-microvolt = <1250000>; + }; @@ -105,8 +113,8 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dts + compatible = "operating-points-v2"; + + opp00 { -+ opp-hz = /bits/ 64 <500000000>; -+ opp-microvolt = <875000>; ++ opp-hz = /bits/ 64 <200000000>; ++ opp-microvolt = <800000>; + }; + opp01 { + opp-hz = /bits/ 64 <600000000>; @@ -114,7 +122,7 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dts + }; + opp02 { + opp-hz = /bits/ 64 <800000000>; -+ opp-microvolt = <1100000>; ++ opp-microvolt = <1075000>; + }; + opp03 { + opp-hz = /bits/ 64 <900000000>; @@ -169,7 +177,7 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dts +}; diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts --- linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts 1970-01-01 00:00:00.000000000 +0000 -+++ linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts 2023-11-15 14:10:46.134863088 +0000 ++++ linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts 2023-11-28 19:50:16.215638386 +0000 @@ -0,0 +1,1329 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* @@ -1501,8 +1509,8 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts lin + status = "okay"; +}; diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399.dtsi linux/arch/arm64/boot/dts/rockchip/rk3399.dtsi ---- linux.orig/arch/arm64/boot/dts/rockchip/rk3399.dtsi 2023-11-14 03:58:03.288746149 +0000 -+++ linux/arch/arm64/boot/dts/rockchip/rk3399.dtsi 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/arch/arm64/boot/dts/rockchip/rk3399.dtsi 2023-11-28 13:54:59.142120544 +0000 ++++ linux/arch/arm64/boot/dts/rockchip/rk3399.dtsi 2023-11-28 19:50:16.215638386 +0000 @@ -1469,7 +1469,7 @@ <1000000000>, <150000000>, <75000000>, @@ -1513,8 +1521,8 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399.dtsi linux/arch/arm64/ <100000000>, <50000000>, <400000000>, <400000000>, diff -rupN linux.orig/drivers/gpio/gpio-rockchip.c linux/drivers/gpio/gpio-rockchip.c ---- linux.orig/drivers/gpio/gpio-rockchip.c 2023-11-14 03:58:03.820758323 +0000 -+++ linux/drivers/gpio/gpio-rockchip.c 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/drivers/gpio/gpio-rockchip.c 2023-11-28 13:55:00.750154472 +0000 ++++ linux/drivers/gpio/gpio-rockchip.c 2023-11-28 19:50:16.215638386 +0000 @@ -335,13 +335,13 @@ static void rockchip_irq_demux(struct ir unsigned long pending; unsigned int irq; @@ -1532,8 +1540,8 @@ diff -rupN linux.orig/drivers/gpio/gpio-rockchip.c linux/drivers/gpio/gpio-rockc /* * Triggering IRQ on both rising and falling edge diff -rupN linux.orig/drivers/gpu/drm/panel/Kconfig linux/drivers/gpu/drm/panel/Kconfig ---- linux.orig/drivers/gpu/drm/panel/Kconfig 2023-11-14 03:58:04.344770314 +0000 -+++ linux/drivers/gpu/drm/panel/Kconfig 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/drivers/gpu/drm/panel/Kconfig 2023-11-28 13:55:02.030181481 +0000 ++++ linux/drivers/gpu/drm/panel/Kconfig 2023-11-28 19:50:16.215638386 +0000 @@ -588,6 +588,15 @@ config DRM_PANEL_SHARP_LS043T1LE01 Say Y here if you want to enable support for Sharp LS043T1LE01 qHD (540x960) DSI panel as found on the Qualcomm APQ8074 Dragonboard @@ -1551,8 +1559,8 @@ diff -rupN linux.orig/drivers/gpu/drm/panel/Kconfig linux/drivers/gpu/drm/panel/ tristate "Sharp LS060T1SX01 FullHD video mode panel" depends on OF diff -rupN linux.orig/drivers/gpu/drm/panel/Makefile linux/drivers/gpu/drm/panel/Makefile ---- linux.orig/drivers/gpu/drm/panel/Makefile 2023-11-14 03:58:04.344770314 +0000 -+++ linux/drivers/gpu/drm/panel/Makefile 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/drivers/gpu/drm/panel/Makefile 2023-11-28 13:55:02.030181481 +0000 ++++ linux/drivers/gpu/drm/panel/Makefile 2023-11-28 19:50:16.215638386 +0000 @@ -59,6 +59,7 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o obj-$(CONFIG_DRM_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o @@ -1563,7 +1571,7 @@ diff -rupN linux.orig/drivers/gpu/drm/panel/Makefile linux/drivers/gpu/drm/panel obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7703) += panel-sitronix-st7703.o diff -rupN linux.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c linux/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c --- linux.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c 1970-01-01 00:00:00.000000000 +0000 -+++ linux/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c 2023-11-15 14:10:46.134863088 +0000 ++++ linux/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c 2023-11-28 19:50:16.215638386 +0000 @@ -0,0 +1,360 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* @@ -1926,8 +1934,8 @@ diff -rupN linux.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c linux/driv +MODULE_DESCRIPTION("Panel driver for Sharp LS054B3SX01 1152x1920 Video Mode DSI Panel"); +MODULE_LICENSE("GPL v2"); diff -rupN linux.orig/drivers/input/Kconfig linux/drivers/input/Kconfig ---- linux.orig/drivers/input/Kconfig 2023-11-14 03:58:04.472773245 +0000 -+++ linux/drivers/input/Kconfig 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/drivers/input/Kconfig 2023-11-28 13:55:02.446190257 +0000 ++++ linux/drivers/input/Kconfig 2023-11-28 19:50:16.215638386 +0000 @@ -51,6 +51,19 @@ config INPUT_FF_MEMLESS To compile this driver as a module, choose M here: the module will be called ff-memless. @@ -1949,8 +1957,8 @@ diff -rupN linux.orig/drivers/input/Kconfig linux/drivers/input/Kconfig tristate "Sparse keymap support library" help diff -rupN linux.orig/drivers/input/Makefile linux/drivers/input/Makefile ---- linux.orig/drivers/input/Makefile 2023-11-14 03:58:04.472773245 +0000 -+++ linux/drivers/input/Makefile 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/drivers/input/Makefile 2023-11-28 13:55:02.446190257 +0000 ++++ linux/drivers/input/Makefile 2023-11-28 19:50:16.215638386 +0000 @@ -10,6 +10,7 @@ input-core-y := input.o input-compat.o i input-core-y += touchscreen.o @@ -1961,7 +1969,7 @@ diff -rupN linux.orig/drivers/input/Makefile linux/drivers/input/Makefile obj-$(CONFIG_INPUT_VIVALDIFMAP) += vivaldi-fmap.o diff -rupN linux.orig/drivers/input/input-polldev.c linux/drivers/input/input-polldev.c --- linux.orig/drivers/input/input-polldev.c 1970-01-01 00:00:00.000000000 +0000 -+++ linux/drivers/input/input-polldev.c 2023-11-15 14:10:46.134863088 +0000 ++++ linux/drivers/input/input-polldev.c 2023-11-28 19:50:16.215638386 +0000 @@ -0,0 +1,362 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* @@ -2326,8 +2334,8 @@ diff -rupN linux.orig/drivers/input/input-polldev.c linux/drivers/input/input-po +} +EXPORT_SYMBOL(input_unregister_polled_device); diff -rupN linux.orig/drivers/input/joystick/Kconfig linux/drivers/input/joystick/Kconfig ---- linux.orig/drivers/input/joystick/Kconfig 2023-11-14 03:58:04.472773245 +0000 -+++ linux/drivers/input/joystick/Kconfig 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/drivers/input/joystick/Kconfig 2023-11-28 13:55:02.446190257 +0000 ++++ linux/drivers/input/joystick/Kconfig 2023-11-28 19:50:16.215638386 +0000 @@ -393,6 +393,12 @@ config JOYSTICK_FSIA6B To compile this driver as a module, choose M here: the module will be called fsia6b. @@ -2342,8 +2350,8 @@ diff -rupN linux.orig/drivers/input/joystick/Kconfig linux/drivers/input/joystic bool "N64 controller" depends on MACH_NINTENDO64 diff -rupN linux.orig/drivers/input/joystick/Makefile linux/drivers/input/joystick/Makefile ---- linux.orig/drivers/input/joystick/Makefile 2023-11-14 03:58:04.472773245 +0000 -+++ linux/drivers/input/joystick/Makefile 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/drivers/input/joystick/Makefile 2023-11-28 13:55:02.446190257 +0000 ++++ linux/drivers/input/joystick/Makefile 2023-11-28 19:50:16.215638386 +0000 @@ -30,6 +30,7 @@ obj-$(CONFIG_JOYSTICK_PXRC) += pxrc.o obj-$(CONFIG_JOYSTICK_QWIIC) += qwiic-joystick.o obj-$(CONFIG_JOYSTICK_SENSEHAT) += sensehat-joystick.o @@ -2354,7 +2362,7 @@ diff -rupN linux.orig/drivers/input/joystick/Makefile linux/drivers/input/joysti obj-$(CONFIG_JOYSTICK_STINGER) += stinger.o diff -rupN linux.orig/drivers/input/joystick/singleadcjoy.c linux/drivers/input/joystick/singleadcjoy.c --- linux.orig/drivers/input/joystick/singleadcjoy.c 1970-01-01 00:00:00.000000000 +0000 -+++ linux/drivers/input/joystick/singleadcjoy.c 2023-11-15 14:10:46.134863088 +0000 ++++ linux/drivers/input/joystick/singleadcjoy.c 2023-11-28 19:50:16.215638386 +0000 @@ -0,0 +1,1416 @@ +/*----------------------------------------------------------------------------*/ + @@ -3773,8 +3781,8 @@ diff -rupN linux.orig/drivers/input/joystick/singleadcjoy.c linux/drivers/input/ +late_initcall(joypad_init); +module_exit(joypad_exit); diff -rupN linux.orig/drivers/input/touchscreen/goodix.c linux/drivers/input/touchscreen/goodix.c ---- linux.orig/drivers/input/touchscreen/goodix.c 2023-11-14 03:58:04.488773611 +0000 -+++ linux/drivers/input/touchscreen/goodix.c 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/drivers/input/touchscreen/goodix.c 2023-11-28 13:55:02.482191017 +0000 ++++ linux/drivers/input/touchscreen/goodix.c 2023-11-28 19:50:16.215638386 +0000 @@ -1037,7 +1037,7 @@ retry_get_irq_gpio: default: if (ts->gpiod_int && ts->gpiod_rst) { @@ -3785,8 +3793,8 @@ diff -rupN linux.orig/drivers/input/touchscreen/goodix.c linux/drivers/input/tou } } diff -rupN linux.orig/drivers/power/supply/cw2015_battery.c linux/drivers/power/supply/cw2015_battery.c ---- linux.orig/drivers/power/supply/cw2015_battery.c 2023-11-14 03:58:05.048786424 +0000 -+++ linux/drivers/power/supply/cw2015_battery.c 2023-11-15 14:10:46.134863088 +0000 +--- linux.orig/drivers/power/supply/cw2015_battery.c 2023-11-28 13:55:04.226227817 +0000 ++++ linux/drivers/power/supply/cw2015_battery.c 2023-11-28 19:50:16.215638386 +0000 @@ -553,7 +553,7 @@ static enum power_supply_property cw_bat }; @@ -3798,7 +3806,7 @@ diff -rupN linux.orig/drivers/power/supply/cw2015_battery.c linux/drivers/power/ .num_properties = ARRAY_SIZE(cw_battery_properties), diff -rupN linux.orig/include/linux/input-polldev.h linux/include/linux/input-polldev.h --- linux.orig/include/linux/input-polldev.h 1970-01-01 00:00:00.000000000 +0000 -+++ linux/include/linux/input-polldev.h 2023-11-15 14:10:46.134863088 +0000 ++++ linux/include/linux/input-polldev.h 2023-11-28 19:50:16.215638386 +0000 @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _INPUT_POLLDEV_H