简体   繁体   中英

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.

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 ofthis 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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM