Skip to content

Add power switch to enable/disable the selected wheel#347

Open
ayozetr wants to merge 1 commit into
berarma:masterfrom
ayozetr:feature/wheel-power-toggle
Open

Add power switch to enable/disable the selected wheel#347
ayozetr wants to merge 1 commit into
berarma:masterfrom
ayozetr:feature/wheel-power-toggle

Conversation

@ayozetr

@ayozetr ayozetr commented Jun 13, 2026

Copy link
Copy Markdown

What

Adds a per-device power switch next to the device selector that enables/disables the selected wheel for the whole system, without unplugging it. When disabled, no game or application can see the wheel — useful when the wheel interferes with other games.

It writes to the USB device's authorized sysfs attribute (1 = visible, 0 = hidden), the same mechanism udisks/kernel expose for USB authorization.

Behaviour

  • Turning the switch off deauthorizes the wheel. It then leaves the input subsystem and disappears from the device list, so the switch keeps representing it (off) and shows a small status label (Re-enable <device>) next to it.
  • Turning the switch back on re-authorizes it using the stored USB path (the usb_device node and its authorized attribute persist while the wheel stays plugged in).
  • The disabled wheel is remembered (persisted in config.ini) so it can be re-enabled even after disappearing from the list or restarting the app.

Implementation

  • device: track usb_path and add is_authorized / can_set_authorized / set_authorized.
  • device_manager: resolve usb_path via udevice.find_parent('usb', 'usb_device') and add authorize_path to re-enable a wheel that already left the input subsystem.
  • gui: wire the switch to the selected device, with a status label and a remembered disabled wheel; update_power_controls keeps the switch coherent on every device-list refresh.
  • main.ui / gtk_ui / gtk_handlers: the switch and status label.

Permissions

authorized is owned by root, so a new udev rule data/udev/99-oversteer-wheel-power.rules grants write access to it for the supported wheels only (matched by vendor/product id, avoiding mice/keyboards). It's installed by the existing install_udev_files() flow (pkexec), like the other rules. If the rule is missing, writing fails gracefully and the permissions dialog is shown.

Translations

The new strings (Power, the tooltip, Re-enable {}, the permission message) are translated into all 9 languages (ca, de, es, fi, gl, hu, pl, ru, tr), following each catalogue's existing terminology and tone.

Notes

  • Verified msgfmt --check on all 9 catalogues and that the new strings resolve via gettext.
  • Tested against a Logitech G923 on the authorized sysfs path.

@ayozetr ayozetr closed this Jun 13, 2026
Add a per-device power switch that authorizes/deauthorizes the selected
wheel at the USB level (sysfs 'authorized'), hiding it from every game and
application without unplugging it.

A deauthorized wheel leaves the input subsystem and disappears from the
device list, so the switch keeps representing it (off, with a status label
showing how to re-enable it) until the user flips the switch back on. The
disabled wheel is remembered (persisted in config) and re-enabled by writing
to its stored USB path.

- device: track usb_path and add is_authorized/can_set_authorized/set_authorized
- device_manager: resolve usb_path via find_parent and add authorize_path to
  re-enable a wheel that already left the input subsystem
- gui: power switch wired to the selected device, with a status label and
  remembered disabled wheel; update_power_controls keeps the switch coherent
  on every device-list refresh
- udev: new 99-oversteer-wheel-power.rules granting write access to the
  'authorized' attribute for supported wheels only
- po: translate the new strings (Power, Re-enable, tooltip, permission
  message) into all 9 languages
@ayozetr ayozetr reopened this Jun 13, 2026
@ayozetr ayozetr force-pushed the feature/wheel-power-toggle branch from 46e695f to ec74519 Compare June 13, 2026 22:35
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