Skip to content

Comments

Serial port detection loop#254

Merged
fauxpark merged 2 commits intoqmk:masterfrom
fauxpark:serial-port-detection-loop
May 5, 2021
Merged

Serial port detection loop#254
fauxpark merged 2 commits intoqmk:masterfrom
fauxpark:serial-port-detection-loop

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