From 0aab8ad7fec7a65b139ee42912e6ca13a95fb0a5 Mon Sep 17 00:00:00 2001 From: Michael Ryom Date: Sun, 22 Feb 2026 15:50:55 +0100 Subject: [PATCH] feat: Filter WebSerial port picker to CH340 devices Add USB vendor/product ID filter (0x1a86:0x7523) to both navigator.serial.requestPort() call sites so the browser only shows the NanoKVM's CH340 serial adapter instead of listing every serial device on the system. --- browser/src/components/device-modal/serial-port.tsx | 4 +++- browser/src/components/menu/serial-port/index.tsx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/browser/src/components/device-modal/serial-port.tsx b/browser/src/components/device-modal/serial-port.tsx index b03247b5..cf012ef9 100644 --- a/browser/src/components/device-modal/serial-port.tsx +++ b/browser/src/components/device-modal/serial-port.tsx @@ -29,7 +29,9 @@ export const SerialPort = ({ setErrMsg, onDisconnect }: SerialPortProps) => { setErrMsg(''); try { - const port = await navigator.serial.requestPort(); + const port = await navigator.serial.requestPort({ + filters: [{ usbVendorId: 0x1a86, usbProductId: 0x7523 }] // CH340 + }); await device.serialPort.init({ port, onDisconnect }); setSerialState('connected'); diff --git a/browser/src/components/menu/serial-port/index.tsx b/browser/src/components/menu/serial-port/index.tsx index 425e688b..2df7b0ab 100644 --- a/browser/src/components/menu/serial-port/index.tsx +++ b/browser/src/components/menu/serial-port/index.tsx @@ -11,7 +11,9 @@ export const SerialPort = () => { setIsLoading(true); try { - const port = await navigator.serial.requestPort(); + const port = await navigator.serial.requestPort({ + filters: [{ usbVendorId: 0x1a86, usbProductId: 0x7523 }] // CH340 + }); await device.serialPort.init({ port }); } finally { setIsLoading(false);