WebSerial in Chromium (v88 / arm64)

1,648 views
Skip to first unread message

forbiddenera

unread,
Feb 20, 2021, 7:38:37 PM2/20/21
to Chromium-dev

Hi,

Trying to use WebSerial in Chromium (kiosk mode) on a Pi 4 running Ubuntu 20.04.

I believe it was fully enabled in 89, though should be available behind a flag/origin trial before that; my domain has the origin trial setup and works in Chrome on my PC. I don't see a flag in settings.

Is this somehow disabled in some combination of  Chromium/Arm64/Linux?

WebUSB does show up and I suppose that's an option though I'd rather use WebSerial if it's possible even if it means recompiling with different flags or something.

Already using WebSerial in one app and works good on PC; had to use WebUSB on Android, writing a WebUSB FTDI driver to make it work - (although I just noticed the Google WebSerial-over-WebUSB polyfill, after quickly reviewing the code and knowing what I had to go through with the FTDI driver, I'm thinking it may not work with those but may with other ones..)

Thanks

Reilly Grant

unread,
Feb 22, 2021, 7:18:57 PM2/22/21
to ja...@shaped.ca, Chromium-dev
There is no reason I am aware of for the Web Serial API to be disabled on ARM64 Linux but since it isn't a supported Chrome platform I'm not set up to test in that environment. The closest supported environments are ARM64 Android (where the Web Serial API is disabled because the Android SDK doesn't provide a serial API for Chrome to build on) and ARM64-based Chrome OS devices. I'm working on finding someone with one of those who can confirm whether the API is working as expected there.

Please confirm whether the navigator.serial object is missing or there is some other error when trying to use the API.

The Web Serial API polyfill we published only currently supports USB CDC-ACM devices but there is an open issue to support FTDI devices and contributions are welcome.
Reilly Grant | Software Engineer | rei...@chromium.org | Google Chrome


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/8e31cb0c-da74-49a0-a1df-ce191aa21f8fn%40chromium.org.

Reilly Grant

unread,
Feb 22, 2021, 7:55:04 PM2/22/21
to forbiddenera, Chromium-dev
On Mon, Feb 22, 2021 at 4:30 PM forbiddenera <ja...@shaped.ca> wrote:
Hi,

I can confirm that the object doesn't exist in navigator.

Just in case I didn't mention in the first post, this is a Raspberry Pi Model 4B running Ubuntu 20.04 LTS with Chromium v88.0.4324.182 (Official build) snap (64-bit).

I can recompile if needed but it shouldn't be disabled as it's Linux; I would think that the CPU platform shouldn't change that - Linux is Linux in this case, perhaps someone made an oversight when configuring?

Correct. Linux is Linux and I'm currently stumped on why it would be disabled in a build targeting ARM64 but not on AMD64. My only clue is that I noticed some similar weirdness when bringing up support for Apple Silicon so there may be an ARM64-specific bug lurking somewhere in the V8 bindings code.
 
Sidenotes: a, Is there any plan to support Chrome on Linux/Arm64? I was kind of surprised to see it wasn't as there is Linux and Arm64 support elsewhere..

That question is above my pay grade.

b, I noticed there was a web serial polyfill but only works for USB-CDC devices; I've written one that works for FTDI devices as well; not sure if it would be an idea to use that within Chromium itself to, for example, on Android, provide a web serial interface. Android should be able to do it in a Linux-y way too..? Not sure, honestly haven't done any deep Android stuff since Android 4.x and I know lots has changed.

As I said in my last message even though Android uses the Linux kernel it doesn't provide the same API for connecting to TTY devices. Native Android apps which support USB serial adapters use the Android USB host API, which is the same API used by Chrome to implement WebUSB on Android. This is why a Javascript polyfill will work. I don't have any plans to build such a polyfill directly into Chrome. If you're interested in adding your FTDI-supporting polyfill to the existing CDC-ACM-supporting polyfill that contribution would be appreciated as it would resolve this issue.

Reilly Grant

unread,
Feb 22, 2021, 8:17:05 PM2/22/21
to forbiddenera, Chromium-dev
I just heard back from the person I asked to test this on an ARM64 Chromebook and it looks like the API is working as expected there. However, Chrome OS still uses 32-bit builds of Chrome. Can you install the 32-bit version of the Ubuntu snap and give that a try? Or build your own 64-bit version to see if there's something odd about Ubuntu's build configuration?

Reilly Grant | Software Engineer | rei...@chromium.org | Google Chrome


On Mon, Feb 22, 2021 at 5:08 PM forbiddenera <ja...@shaped.ca> wrote:
Yep, let me know what you find. If I have to recompile for now, so be it, but since you agree it should be enabled, hopefully we can get it fixed before next release.

As you can see I already replied to said issue with a link to my code. Hopefully I can finish it sometime soon here otherwise it's a good base for someone to start from. Unfortunately FTDI doesn't really want to share but the Linux kernel driver provides most if not all of the info we need.

forbiddenera

unread,
Feb 25, 2021, 9:12:40 PM2/25/21
to Chromium-dev, rei...@chromium.org, Chromium-dev, forbiddenera
Hi,

I can confirm that the object doesn't exist in navigator.

Just in case I didn't mention in the first post, this is a Raspberry Pi Model 4B running Ubuntu 20.04 LTS with Chromium v88.0.4324.182 (Official build) snap (64-bit).

I can recompile if needed but it shouldn't be disabled as it's Linux; I would think that the CPU platform shouldn't change that - Linux is Linux in this case, perhaps someone made an oversight when configuring?

Sidenotes: a, Is there any plan to support Chrome on Linux/Arm64? I was kind of surprised to see it wasn't as there is Linux and Arm64 support elsewhere..

b, I noticed there was a web serial polyfill but only works for USB-CDC devices; I've written one that works for FTDI devices as well; not sure if it would be an idea to use that within Chromium itself to, for example, on Android, provide a web serial interface. Android should be able to do it in a Linux-y way too..? Not sure, honestly haven't done any deep Android stuff since Android 4.x and I know lots has changed.

On Monday, February 22, 2021 at 5:18:57 PM UTC-7 rei...@chromium.org wrote:

forbiddenera

unread,
Feb 25, 2021, 9:13:02 PM2/25/21
to Chromium-dev, rei...@chromium.org, Chromium-dev, forbiddenera
Sure, I can see if that works. I'll report back.

forbiddenera

unread,
Feb 25, 2021, 9:13:07 PM2/25/21
to Chromium-dev, rei...@chromium.org, Chromium-dev, forbiddenera
Yep, let me know what you find. If I have to recompile for now, so be it, but since you agree it should be enabled, hopefully we can get it fixed before next release.

As you can see I already replied to said issue with a link to my code. Hopefully I can finish it sometime soon here otherwise it's a good base for someone to start from. Unfortunately FTDI doesn't really want to share but the Linux kernel driver provides most if not all of the info we need.

On Monday, February 22, 2021 at 5:55:04 PM UTC-7 rei...@chromium.org wrote:

forbiddenera

unread,
Apr 21, 2021, 11:12:20 AM4/21/21
to Chromium-dev, forbiddenera, rei...@chromium.org, Chromium-dev
Hi,

Haven't touched this in a bit, updated to v90.0.4430.72 and it's still not working.

I noticed in dmesg that apparmor was denying access to some things including some ttyUSB's.. I then set it to run outside of the snap constraints / no apparmor / no errors show up in dmesg but still no webserial (or webusb or web bluetooth)

I haven't tried compiling it myself or trying to install from a different source (ie 32 bit) source yet. Have to be up in 2 hours to drive friend to dentist so that will have to wait.

forbiddenera

unread,
May 10, 2021, 5:18:54 PM5/10/21
to Chromium-dev, forbiddenera, rei...@chromium.org, Chromium-dev
Thinking apparmor might have something to do with it.

I've tried a non-official Ubuntu build that has it's own Chromium, not sure how it was compiled, it's v83 but it does seem to allow webusb and webserial, so it's got to be an issue with the package maintainers I'm thinking

Reilly Grant

unread,
Nov 28, 2022, 11:42:13 AM11/28/22
to Stewart Allen, Chromium-dev, forbiddenera
This thread was about using the Web Serial API on Linux. The Web Serial API can't be supported natively on Android because Android itself doesn't provide applications with a serial API, it isn't part of the SDK. Android apps which communicate with USB or Bluetooth serial devices do so with USB- and Bluetooth-specific APIs. Web apps can do the same, the web-serial-polyfill library provides an implementation of the Web Serial API on top of WebUSB (and it could be expanded to support some Bluetooth devices using Web Bluetooth as well). The limitation of this library is that it has to support each type of USB serial device individually, since the OS isn't providing drivers.  

Reilly Grant | Software Engineer | rei...@chromium.org | Google Chrome


On Mon, Nov 28, 2022 at 9:53 AM Stewart Allen <stewar...@gmail.com> wrote:
WebSerial is still missing from the latest Chrome, Chrome Beta, and Chromium on Android. Any idea what it will take to get that in a build?

Stewart Allen

unread,
Nov 30, 2022, 4:38:38 PM11/30/22
to Chromium-dev, forbiddenera, rei...@chromium.org, Chromium-dev
WebSerial is still missing from the latest Chrome, Chrome Beta, and Chromium on Android. Any idea what it will take to get that in a build?

On Monday, May 10, 2021 at 5:18:54 PM UTC-4 forbiddenera wrote:

Reilly Grant

unread,
Jul 31, 2023, 2:22:54 PM7/31/23
to Paul Gardner-Stephen, Miguel Alvarez, Chromium-dev, forbiddenera, Stewart Allen
Hey Paul,

From a Chrome perspective there are existing policies to automatically grant a site access to a serial device: SerialAllowUsbDevicesForUrls and SerialAllowAllPortsForUrls. The problem is that the Google Admin console does not yet support configuring them for kiosk devices. There are internal issues tracking the necessary backend server work for this. I recommend reaching out to your sales/support representative to ask them about using these policies with kiosk devices to help get this feature request prioritized.


Reilly Grant | Software Engineer | rei...@chromium.org | Google Chrome


On Sun, Jul 30, 2023 at 4:28 AM Paul Gardner-Stephen <paul.gardn...@gmail.com> wrote:
Hello Reilly, All,

Do you know why the WebSerial API still needs user interaction to grant permissions on Chromebooks in Kiosk mode?  In that mode all permissions are supposed to auto-grant, but I have confirmed that this is not the case.

Thanks,
Paul.

Reilly Grant

unread,
Jul 31, 2023, 9:09:12 PM7/31/23
to Paul Gardner-Stephen, Miguel Alvarez, Chromium-dev, forbiddenera, Stewart Allen
My understanding is that Managed Guest Sessions != Kiosk, and so there is additional work that needs to be done.

Reilly Grant | Software Engineer | rei...@chromium.org | Google Chrome

On Mon, Jul 31, 2023 at 1:22 PM Paul Gardner-Stephen <paul.gardn...@gmail.com> wrote:
Hello Reilly,

Thanks for the response.

I have in the meantime filed this bug, which has been assigned to someone:


Do you think I still need to poke things along, or is it now likely to be prioritised enough already? 

Also I have documented in the bug, I think that those interfaces are exposed in the admin console, but aren't working correctly. e.g.,

5. Device -> Chrome -> Settings -> Managed Guest Sessions -> "WebSerial API allowed devices" -> Add web site URL  and USB device VID:PID

looks to me like it really _should_ do what I am after -- but it has zero effect.

Anyway, as mentioned, it's all documented in the bug I have filed, and I'll take your advice on whether I need to push it more from my side.

Thanks again for the response,
Paul.

Reilly Grant

unread,
Jul 31, 2023, 9:16:08 PM7/31/23
to Paul Gardner-Stephen, Miguel Alvarez, Chromium-dev, forbiddenera, Stewart Allen
The code snippet in this issue is not the correct way for an application to take advantage of permissions that are granted by policy. With or without policy applied navigator.serial.requestPort() will always attempt to show UI, because it has to choose which port to return to the application. Instead you want to call navigator.serial.getPorts(). This will return any ports that your application has permission to access, whether permission was granted previously by the user or automatically by policy.  

Reilly Grant | Software Engineer | rei...@chromium.org | Google Chrome

Paul Gardner-Stephen

unread,
Aug 2, 2023, 1:48:42 PM8/2/23
to Chromium-dev, Reilly Grant, Chromium-dev, forbiddenera, Stewart Allen
Hello Reilly, All,

Do you know why the WebSerial API still needs user interaction to grant permissions on Chromebooks in Kiosk mode?  In that mode all permissions are supposed to auto-grant, but I have confirmed that this is not the case.

Thanks,
Paul.

On Tuesday, November 29, 2022 at 3:12:13 AM UTC+10:30 Reilly Grant wrote:

Paul Gardner-Stephen

unread,
Aug 2, 2023, 1:49:41 PM8/2/23
to Reilly Grant, Miguel Alvarez, Chromium-dev, forbiddenera, Stewart Allen
Hello Reilly,

Thanks for spotting that. I'm investigating it now, to see if it solves the problem for me.

Thanks,
Paul.

Paul Gardner-Stephen

unread,
Aug 2, 2023, 1:51:04 PM8/2/23
to Reilly Grant, Miguel Alvarez, Chromium-dev, forbiddenera, Stewart Allen
Hello Reilly,

Thanks for the response.

I have in the meantime filed this bug, which has been assigned to someone:


Do you think I still need to poke things along, or is it now likely to be prioritised enough already? 

Also I have documented in the bug, I think that those interfaces are exposed in the admin console, but aren't working correctly. e.g.,

5. Device -> Chrome -> Settings -> Managed Guest Sessions -> "WebSerial API allowed devices" -> Add web site URL  and USB device VID:PID

looks to me like it really _should_ do what I am after -- but it has zero effect.

Anyway, as mentioned, it's all documented in the bug I have filed, and I'll take your advice on whether I need to push it more from my side.

Thanks again for the response,
Paul.


On Tue, 1 Aug 2023 at 03:51, Reilly Grant <rei...@chromium.org> wrote:

Paul Gardner-Stephen

unread,
Aug 2, 2023, 1:51:24 PM8/2/23
to Reilly Grant, Miguel Alvarez, Chromium-dev, forbiddenera, Stewart Allen
Hello again,

Confirming that this has solved the problem for me.

Thanks again,
Paul.
Reply all
Reply to author
Forward
0 new messages