serial icon indicating copy to clipboard operation
serial copied to clipboard

Provide a user-visible port name in getInfo()

Open Hmm466 opened this issue 3 years ago • 10 comments

Usually, when our users use Web serial to control locally, there may be serial devices from the same manufacturer or other trusted devices locally. For a friendly experience, we have to use navigator.serial.getPorts to obtain trusted devices, but Only usbProductId and usbVendorId can be obtained through getInfo, which makes my user unable to choose the device he needs friendly when selecting the target device, even if he uses the Windows Device Manager. If this method is not used, the user needs to pop up a window to select a device every time, which is extremely bad for the user experience. For example, the customer has two arduino devices, but he can't choose. I don't think there is any worse experience than the serial port name or manufacturer returned after getting the information. Is there any worse experience than this? So I want to see if there is a way to get serial port information to improve user experience

Hmm466 avatar Dec 23 '22 07:12 Hmm466

I'm going to use this issue to track the specific request for providing a "port name" field in getInfo(). This is distinct from the "device ID" proposed in #128. I think both are necessary. The "port name" being a user-visible value that satisfies the user experience concern raised here while a "device ID" would be used internally be applications to track information about ports they have previously connected to. While a "device ID" would be guaranteed to be unique, over time many devices could have the same user-visible "port name".

reillyeon avatar Jan 03 '23 23:01 reillyeon

I hope this is something that will be addressed sooner than later. Currently, it is not possible in most cases to select the correct port when using multiple devices. Especially when using Bluetooth SPP or serial-to-USB adapters that report the same hardware IDs (or no hardware IDs).

jessekingf avatar Feb 06 '23 15:02 jessekingf

@jessekingf can you clarify whether you mean that it is difficult for the user to select the correct port in the permission prompt presented when requestPort() is called or that it is difficult for the application to select correctly between multiple devices it has permission to access that it receives from getPorts()?

The former is out of scope for this issue and is something to fix at an implementation level (improving how the browser UI works) rather than a specification level.

reillyeon avatar Feb 06 '23 18:02 reillyeon

@jessekingf can you clarify whether you mean that it is difficult for the user to select the correct port in the permission prompt presented when requestPort() is called or that it is difficult for the application to select correctly between multiple devices it has permission to access that it receives from getPorts()?

The former is out of scope for this issue and is something to fix at an implementation level (improving how the browser UI works) rather than a specification level.

I still think that when getting a paired COM device, it should return the COM name, just like Windows Explorer. In this way, when my webpage needs to use more than two COMs and they are from the same manufacturer, it can be used quickly, without requiring the user to choose every time it is used. This is a very bad experience, because some have URL of the commercial form.

Hmm466 avatar Feb 07 '23 10:02 Hmm466

@jessekingf can you clarify whether you mean that it is difficult for the user to select the correct port in the permission prompt presented when requestPort() is called or that it is difficult for the application to select correctly between multiple devices it has permission to access that it receives from getPorts()?

Difficult for the application to differentiate between already authorized ports returned from getPorts().

jessekingf avatar Feb 08 '23 21:02 jessekingf

The same way we are able to do:

const device = (await navigator.usb.getDevices()).find(d => d.serialNumber === ...)

We should have something like:

const port = (await navigator.serial.getPorts()).find(p => p.path === ...)

or something equivalent to select between COM1, COM2...

yelhouti avatar Sep 25 '23 05:09 yelhouti

+1 for this feature! A common use case for embedded development is to have 4 of the same FTDI USB-to-serial cable connected or 4 of the same dev. kit. All of these present the same vendor IDs. Having a user visible "COM2" or "/dev/ttyUSB0" equivalent would help with distinguishing them. Also, as proposed in the other issue, having a unique ID would be great also. This would allow an app to either use the ID directly or let the user associate a "friendly name" with an ID (e.g. "My LED light strip controller").

gbmhunter avatar May 16 '24 21:05 gbmhunter

+1

DogeVenci avatar Jul 11 '24 12:07 DogeVenci

+1

XITechs avatar Nov 30 '24 10:11 XITechs

Hello, any updates adding a new field for device name in getInfo()? There should not be any fingerprints by just saving the name of a serial device. Think about the Arduino Web IDE, or web apps that use MIDI, they all have access to the name of the device connected. This would be great to have.

atlasmooth avatar Jan 19 '25 12:01 atlasmooth