Skip to content

Battery percentage not shown for devices using kernel HID driver (PS4/PS5 controllers) #134

@jamerrq

Description

@jamerrq

Some Bluetooth devices (notably PS4/PS5 DualShock/DualSense controllers) report their
battery level through the kernel HID driver instead of the Bluetooth Battery Service (BAS)
profile. This means BlueZ does not expose the org.bluez.Battery1 D-Bus interface for
these devices, and bluetui shows no battery percentage even though the information is
available.

Steps to Reproduce

  1. Connect a PS4 DualShock 4 controller via Bluetooth
  2. Verify battery is reported by the kernel:
    $ cat /sys/class/power_supply/ps-controller-battery-XX:XX:XX:XX:XX:XX/capacity 75
  3. Verify BlueZ does NOT expose Battery1:
$ dbus-send --system --dest=org.bluez --print-reply

/org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX

org.freedesktop.DBus.Properties.GetAll string:"org.bluez.Battery1" Error

org.freedesktop.DBus.Error.InvalidArgs: No such interface 'org.bluez.Battery1'
  1. Open bluetui — no Battery column is shown
Image

Expected Behavior

The battery percentage should be displayed for these devices.

Proposed Solution

Add a fallback that reads from /sys/class/power_supply/ when bluer returns None
for battery_percentage(). The fallback matches device entries by MAC address in the
sysfs directory name and reads the capacity file.
This is a ~20-line change in bluetooth.rs, synchronous, with no new dependencies.

Environment

  • OS: Arch Linux
  • Kernel: Linux 6.19.10-arch1-1
  • BlueZ: 5.85
  • bluetui: 0.8.1
  • Device: Sony DualShock 4 (CUH-ZCT2U)
Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions