From 6cd1c6c54d7263972bdcb42d8808a98373a96ac1 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 18 Sep 2024 20:26:44 -0700 Subject: [PATCH] Help Prolific refugees to understand their hostage situation This attempts to warn Windows users who have had their devices poisoned by the Prolific driver heist of the problem and the workaround. Hopefully this will prevent users from opening bugs thinking that CHIRP is at fault. Related to #11552 --- chirp/wxui/clone.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/chirp/wxui/clone.py b/chirp/wxui/clone.py index 2ba15fc2..2b19425c 100644 --- a/chirp/wxui/clone.py +++ b/chirp/wxui/clone.py @@ -19,6 +19,7 @@ import re import textwrap import threading +import webbrowser import serial from serial.tools import list_ports @@ -40,6 +41,10 @@ CUSTOM = _('Custom...') +def is_prolific_warning(string): + return 'PL2303' in string and 'CONTACT YOUR SUPPLIER' in string + + def get_fakes(): return { 'Fake NOP': developer.FakeSerial(), @@ -468,6 +473,18 @@ def _port_assist(self, event): return self.set_ports(after, select=found.device) + def _prolific_assist(self, event): + r = wx.MessageBox( + _('Your Prolific-based USB device will not work without ' + 'reverting to an older version of the driver. Visit the ' + 'CHIRP website to read more about how to resolve this?'), + _('Prolific USB device'), + style=wx.YES | wx.NO | wx.YES_DEFAULT, parent=self) + if r == wx.YES: + webbrowser.open( + 'https://chirpmyradio.com/projects/chirp/wiki/' + 'ProlificDriverDeprecation') + def _add_aliases(self, rclass): for alias in rclass.ALIASES: class DynamicRadioAlias(rclass): @@ -490,6 +507,7 @@ def _persist_choices(self): raise NotImplementedError() def _selected_port(self, event): + okay_btn = self.FindWindowById(self.GetAffirmativeId()) if self._port.GetStringSelection() == CUSTOM: port = wx.GetTextFromUser(_('Enter custom port:'), _('Custom Port'), @@ -501,7 +519,12 @@ def _selected_port(self, event): elif self._port.GetStringSelection() == HELPME: self._port_assist(event) return + elif is_prolific_warning(self._port.GetStringSelection()): + self._prolific_assist(event) + okay_btn.Enable(False) + return self._persist_choices() + okay_btn.Enable(True) def _select_vendor(self, vendor): display_models = []