WICG / serial

Serial ports API for the platform.
https://wicg.github.io/serial/
Other
255 stars 46 forks source link

How long is the storage time of the matching information of the serial port?Is it possible to connect using port number instead of usbProductId. #171

Open songjiagui opened 1 year ago

reillyeon commented 1 year ago

How the browser can remember which port the user selected is a platform-specific issue. For example, on Windows Chromium is able to remember any port the user selects because Windows provides a stable identifier for every device on the system. An identifier like this is not available on Linux and macOS and so only permissions for USB devices with serial numbers can be remembered between sessions.

As I understand it port numbers aren't a reliable way of identifying a device. What I have connected to COM1 on my machine you might have connected to COM3. The site can't know ahead of time where the device is connected. A combination of USB vendor and product IDs (which at least identify a device by its model information) and user knowledge are required to select the right port.

Can you provide an example of how an application could effectively use the port number?