Lutz
Lutz

Reputation: 850

Get name of connected device in Web Serial API on Chrome

As per Chrome Platform Status Web Serial API is now state of shipping since Chrome V89.

I work on a Universal Serial Communication App, which allows to connect to a user selected serial port. After a let port = await navigator.serial.requestPort() the user selects a port from the list presented by chrome. This list contains names for the devices. Connecting the chosen port with port.open(conSettings) is no problem.

But how can i get the NAME of the selected port/device (from the shown list) using the Web Serial API? This is needed to show a status like "connected to ...". Without this it is confusing if you have multiple tabs with different ports open.

Upvotes: 5

Views: 3884

Answers (1)

Lutz
Lutz

Reputation: 850

I found this post, from March, the 10th 2021, from reillyeon (which is a Google chromium software engineer for usb and serial). He says it is planed to add an ID to the return of getInfo(), which can be used to remember and reconnect later to a still used device.

At the end of this other post he writes, he plans to "introduce a random identifier", instead of "USB product name or serial number strings", because "concerns about fingerprinting".

So it looks like, at this time there is nothing and it is also not planed to return a device name. But when this would be implemented, it would be possible to save this ID in combination with a user supplied name for the device.

My question anyhow: Is fingerpriting a problem, when the user was still requested and has allowed the access to the device?

Upvotes: 5

Related Questions