linux.x86.linphone/fixes/hidapi-crash-fix
data d00cff194f add hidapi stub fix for HID crash on systems without hidraw access
When /dev/hidraw* devices are not accessible, liblinphone crashes in
HidDevice::stopPollTimer(). This adds a stub hidapi implementation
that returns empty device lists, preventing the crash while disabling
USB headset button support.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 14:43:49 +01:00
..
hidapi_dummy.c add hidapi stub fix for HID crash on systems without hidraw access 2026-02-06 14:43:49 +01:00
README.md add hidapi stub fix for HID crash on systems without hidraw access 2026-02-06 14:43:49 +01:00

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)