Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add web-serial-polyfill where navigator.serial is not available #3948

Closed
wants to merge 1 commit into from

Conversation

McGiverGim
Copy link
Member

Android (and other systems) didn't have the navigator.serial API. This is an effort to replace it with the web-serial-polyfill library, that is a replacement of the other but using the navigator.usb API to connect with the serial device.

NOTE: This has not been tested, I make the PR to try to test it under netlify because navigator.usb needs a secure-context.

Copy link

netlify bot commented May 12, 2024

Deploy Preview for origin-betaflight-app ready!

Name Link
🔨 Latest commit b5bc943
🔍 Latest deploy log https://app.netlify.com/sites/origin-betaflight-app/deploys/66406bd7520b6b00087be737
😎 Deploy Preview https://deploy-preview-3948.dev.app.betaflight.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

Do you want to test this code? Here you have an automated build:
Betaflight-Configurator-Android
Betaflight-Configurator-Linux
Betaflight-Configurator-Windows
Betaflight-Configurator-macOS
WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

@McGiverGim
Copy link
Member Author

It seems to be an issue to access the USB api in Android. A lot of phones come with preinstalled USB drivers. When you connect the device, the driver "takes the control", so when the navigator.usb api tries to connect it can't. The navigator.api does not have any method to disconnect/force this access as far as I know.

Some phones like pixel 2 can work, and others like pixel 6 or 7 don't. I doubt we have in PWA another way to access this devices, without wrapping the PWA into an app that can do this usb disconnect before, some easier idea?

Confirmed that it works in a Pixel 2:
image

But this PR is ok, so I think it can be merged. At least it will work for "some users", while we try to find a better solution, that can take time, or Chromium fixes the issue: https://issues.chromium.org/issues/40137537 that I suppose will take a lot more time.

@McGiverGim
Copy link
Member Author

I close this, it is going to be replaced by #3955

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants