Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a user-visible port name in getInfo() #175

Open
Hmm466 opened this issue Dec 23, 2022 · 8 comments
Open

Provide a user-visible port name in getInfo() #175

Hmm466 opened this issue Dec 23, 2022 · 8 comments

Comments

@Hmm466
Copy link

Hmm466 commented Dec 23, 2022

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

@reillyeon
Copy link
Collaborator

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 reillyeon changed the title Is it possible to return serial port name and other information in navigator.serial.getPorts()[index].getInfo() Provide a user-visible port name in getInfo() Jan 3, 2023
@jessekingf
Copy link

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).

@reillyeon
Copy link
Collaborator

@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.

@Hmm466
Copy link
Author

Hmm466 commented Feb 7, 2023

@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.

@jessekingf
Copy link

jessekingf commented Feb 8, 2023

@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().

@yelhouti
Copy link

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...

@gbmhunter
Copy link

gbmhunter commented May 16, 2024

+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").

@DogeVenci
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants