Skip to content

Conversation

@honjow
Copy link
Contributor

@honjow honjow commented Aug 28, 2025

Fix MSI Claw Device Issues

Problem

  • XInput mode startup failure with "Device or resource busy" error
  • Physical devices remained inaccessible (000 permissions) after HHD stops
  • Power button not detected on MSI Claw A8

Solution

  • Add explicit ungrab() in GenericGamepadEvdev.close() to prevent resource leaks
  • Implement dynamic grabbing for desktop detectors with graceful error handling (inspired by ROG Ally implementation)
  • Fix unhide_all() to trigger udev reload even when device tracking list is empty
  • Add gpio-keys identifier for MSI Claw A8 power button

Resolves critical usability issues for MSI Claw users including XInput mode startup and proper device cleanup.

@antheas
Copy link
Contributor

antheas commented Aug 28, 2025

Add explicit ungrab() in GenericGamepadEvdev.close() to prevent resource leaks

Shouldn't closing the fd descriptor automatically do that?

d_kbd_2.dev.grab()
d_kbd_2_grabbed = True
except Exception:
pass # Ignore grab failures, continue without grabbing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would there be a grab failure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just referenced Ally's implementation.

# If no specific devices to reload but we removed rules, reload all input devices
if removed and not _hidden:
subprocess.run(["udevadm", "trigger", "--subsystem-match=input"], capture_output=True)
subprocess.run(["udevadm", "settle"], capture_output=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does settle do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waits for all events to finish

"MSI Claw A8",
"Claw A8 BZ2EM",
type="only_press",
phys=["gpio-keys", "LNXPWRBN", "PNP0C0C"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does grabbing gpio-keys break the volume buttons?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does grabbing gpio-keys break the volume buttons?

will not

@honjow
Copy link
Contributor Author

honjow commented Aug 28, 2025

Add explicit ungrab() in GenericGamepadEvdev.close() to prevent resource leaks

Shouldn't closing the fd descriptor automatically do that?

But according to my tests, without adding it, the MSI Xbox device cannot ungrab properly. Perhaps I haven't found the right reason ?

@antheas
Copy link
Contributor

antheas commented Aug 28, 2025

Add explicit ungrab() in GenericGamepadEvdev.close() to prevent resource leaks

Shouldn't closing the fd descriptor automatically do that?

But according to my tests, without adding it, the MSI Xbox device cannot ungrab properly. Perhaps I haven't found the right reason ?

If not it means the device wasnt closed properly and there is a descriptor leak. Perhaps during init. Otherwise, there is a chance the overlay has temporarily grabbed it because it is open.

@honjow
Copy link
Contributor Author

honjow commented Aug 28, 2025

Add explicit ungrab() in GenericGamepadEvdev.close() to prevent resource leaks

Shouldn't closing the fd descriptor automatically do that?

But according to my tests, without adding it, the MSI Xbox device cannot ungrab properly. Perhaps I haven't found the right reason ?

If not it means the device wasnt closed properly and there is a descriptor leak. Perhaps during init. Otherwise, there is a chance the overlay has temporarily grabbed it because it is open.

Then I probably haven't found the root cause.

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.

2 participants