Getting Serial port info on Chrome Web Serial API

Viewed 590

I'm using the Chrome Web Serial API. So far it's working fine, but now and I'm trying to get the (already opened) port metadata (port name, device ID, etc.) and I'm a bit lost.

Here are the steps to follow: https://wicg.github.io/serial/#getting-serial-port-metadata but so far I cannot get the information.

If I try by navigating the port class, the DevTools console trows "ƒ () { [native code] }".

I cannot find a suitable example of how to implement this. Does anyone have a hint? Thanks in advance!!

Daniel.

1 Answers

It seems like it hasn't been implemented in Chromium yet. Keep in mind that the specs are sort of guides for vendors to follow when implementing a feature, but the actual shipped implementation can differ.

If you check the Web Serial API's code in the Chromium repo for Chrome 80 (current version at the time of writing) and 84.0.4112.1 you'll see that they only include the following methods:

open
readable
writable
getSignals
setSignals
close

You can read the latest comments on this API here: https://bugs.chromium.org/p/chromium/issues/detail?id=884928

Related