Battery popout shows phantom 0% "Stylus" peripheral when no pen is present

Aperta Adatta ai principianti
#4,393 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
linux
Ambito
desktop

Direzione di ricerca

Apri quickshell/Services/BatteryService.qml e trova il filtro peripheralDevices che attualmente richiede solo dev.ready; leggi l'helper peripheralIcon circostante e le proprietà del dispositivo UPower su cui si basa per confermare che isPresent è esposto lì. Aggiungi il controllo di presenza al filtro, poi apri il popout della batteria su una macchina (o con un dispositivo UPower simulato) il cui digitizer segnala una batteria non presente e conferma che il riquadro fantasma Stylus è sparito mentre i periferici reali sono ancora elencati. Fatto significa nessuna voce allo 0% per un dispositivo che UPower segnala come assente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

The battery popout shows a phantom "Stylus" peripheral at 0% on laptops whose touchscreen digitizer declares a pen battery, even though no pen exists or is connected. The kernel marks that battery as not present, but BatteryService.peripheralDevices does not check this.

Steps to reproduce
  1. Use a laptop with an ELAN HID touchscreen/digitizer (here ELAN9008:00 04F3:2F2C) and no pen.
  2. Open the battery popout / control center battery detail.
  3. A peripheral tile appears: icon, 0%, name ELAN9008:00 04F3:2F2C Stylus.
Expected

Devices that UPower reports as not present are not listed as peripherals.

Actual

A permanent 0% "Stylus" entry is shown.

Analysis

The kernel hid-input driver creates a power_supply for any HID device that declares a battery usage, regardless of whether a pen is paired:

/sys/class/power_supply/hid-0018:04F3:2F2C.0002-battery-7
  type: Battery
  scope: Device
  present: 0
  capacity: 0
  status: Unknown

upower -i for it reports power supply: no, battery-level: unknown, percentage: 0% (should be ignored).

In quickshell/Services/BatteryService.qml, the filter is:

readonly property var peripheralDevices: refCount === 0 ? [] : UPower.devices.values.filter(dev => dev && dev.ready && !dev.isLaptopBattery && peripheralIcon(dev.type) !== "").map(...)

It only requires dev.ready, so the non-present device passes. UPowerDevice.isPresent is false here.

Suggested fix

Also require the device to be present (and optionally skip unknown state):

UPower.devices.values.filter(dev => dev && dev.ready && dev.isPresent && !dev.isLaptopBattery && peripheralIcon(dev.type) !== "")

UPOWER_IGNORE is not an option on the system side: UPower 1.91.5 does not honor it, and the kernel has no runtime switch to drop this battery.

Environment
  • dux-shell 2.1.2-1 (Arch Linux package)
  • UPower 1.91.5
  • Linux 7.3.5-arch1-1
  • Compositor: Hyprland
Lingua principale
QML
Stelle
8.4k
Fork
549
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AvengeMedia/DankMaterialShell

Tutte le issue di AvengeMedia/DankMaterialShell

Issue simili

Altre issue su Desktop Dev

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.