# HID Crash Fix for Linphone ## Problem Linphone crashes on startup with SIGSEGV in `LinphonePrivate::HidDevice::stopPollTimer()` when the user has no read access to `/dev/hidraw*` devices. ## Root Cause The liblinphone SDK's HID subsystem (for USB headset button support) does not handle permission errors gracefully. When `hid_enumerate()` fails or returns devices that cannot be opened, the subsequent timer handling crashes. ## Solution Replace `libhidapi-hidraw.so.0.15.0` inside the AppImage with a stub implementation that: - Returns empty device lists from `hid_enumerate()` - Returns NULL from all `hid_open*()` functions - Returns safe error values from all other operations This disables USB headset button support but prevents the crash. ## Build ```bash gcc -shared -fPIC -O2 -Wall -Wextra -Wpedantic -std=c11 \ -o libhidapi-hidraw.so.0.15.0 hidapi_dummy.c ``` ## Integration into AppImage ```bash # Extract ./Linphone-*.AppImage --appimage-extract # Replace library cp libhidapi-hidraw.so.0.15.0 squashfs-root/lib/ # Repackage ARCH=x86_64 appimagetool squashfs-root Linphone-Fixed.AppImage ``` ## Alternative: System-wide Fix Instead of patching the AppImage, grant HID access to users: ```bash echo 'KERNEL=="hidraw*", TAG+="uaccess", MODE="0666"' | \ sudo tee /etc/udev/rules.d/99-hidraw-permissions.rules sudo udevadm control --reload-rules && sudo udevadm trigger ``` ## Files - `hidapi_dummy.c` - Complete HIDAPI 0.15.0 stub implementation (25 functions)