Implement 0014 keypad debouncer, Sparkler LRA filter, standby fixes, and stage a1125 (ampere)
- Extend 0012 standby optimizations with removable-SD-only MMC_CAP_AGGRESSIVE_PM | MMC_CAP2_FULL_PWR_CYCLE in sdhci-msm, proxy mem clock and BIMC XO re-parenting + 0x45000 BIT(2) early-vote clear in qcom_q6v5_mss / gcc-msm8909, 100 MHz opp-99999975 floor across qcom-msm8909.dtsi and all 6 device DTS/DTBs, disabled-by-default Bluetooth with bt_enabled persistence, NM ipv6.method=ignore + standby wlan0/disable_ipv6 muting, and post-park DSDS signal hysteresis - Add ABI-preserving system-core keypad debouncer patch 0014 (drivers/input/input.c key_debounce_ms + pm8941-pwrkey press/release chatter holdoff), replace ignored col-scan-delay-ms with col-scan-delay-us = <0x32> and raise DT debounce intervals across all 6 DTS/DTBs, configure per-target key_debounce_ms at boot and xset r rate 300 25, and add C/DTS verification in scripts/test-keypad-debouncer.py - Isolate Nokia 8000 4G (nokia-sparkler / nokia-leo) media playback from the shared 157 Hz SPK_DRV vibrator channel via dynamic Speaker-only filtering in music.so, files.so, and ringtones.so, explicit RX3/SPK mixer zeroing on Earpiece/Headphones/Bluetooth routes in sxmo_audio.sh and preview plugins, and Sparkler/Leo-only /etc/mpv/mpv.conf provisioning - Register upcoming build a1125 (ampere) in scripts/version.sh, scripts/check-rebuild.sh, AGENTS.md, and CHANGELOG.md, fix --for-rebuild pre-rebuild stale output checks in check-rebuild.sh/test-cover-dt.py, rebuild vmlinuz/DTBs/plugins and all 4 --mkinitfs target images stamped a1125 (ampere), and pin their verified SHA-256 checksums
This commit is contained in:
1 parent
c529463ae3
commit
5d427e39ab
55 files changed
+78935
-77569
No files matched your search
@@ -7,15 +7,90 @@
|
||||
#include <X11/Xft/Xft.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <pango/pangoxft.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <clocale>
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace bananarchy;
|
||||
|
||||
constexpr const char* kSparklerSpeakerAf =
|
||||
"lavfi=[highpass=f=260:poles=2,highpass=f=260:poles=2,"
|
||||
"bandreject=f=157:width_type=h:w=80]";
|
||||
|
||||
bool isHapticAudioSpeakerDevice() {
|
||||
const char* env = std::getenv("BANANARCHY_HAPTIC_AUDIO_GUARD");
|
||||
if (env && *env == '1') return true;
|
||||
if (env && *env == '0') return false;
|
||||
|
||||
static int cached = -1;
|
||||
if (cached >= 0) return cached == 1;
|
||||
|
||||
int fd = ::open("/sys/firmware/devicetree/base/compatible",
|
||||
O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
cached = 0;
|
||||
return false;
|
||||
}
|
||||
char buf[256];
|
||||
ssize_t n = ::read(fd, buf, sizeof(buf) - 1);
|
||||
::close(fd);
|
||||
if (n <= 0) {
|
||||
cached = 0;
|
||||
return false;
|
||||
}
|
||||
buf[n] = '\0';
|
||||
const char* p = buf;
|
||||
const char* end = buf + n;
|
||||
while (p < end && *p) {
|
||||
if (std::strcmp(p, "nokia,sparkler") == 0 ||
|
||||
std::strcmp(p, "nokia,leo") == 0) {
|
||||
cached = 1;
|
||||
return true;
|
||||
}
|
||||
p += std::strlen(p) + 1;
|
||||
}
|
||||
cached = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string normalizeAudioRoute(const std::string& raw) {
|
||||
std::string low = toLowerStr(raw);
|
||||
if (low.find("bluetooth") != std::string::npos ||
|
||||
low.find("bluez") != std::string::npos) {
|
||||
return "Bluetooth";
|
||||
}
|
||||
if (low.find("headphone") != std::string::npos ||
|
||||
low.find("headset") != std::string::npos) {
|
||||
return "Headphones";
|
||||
}
|
||||
if (low.find("earpiece") != std::string::npos) {
|
||||
return "Earpiece";
|
||||
}
|
||||
return "Speaker";
|
||||
}
|
||||
|
||||
std::string readActiveAudioRoute(const std::string& cfgDir) {
|
||||
std::string outDev;
|
||||
{
|
||||
std::ifstream ifs("/tmp/sxmo_audio_out_device");
|
||||
if (ifs && std::getline(ifs, outDev) && !outDev.empty()) {
|
||||
return normalizeAudioRoute(outDev);
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ifstream ifs(cfgDir + "/audio_out_device");
|
||||
if (ifs && std::getline(ifs, outDev) && !outDev.empty()) {
|
||||
return normalizeAudioRoute(outDev);
|
||||
}
|
||||
}
|
||||
return "Speaker";
|
||||
}
|
||||
|
||||
volatile sig_atomic_t gRunning = 1;
|
||||
|
||||
void handleSignal(int) {
|
||||
@@ -829,25 +904,62 @@ int runFilesApp(int argc, char** argv) {
|
||||
int rvol = std::clamp(readRingVolumePct(), 0, 100);
|
||||
int rx3 = (rvol <= 0) ? 0 : (56 + (rvol * 32 + 50) / 100);
|
||||
int hp = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100);
|
||||
int ear = (rvol <= 0) ? 0 : (60 + (rvol * 32 + 50) / 100);
|
||||
std::string cfgDir = homeDir + "/.config/sxmo";
|
||||
const char* xdgCfg = std::getenv("XDG_CONFIG_HOME");
|
||||
if (xdgCfg && *xdgCfg) cfgDir = std::string(xdgCfg) + "/sxmo";
|
||||
bool useSparklerAf = isHapticAudioSpeakerDevice() &&
|
||||
readActiveAudioRoute(cfgDir) == "Speaker";
|
||||
std::string afOpt =
|
||||
useSparklerAf ? (std::string("--af=") + kSparklerSpeakerAf) : "";
|
||||
runAsyncCmd("outdev=$(cat /tmp/sxmo_audio_out_device 2>/dev/null); "
|
||||
"if [ \"$outdev\" = \"Bluetooth\" ]; then "
|
||||
" amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX3 Digital Volume'\" 0 >/dev/null 2>&1; "
|
||||
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
|
||||
" pactl set-sink-volume @DEFAULT_SINK@ " + std::to_string(rvol) + "% >/dev/null 2>&1; "
|
||||
"elif [ \"$outdev\" = \"Headphones\" ]; then "
|
||||
" amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='EAR_S'\" 0 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX3 Digital Volume'\" 0 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='EAR_S'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RDAC2 MUX'\" 'RX2' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 'RX1' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX2 MIX1 INP1'\" 'RX2' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='HPHL'\" 'Switch' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='HPHR'\" 'Switch' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX1 Digital Volume'\" " + std::to_string(hp) + " >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX2 Digital Volume'\" " + std::to_string(hp) + " >/dev/null 2>&1; "
|
||||
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
|
||||
" pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; "
|
||||
"elif [ \"$outdev\" = \"Earpiece\" ]; then "
|
||||
" amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX3 Digital Volume'\" 0 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='HPHL'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='HPHR'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX2 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX2 Digital Volume'\" 0 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RDAC2 MUX'\" 'RX1' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 'RX1' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='EAR_S'\" 'Switch' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX1 Digital Volume'\" " + std::to_string(ear) + " >/dev/null 2>&1; "
|
||||
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
|
||||
" pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; "
|
||||
"else "
|
||||
" amixer -c 0 cset \"name='EAR_S'\" 0 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 0 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='EAR_S'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='HPHL'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='HPHR'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX2 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX1 Digital Volume'\" 0 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX2 Digital Volume'\" 0 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='SPK DAC Switch'\" 1 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 3 >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'RX1' >/dev/null 2>&1; "
|
||||
" amixer -c 0 cset \"name='RX3 Digital Volume'\" " + std::to_string(rx3) + " >/dev/null 2>&1; "
|
||||
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
|
||||
" pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; "
|
||||
@@ -868,13 +980,23 @@ int runFilesApp(int argc, char** argv) {
|
||||
::dup2(devNull, STDERR_FILENO);
|
||||
if (devNull > 2) ::close(devNull);
|
||||
}
|
||||
::execlp("mpv", "mpv", "--no-config", "--no-terminal",
|
||||
"--no-resume-playback", "--quiet", "--vo=null",
|
||||
"--no-video", "--ao=pipewire,pulse,alsa",
|
||||
"--audio-channels=stereo", "--audio-samplerate=48000",
|
||||
"--volume-max=150", "--volume=100",
|
||||
"--loop=2", playTarget.c_str(),
|
||||
static_cast<char*>(nullptr));
|
||||
if (!afOpt.empty()) {
|
||||
::execlp("mpv", "mpv", "--no-config", "--no-terminal",
|
||||
"--no-resume-playback", "--quiet", "--vo=null",
|
||||
"--no-video", "--ao=pipewire,pulse,alsa",
|
||||
"--audio-channels=stereo", "--audio-samplerate=48000",
|
||||
"--volume-max=150", "--volume=100", afOpt.c_str(),
|
||||
"--loop=2", playTarget.c_str(),
|
||||
static_cast<char*>(nullptr));
|
||||
} else {
|
||||
::execlp("mpv", "mpv", "--no-config", "--no-terminal",
|
||||
"--no-resume-playback", "--quiet", "--vo=null",
|
||||
"--no-video", "--ao=pipewire,pulse,alsa",
|
||||
"--audio-channels=stereo", "--audio-samplerate=48000",
|
||||
"--volume-max=150", "--volume=100",
|
||||
"--loop=2", playTarget.c_str(),
|
||||
static_cast<char*>(nullptr));
|
||||
}
|
||||
::_exit(127);
|
||||
} else if (pid > 0) {
|
||||
ringPreviewPid = pid;
|
||||
|
||||
Reference in new issue
Block a user