hwPortUtils.listComPorts: Don't barf when SPDRP_FRIENDLYNAME is invalid#6462
Conversation
…ms which made some braille display drivers unusable. hwPortUtils.listComPorts: In some rare cases, the SPDRP_FRIENDLYNAME registry property doesn't exist/isn't valid. In these cases, just use the port name as the friendly name. Re #6007.
|
@feerrenrut, mind taking a peek? |
feerrenrut
left a comment
There was a problem hiding this comment.
I added a couple of questions, I'll leave it up to you.
| @@ -231,7 +231,9 @@ def __str__(self): | |||
| ): | |||
| # Ignore ERROR_INSUFFICIENT_BUFFER | |||
| if ctypes.GetLastError() != ERROR_INSUFFICIENT_BUFFER: | |||
There was a problem hiding this comment.
Unrelated to your change. While it might be unlikely I think it would be a good idea to log an insufficient buffer error.
| raise ctypes.WinError() | ||
| # #6007: SPDRP_FRIENDLYNAME sometimes doesn't exist/isn't valid. | ||
| log.debugWarning("Couldn't get SPDRP_FRIENDLYNAME for %s: %s" % (port, ctypes.WinError())) | ||
| entry["friendlyName"] = port |
There was a problem hiding this comment.
could port be an empty string? Would that matter?
|
I'm so glad I was able to help you developer guys out with fixing NVDA On 10/14/2016 12:16 AM, James Teh wrote:
mozilla thunderbird email client |
…or FriendlyName, log a warning and fall back to PortName for ERROR_INSUFFICIENT_BUFFER too.
|
@feerrenrut, I realised that we depend on friendlyName and it wasn't being set at all on ERROR_INSUFFICIENT_BUFFER. So, we now just treat ERROR_INSUFFICIENT_BUFFER the same as any other error for friendlyName. Also, just in case, I handle port being empty. Can you please take another look? Ta! |
Fixed another rare issue when scanning for serial ports on some systems which made some braille display drivers unusable.
hwPortUtils.listComPorts: In some rare cases, the SPDRP_FRIENDLYNAME registry property doesn't exist/isn't valid. In these cases, just use the port name as the friendly name.
Originally reported by @joshknnd1982 in #6007 (comment)
While we're at it: