linux.x86.linphone/fixes/hidapi-crash-fix/README.md
data 3b3bb966d4 Add ringtone selection dropdown and various bugfixes
- Add ComboBox for ringtone selection in Call Settings
- Convert MKV ringtones to WAV format (Linphone only supports WAV)
- Fix ComboSetting to support dialPlan type for international prefix
- Disable account devices feature to prevent API errors
- Disable automatic update check on startup
- Add ringtone fallback to default when custom file not found
- Fix ringtone dropdown to not override setting on initialization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 08:31:15 +01:00

1.5 KiB
Executable file

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

gcc -shared -fPIC -O2 -Wall -Wextra -Wpedantic -std=c11 \
    -o libhidapi-hidraw.so.0.15.0 hidapi_dummy.c

Integration into AppImage

# 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:

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)