Skip to content

Bluetooth: replace legacy hcitool with BlueZ DBus API#227

Open
Jonatas-Goncalves wants to merge 2 commits intochrippa:masterfrom
Jonatas-Goncalves:master
Open

Bluetooth: replace legacy hcitool with BlueZ DBus API#227
Jonatas-Goncalves wants to merge 2 commits intochrippa:masterfrom
Jonatas-Goncalves:master

Conversation

@Jonatas-Goncalves
Copy link
Copy Markdown

  • Use BlueZ DBus ObjectManager for device discovery.
  • Replace subprocess calls to hcitool with native dbus communication.
  • Implement discovery and adapter management via org.bluez interfaces.
  • Add support for identifying DualSense and newer controller variants.
  • Modernize Python syntax (f-strings, super()) and improve error handling.
  • Remove dependency on deprecated bluez-utils (hcitool).
  • Update socket management and class inheritance to modern Python standards.
  • Fix crashes on systems where hcitool is not available.

Motivation:
hcitool and hciconfig are deprecated in BlueZ 5 and removed from many modern Linux distributions (like openSUSE, Fedora, and Arch).

Changes:
Switched from subprocess to python-dbus.
Implemented StartDiscovery and StopDiscovery via DBus.
Improved device filtering (now catches "DualSense" and "DualShock").
Refactored the main loop to be less aggressive and use time.sleep().

MaxxedSUSE added 2 commits April 25, 2026 10:32
  * Use BlueZ DBus ObjectManager for device discovery.
  * Replace subprocess calls to hcitool with native dbus communication.
  * Implement discovery and adapter management via org.bluez interfaces.
  * Add support for identifying DualSense and newer controller variants.
  * Modernize Python syntax (f-strings, super()) and improve error handling.
  * Remove dependency on deprecated bluez-utils (hcitool).
  * Update socket management and class inheritance to modern Python standards.
  * Fix crashes on systems where hcitool is not available.
- Implemented UDP telemetry for battery levels on port 54321, allowing
  integration with external tray monitors.
- Added graceful handling for 'BrokenPipeError' when reading Bluetooth
  MAC addresses via hidraw (fixes crashes on modern kernels).
- Added try/except blocks for device grabbing to prevent initialization
  failures when the kernel driver is already active.
- Reduced battery check interval to 5 seconds for more responsive reporting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant