electron / electron/electron

[Feature Request]: Renderer SerialPort.getInfo() return full SerialPortObject

Open
#31,870 2 comments 0 reactions 0 assignees View on GitHub
component/deviceAccess enhancement :sparkles:
Dominant language
C++
Stars
123k
Forks
17.5k
Avg merge
14h 31m
Merged PRs (30d)
858

Description

### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.

### Problem Description

On the renderer process, `SerialPort.getInfo()` returns `{usbProductId: 32798, usbVendorId: 9114}`.

Separately, on the main process, `setDevicePermissionHandler` callback receives:

```
device: {
name: 'Trinket M0',
product_id: 32798,
serial_number: 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
usb_driver: 'com.apple.driver.usb.cdc.acm',
vendor_id: 9114
}
```

It's not possible to correlate this data, since multiple devices can have the same vendor and product IDs. (There's not much stopping devices in the wild even having identical serial numbers, so realistically the comPath is the only way to differentiate between different devices plugged in at the same time.)

It's difficult to produce a UI on the renderer process without this information. The Chrome default UI uses this information to present the device names to the user.

![image](https://user-images.githubusercontent.com/13504878/142136541-bb8aaa5e-51a9-4b96-95d1-75813faa1838.png)

### Proposed Solution

`SerialPort.getInfo()` on the renderer process returns this additional information.

### Alternatives Considered

User-space libraries for serialport interaction do exist (it's what we're using now).

### Additional Information

Interestingly the Chrome UI displays the comPath in the UI, I can't seem to find that information anywhere in these calls. It would be good to also supply that information.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.