From 91653b2c2c1c7efb3bc4b18e8e4b23ee859a7d74 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 20 Jun 2024 17:05:49 +0100 Subject: [PATCH] score_ports: Move the "gw-compat" scoring into rank order --- src/greaseweazle/tools/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/greaseweazle/tools/util.py b/src/greaseweazle/tools/util.py index 73b42fff..c30968f1 100644 --- a/src/greaseweazle/tools/util.py +++ b/src/greaseweazle/tools/util.py @@ -345,11 +345,13 @@ def score_port(x, old_port=None): elif x.vid == 0x1209 and x.pid == 0x4d69: # Our very own properly-assigned PID. Guaranteed to be us. score = 20 + elif x.product and "gw-compat" in x.product.lower(): + # Device self-reports as "Greaseweazle compatible" via its product + # string. Let's judge it not *quite* as good as the real thing. ;) + score = 19 elif x.vid == 0x1209 and x.pid == 0x0001: # Our old shared Test PID. It's not guaranteed to be us. score = 10 - if "gw-compat" in x.product.lower(): - score = 19 if score > 0 and valid_ser_id(x.serial_number): # A valid serial id is a good sign unless this is a reopen, and # the serials don't match!