[[email protected]] Peripheral misclassification and device alias swapping on Logitech Unifying receivers

未关闭
#14,113 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 8 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
javascript, linux, python
领域
backend, desktop

调研方向

Start with applets/[email protected]/applet.js and cinnamon-settings/modules/cs_power.py, especially _devicesChanged(), DeviceItem alias resolution, build_battery_page(), and create_battery_row(). Check how device model, device_kind, and device_id are used for labels and aliases; the report includes a GetDevices example showing both peripherals classified as keyboards. Done when the mouse is identified correctly and aliases stay attached to the right peripherals after device enumeration changes.

由索引模型根据 Issue 内容生成。

描述

BUG
Distribution

Arch Linux (Linux kernel 7.2, Wayland session: cinnamon-wayland)

Package version

cinnamon 6.8.0-2

Graphics hardware in use

Intel Corporation IvyBridge GT2 [HD Graphics 4000] (i915 driver)

Frequency

Always

Bug description

When multiple wireless peripherals (a mouse and a keyboard) are paired to a single composite USB receiver (such as a Logitech Unifying or Bolt receiver), two related issues affect the Cinnamon Power applet ([email protected]) and Power Settings (cs_power.py):

1. Misclassification in panel tooltip and icons:
The panel tooltip displays "Keyboard (100%), Keyboard (5%)" because UPower defaults the mouse battery type to UPDeviceKind.KEYBOARD (6) due to the shared USB receiver. However, UPower's Model string correctly reports "Logitech Wireless Mouse". The Cinnamon applet relies strictly on device_kind and ignores the known model name, showing duplicate keyboard icons and tooltips.

2. Random device alias swap / inversion:
When custom device nicknames (aliases) are set in Cinnamon Power Settings, Cinnamon binds them to transient D-Bus object paths (e.g. `/org/freedesktop/UPower/devices/keyboard_hidpp_battery_0`). Because device enumeration order is dynamic (it depends on whether the mouse or keyboard transmits first after boot or wakeup), these numbers swap. This causes the keyboard alias to be applied to the mouse, actively inverting the peripherals in the menu.
Steps to reproduce
1. Pair both a Logitech wireless mouse and a wireless keyboard to a single Logitech Unifying USB receiver.
2. Observe the Cinnamon Power applet tooltip: it displays "Keyboard (XX%), Keyboard (YY%)".
3. Open Cinnamon Settings -> Power and set friendly nicknames (aliases) for the mouse and keyboard.
4. Reboot the computer or wake it up from sleep, moving the mouse first to wake it before typing on the
keyboard.
5. The device numbers assigned by the kernel/UPower invert (_0 becomes _1), causing Cinnamon to assign        the keyboard alias to the mouse and vice-versa.
Expected behavior
1. `[email protected]` should inspect the `model` property (e.g. check if model contains "mouse" or
"keyboard") as an override or fallback to determine the appropriate icon and tooltip string, rather than
relying exclusively on UPower's raw `device_kind`.
2. Device aliases in Cinnamon should be keyed or matched by hardware model / serial number rather than
transient D-Bus object paths (`battery_hidpp_battery_X`) that change order between boots.
Additional information
Output of `busctl --user call org.cinnamon.SettingsDaemon.Power /org/cinnamon/SettingsDaemon/Power
org.cinnamon.SettingsDaemon.Power GetDevices`:

a(sssusduut) 2
  "/org/freedesktop/UPower/devices/keyboard_hidpp_battery_3" "" "Logitech K540/K545" 6 ... 100 ...
  "/org/freedesktop/UPower/devices/keyboard_hidpp_battery_2" "" "Logitech Wireless Mouse" 6 ... 5 ...

Notice both devices have device_kind = 6 (keyboard) from UPower, but model unambiguously identifies "Logitech  Wireless Mouse".

Relevant code locations:
- applets/[email protected]/applet.js:
  - stats generation in _devicesChanged(): PowerUtils.deviceKindToString(device_kind)
  - DeviceItem alias resolution: if (parts[0] == device_id) (matching only volatile D-Bus paths)
- cinnamon-settings/modules/cs_power.py:
  - build_battery_page() and create_battery_row() mapping aliases strictly by device_id.
主要语言
JavaScript
星标
5.7k
派生
941
平均合并
6 天 18 小时
30 天内合并 PR
12

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

linuxmint/cinnamon 的其他 Issue

查看 linuxmint/cinnamon 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。