Skip to content

Conversation

@BlitzCityDIY
Copy link
Collaborator

hihi @FoamyGuy - i kept getting a mouse read error in the memory game. this seems to have resolved it (based on the mouse usb host code). wanted you to look at it first before i took it out of draft in case there was context i wasn't aware of

@FoamyGuy
Copy link
Collaborator

The atexit stuff I believe was necessary in order to use a combo keyboard/mouse device and have it resume functioning as a normal keyboard after the memory game exits. It has been a little while since I have tried it that way. I will test it out and see if that issue still exists. I do think there is similar atexit code like this in the Fruit Jam OS launcher and perhaps a few other of my projects.

The rest of this seems good to me though. config_descriptor looks like it was leftover and unused. The "possible" vars names were verbose and just made an extra step of setting the ones that get used by the rest of the code. break after finding a mouse is good as well to stop it from checking any more.

@FoamyGuy
Copy link
Collaborator

I tested this and confirmed that without the atexit code the keyboard (of a keyboard/mouse combo) no longer works in the Fruit Jam OS launcher if you launch memory play a game and then click exit at the end.

I believe the re-attach thing that it's doing in the atexit call gets it back so the keyboard is hooked up as stdin.

I will do some more testing with the mouse from the store to see if I can reproduce the read errors with that and try to resolve them.

Or maybe see if the launcher can detect no keyboard attached to kernel and have the code in there to re-attach it rather than atexit inside of the apps where it got un-attached.

@BlitzCityDIY
Copy link
Collaborator Author

i added back the atexit_callback() and the mouse is not erroring out most of the time. every once and a while i get a usb.core.USBError: inside atexit callback but its still better than before

Copy link
Collaborator

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

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

Looks good to me, thank you!

If we do see UsbError pop-up from the code in atexit with the basic mouse, I think it may be okay to just catch that exception and pass. The mouse shouldn't need to re-attach so I think everything else may still work if we catch that exception and let it go on.

@BlitzCityDIY BlitzCityDIY marked this pull request as ready for review November 18, 2025 18:45
@BlitzCityDIY BlitzCityDIY merged commit eda671c into main Nov 18, 2025
8 checks passed
@BlitzCityDIY BlitzCityDIY deleted the memory_mouse branch November 18, 2025 18:50
@RetiredWizard
Copy link
Contributor

Just a late thought... There were some relatively recent changes to the core USB support that resulted in some of the device attributes frequently throwing USBError (device.idVendor, device.idProduct, device.manufacturer, etc).

If you're still seeing errors, you might try catching that error with a try/except/pass around the information print statements.

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.

4 participants