[英]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.根据Chrome 平台状态Web Serial API 现在是自 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.在let port = await navigator.serial.requestPort()
,用户从 chrome 显示的列表中选择一个端口。 This list contains names for the devices.此列表包含设备的名称。 Connecting the chosen port with port.open(conSettings)
is no problem.使用port.open(conSettings)
连接所选端口没有问题。
But how can i get the NAME of the selected port/device (from the shown list) using the Web Serial API?但是如何使用 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).我从 2021 年 3 月,10 日,从 reillyeon(这是一个用于 USB 和串行的谷歌铬软件工程师)找到了这篇文章。 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.他说计划在getInfo()
的返回中添加一个 ID,它可以用来记住并在以后重新连接到仍在使用的设备上。
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" .在他写的另一篇文章的结尾,他计划“引入一个随机标识符” ,而不是“USB 产品名称或序列号字符串” ,因为“担心指纹识别” 。
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.但是当实现这一点时,可以将此 ID 与用户提供的设备名称结合起来保存。
My question anyhow: Is fingerpriting a problem, when the user was still requested and has allowed the access to the device?无论如何,我的问题是:当用户仍然被请求并允许访问设备时,指纹识别是否有问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.