Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome extension: how to use serial port (now that apps are sunsetting)?

Aim: I am attempting to write a little "thing" that can talk from my browser to the COM port of an Arduino.

Issue: My first attempt is to write an extension. Therefore I am requesting permission for serial in my manifest file. When loading the unpackaged extension via developer mode I receive the following error: 'serial' is only allowed for packaged apps, but this is a extension.

I see here that packaged app is an outdated term and I guess they just mean Chrome app. Now unfortunately it seems that Chrome is also discontinuing these Chrome apps as discussed here.

Question: So how should I access the serial functionality of Chrome apps/extensions/whatever new name you come up with?

like image 390
SCBuergel Avatar asked May 27 '17 12:05

SCBuergel


1 Answers

"Web Serial API", navigator.serial, may be the best way looking forward. It has been available behind the #enable-experimental-web-platform-features flag in chrome://flags since chrome 77. It is due to go to Origin trials 80-82 then ship in 83.

Web Serial API allows serial interface directly from a progressive web app. There is a good tutorial at https://codelabs.developers.google.com/codelabs/web-serial/#0

You should probably avoid the older chrome.serial, available only in chrome apps, because from June 2020 Chrome Apps on Windows, Mac, and Linux will no longer be supported.

like image 57
James Avatar answered Nov 16 '22 03:11

James