Add power switch to enable/disable the selected wheel#347
Open
ayozetr wants to merge 1 commit into
Open
Conversation
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
46e695f to
ec74519
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
authorizedsysfs attribute (1= visible,0= hidden), the same mechanismudisks/kernel expose for USB authorization.Behaviour
Re-enable <device>) next to it.usb_devicenode and itsauthorizedattribute persist while the wheel stays plugged in).config.ini) so it can be re-enabled even after disappearing from the list or restarting the app.Implementation
device: trackusb_pathand addis_authorized/can_set_authorized/set_authorized.device_manager: resolveusb_pathviaudevice.find_parent('usb', 'usb_device')and addauthorize_pathto 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_controlskeeps the switch coherent on every device-list refresh.main.ui/gtk_ui/gtk_handlers: the switch and status label.Permissions
authorizedis owned by root, so a new udev ruledata/udev/99-oversteer-wheel-power.rulesgrants write access to it for the supported wheels only (matched by vendor/product id, avoiding mice/keyboards). It's installed by the existinginstall_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
msgfmt --checkon all 9 catalogues and that the new strings resolve via gettext.authorizedsysfs path.