feat: 添加DeviceName显示
- 根据usb-device.json映射vendorId与productId - 为页面添加toast
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
import { get } from 'svelte/store';
|
||||
import { serialState, setSerialContext } from './serial.store';
|
||||
import * as service from './serial.service';
|
||||
import { getDeviceName } from '$lib/utils/device';
|
||||
|
||||
interface Props {
|
||||
children?: Snippet;
|
||||
@ -23,7 +24,8 @@
|
||||
|
||||
const info = port.getInfo?.();
|
||||
const name = info
|
||||
? `USB ${info.usbVendorId ?? ''}:${info.usbProductId ?? ''}`
|
||||
? (getDeviceName(info) ??
|
||||
`USB ${info.usbVendorId ?? ''}:${info.usbProductId ?? ''}`)
|
||||
: 'Serial Device';
|
||||
serialState.update((s) => ({
|
||||
...s,
|
||||
|
||||
Reference in New Issue
Block a user