简体   繁体   English

在 Chrome 上的 Web Serial API 中获取连接设备的名称

[英]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.

相关问题 Google Chrome Web 序列号 API:如何使用十六进制代码寻址 Modbus 设备? - Google Chrome Web Serial API: How do I address a Modbus device with a hex code? 谷歌浏览器 Web 串行 API:意外行为 - Google Chrome Web Serial API: unexpected behaviour 在 android chrome 浏览器中访问 web 串行 api - access web serial api in android chrome browser Web 串行 API “未捕获(承诺)DOMException:检测到缓冲区溢出。” 从串行设备读取串行数据时 - Web serial API "Uncaught (in promise) DOMException: A buffer overrun has been detected." when reading serial data from serial device 在 Chrome 网络蓝牙 API 中未经用户许可连接到配对设备? - Connect to a paired device without user permission in Chrome web bluetooth API? 如何使用Chrome网络蓝牙API初始化新设备配对? - How to initiate a new device pairing using the Chrome web bluetooth API? 有没有办法让 Chrome “忘记”一个设备来测试 navigator.usb.requestDevice, navigator.serial.requestPort? - Is there a way to get Chrome to “forget” a device to test navigator.usb.requestDevice, navigator.serial.requestPort? Chrome 31的chrome.serial API文档? - chrome.serial API docs for Chrome 31? 什么是“必须处理用户手势才能显示权限请求”。 Chrome Web 串行 API 中的错误消息? - What is "Must be handling a user gesture to show a permission request." errror message in Chrome Web Serial API? Google Chrome Web Serial API:如何配置Modbus RTU的参数? - Google Chrome Web Serial API: How do I configure the parameters for Modbus RTU?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM