Skip to content

Commit 509570d

Browse files
mherboldclaude
andcommitted
Detect G Tensioner and Typhoon Wind on FTDI, CP210x, and other Nano USB bridges
Handshake probing was limited to CH340 ports, so Nanos built with FTDI, CP210x, PL2303, CH9102, or genuine Arduino USB interfaces were never probed. Match the device name or PNPDeviceID against all known bridge signatures instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent c224ad3 commit 509570d

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

MarvinsAIRARefactored/Classes/UsbSerialPortHelper.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ public sealed class UsbSerialPortHelper( string handshake = "", string deviceIdT
1414
private const bool _verboseLogging = false;
1515
private const int _probeTimeoutMilliseconds = 1500;
1616

17+
// USB-serial bridge chips found on Arduino Nano boards and clones - handshake probes are only sent to ports whose
18+
// device name or PNPDeviceID matches one of these, so we never write probe text at unrelated serial devices.
19+
// CH340/CH341/CH9102 (WCH, VID 1A86), FT232R (FTDI, VID 0403), CP210x (Silicon Labs, VID 10C4),
20+
// PL2303 (Prolific, VID 067B), and genuine Arduino USB interfaces (VID 2341 / 2A03).
21+
private static readonly string[] _knownUsbSerialBridgeTokens = [ "CH340", "CH341", "CH9102", "VID_1A86", "FTDI", "VID_0403", "CP210", "VID_10C4", "Prolific", "VID_067B", "Arduino", "VID_2341", "VID_2A03" ];
22+
1723
public bool DeviceFound { get => _portName != string.Empty; }
1824
public string LastErrorMessage { get; private set; } = string.Empty;
1925

@@ -100,12 +106,16 @@ public void Initialize()
100106

101107
if ( _handshake != string.Empty )
102108
{
103-
if ( !name.Contains( "CH340", StringComparison.OrdinalIgnoreCase ) )
109+
var matchedBridgeToken = _knownUsbSerialBridgeTokens.FirstOrDefault( token => name.Contains( token, StringComparison.OrdinalIgnoreCase ) || deviceId.Contains( token, StringComparison.OrdinalIgnoreCase ) );
110+
111+
if ( matchedBridgeToken == null )
104112
{
105-
app.Logger.WriteLine( $"[UsbSerialPortHelper] Skipping handshake probe on '{portName}' because device name '{name}' does not contain 'CH340'" );
113+
app.Logger.WriteLine( $"[UsbSerialPortHelper] Skipping handshake probe on '{portName}' because neither device name '{name}' nor PNPDeviceID '{deviceId}' matches a known USB-serial bridge chip" );
106114
continue;
107115
}
108116

117+
app.Logger.WriteLine( $"[UsbSerialPortHelper] Port '{portName}' matched USB-serial bridge token '{matchedBridgeToken}'" );
118+
109119
app.Logger.WriteLine( $"[UsbSerialPortHelper] Testing handshake mode on '{portName}'" );
110120

111121
try

0 commit comments

Comments
 (0)