Files
Arch-R/scripts/unset_preload.c
Douglas Teles 68b9ff798a Audio card working, LD_PRELOAD fix, volume/brightness hotkey fixes
Audio (3-iteration DTS fix chain):
- Removed duplicate pinctrl from codec node (pin conflict)
- Fixed sound-dai to reference &rk817_codec (MFD of_node mismatch)
- Removed DAPM routing/widgets (BSP codec has no DAPM widgets)
- Added 7 missing battery BSP properties

Runtime fixes:
- unset_preload.so prevents gl4es LD_PRELOAD inheritance to subprocesses
- ES Patch 5: getShOutput() null safety for popen() failure
- Volume hotkeys: use 'DAC Playback Volume' (not enum 'Playback')
- Brightness: 5% minimum clamp, persistence across reboots
- current_volume: reads correct ALSA control
- perfmax/perfnorm: guard DMC writes with file existence check

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 21:07:37 -03:00

26 lines
962 B
C

/*
* unset_preload.so — Prevent LD_PRELOAD inheritance to child processes
*
* Problem: ES uses system()/popen() to run shell commands (battery %, distro
* version, etc.). With LD_PRELOAD=gl4es, every subprocess loads gl4es which
* prints init messages to stdout. ES captures these as command output, causing
* "BAT: 87LIBGL: Initialising gl4es..." on screen.
*
* Solution: This tiny library's constructor runs during process init (after
* the dynamic linker has already loaded all LD_PRELOAD libraries into memory).
* It removes LD_PRELOAD from the environment so child processes don't inherit
* it. gl4es remains loaded in the current process (already memory-mapped).
*
* Usage: LD_PRELOAD="/usr/lib/gl4es/libGL.so.1 /usr/lib/unset_preload.so" cmd
*
* Build: aarch64-linux-gnu-gcc -shared -o unset_preload.so unset_preload.c
*/
#include <stdlib.h>
__attribute__((constructor))
static void unset_preload(void)
{
unsetenv("LD_PRELOAD");
}