Skip to content

WebSerial on Chromebooks - #47863

Merged
epeach merged 17 commits into
stagingfrom
webserial-chromebook
Sep 12, 2022
Merged

WebSerial on Chromebooks#47863
epeach merged 17 commits into
stagingfrom
webserial-chromebook

Conversation

@epeach

@epeach epeach commented Aug 29, 2022

Copy link
Copy Markdown

Supports the WebSerial connection in the ChromeOS browser. Continue to be behind the 'webserial' flag. This was mostly already supported by our work to get WebSerial set-up in Chrome. We had to make some UI changes to accommodate both sides of the flag and some error handling in the WebSerialWrapper.

Testing:

I tested the maker/setup page and an Applab project both with the flag and without. Images and screenshots below. Without the flag and with no chrome app installed, the setup and Applab project failed as expected. With the flag and with no chrome app installed (so using WebSerial), the setup page and the project succeeded. I also tested that this doesn't affect the behavior of the /maker/setup and Applab project pages with the flag off and the Chrome App installed (the current behavior).

Media:

Screenshot - Flag disabled. No Chrome App installed. Expected Failure.
Screenshot 2022-09-07 11 02 31 AM

MP4 - Flag enabled. No Chrome App installed. Expected success.
https://user-images.githubusercontent.com/2959170/188954023-248e7a7e-bd5e-4ed8-989f-538a475f7d28.mp4

MP4 - Flag Disabled. No Chrome App Installed. Expected Failure with console error.
https://user-images.githubusercontent.com/2959170/188953259-f9352c95-9560-4bb8-93f1-bbc4808e14b4.mp4

MP4 - Flag Enabled. No Chrome App Installed. Expected Success with no console error.
https://user-images.githubusercontent.com/2959170/188953261-be78e231-bf10-4c24-b3b8-1135d7ead8b1.mp4

Screenshot - Flag Disabled. Chrome App Installed. Expected Success.
Screenshot 2022-09-07 11 50 35 AM

Screenshot - Flag Disabled. Chrome App Installed. Expected Success.
Screenshot 2022-09-07 11 49 28 AM

@epeach
epeach requested a review from a team August 31, 2022 17:31
@bencodeorg

Copy link
Copy Markdown
Contributor

Hey Erin -- since its especially tricky for others to manually test here (ie, I don't have a Chromebook), could you add some information to the description about the manual testing you did?

@@ -79,6 +80,9 @@ function listSerialDevices() {
SerialPortType = SerialPort;
return SerialPortType.list();
} else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: else if?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separately, what does it mean for this function to return a resolved promise (not sure I totally understand method signature, seems like it should return a promise that resolves to an array?)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I ask the motivation behind the 'else if'? One thing I like about the way it is, is that it captures that at its core, this is a "chromebook or not" situation. Once we roll this out feature out, we will actually remove everything below the nested 'if'. Curious how that ways against the simplicity of if/elseif/else.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait . . . I just realized we skip this whole function in the WebSerial path. Deleting in upcoming PR.

}
});
})
.catch(error => Promise.reject('Failure to open port: ' + error));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this (and the other catch) being added to handle a specific case, or just a general improvement?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly a general improvement. When I was debugging an issue with this, I realized that not having these .catch attributes made it harder to debug. Added them now to benefit ourselves in the future.

@epeach

epeach commented Sep 8, 2022

Copy link
Copy Markdown
Author

@bencodeorg PTAL! Thanks!

@bencodeorg bencodeorg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the screenshots/video!

@epeach
epeach merged commit 49063a9 into staging Sep 12, 2022
@epeach
epeach deleted the webserial-chromebook branch September 12, 2022 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants