Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serial port detection loop #254

Merged
merged 2 commits into from
May 5, 2021
Merged

Serial port detection loop #254

merged 2 commits into from
May 5, 2021

Conversation

fauxpark
Copy link
Member

Description

This is an attempt to fix a crash that occurs on macOS when the callout device does not appear within 0.5 seconds of the USB device. Instead of sleeping for that time, we just continually loop, under the assumption that a callout device will appear. I think this would be perfectly fine except that as far as I know this is running in the same thread as the UI - but that may be something for another day. It should not block for too long.

The logic is copied on the Windows side, although I think the COM port appears at the same time as the USB device anyway.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

Issues Fixed or Closed by This PR

@fauxpark
Copy link
Member Author

fauxpark commented Apr 30, 2021

Reverted the Windows changes. I've seen a few instances of Caterina devices with the correct usbser driver but strangely no COM port (at least, not one that can be linked to the USB device through WMI). I'm not able to reproduce this, however, so I will need someone to work with on this problem.

Additionally, although the detection logic appears to be run in a separate thread from the UI, the while loop would run forever in this situation, or if the driver is not usbser (tested this with WinUSB). Which may potentially cause issues.

I think I will probably refactor the macOS serial detection code to match against the serial device itself, so that there's no need for this loop or a UI-freezing sleep.

@fauxpark fauxpark merged commit 94bf006 into qmk:master May 5, 2021
@fauxpark fauxpark deleted the serial-port-detection-loop branch May 5, 2021 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants