Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Convert WebUSB article from WebFu #4095

Merged
merged 2 commits into from Oct 21, 2020
Merged

Conversation

beaufortfrancois
Copy link
Member

@beaufortfrancois beaufortfrancois commented Oct 20, 2020

This PR is about moving https://developers.google.com/web/updates/2016#access_usb_devices_on_the_web to web.dev/usb

Changes to the original article include:

  • Removed lengthy "why https is important" explanation
  • Replaced "var" and "let" with "const" when possible in JS examples
  • Used semicolons in the feature policy "allow" JS example

Live preview at https://deploy-preview-4095--web-dev-staging.netlify.app/usb/

@beaufortfrancois beaufortfrancois requested a review from a team as a code owner October 20, 2020 09:39
@google-cla google-cla bot added the cla: yes Contributor has signed the CLA label Oct 20, 2020
@github-actions
Copy link

Alex Recommends Report

Alex recommends the following language changes, but Alex is a regular expression based algorithm, so take them with a grain of salt.

✨ 🚀 ✨ Nothing to Report ✨ 🚀 ✨

@netlify
Copy link

netlify bot commented Oct 20, 2020

Deploy preview for web-dev-staging ready!

Built with commit 0df7bd7

https://deploy-preview-4095--web-dev-staging.netlify.app

@jpmedley jpmedley self-assigned this Oct 20, 2020
Copy link
Contributor

@jpmedley jpmedley left a comment

Choose a reason for hiding this comment

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

François,

I'll hope you'll indulge me. The standards for Web.dev are a bit higher than for WebFu. I reviewed this as though it were a new article. Please review the requested changes.

Thanks,
Joe

- api
---

If I said plain and simple "USB", there is a good chance that you will
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be either:

If I said plainly and simply "USB"...

or

If I said "plain and simple USB"...

I think the first is closer to what you're after.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

---

If I said plain and simple "USB", there is a good chance that you will
immediately think of keyboards, mice, audio, video and storage devices. You're
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
immediately think of keyboards, mice, audio, video and storage devices. You're
immediately think of keyboards, mice, audio, video, and storage devices. You're

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

But most importantly this will **make USB safer and easier to use by bringing
it to the Web**.

Let's see what you could expect with the WebUSB API:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Let's see what you could expect with the WebUSB API:
Let's see the behavior you could expect with the WebUSB API:

Copy link
Contributor

Choose a reason for hiding this comment

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

The language is a little more specific.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Comment on lines 40 to 41
2. Plug it into your computer.
3. A notification appears right away, with the right website to go to for this
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
2. Plug it into your computer.
3. A notification appears right away, with the right website to go to for this
2. Plug it into your computer. A notification appears right away, with the right website to go to for this

Copy link
Contributor

Choose a reason for hiding this comment

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

A best practice is that the steps always begin with the user action. Responses of a system are tacked to the end of the steps that initiated them.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

2. Plug it into your computer.
3. A notification appears right away, with the right website to go to for this
device.
4. Simply click on it. Website is there and ready to use!
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
4. Simply click on it. Website is there and ready to use!
4. Click the notification. The website is there and ready to use!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


## Tips

Debugging USB in Chrome is easier with the internal page `chrome://device-log`
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the information on the Chrome pages up to date?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep!

</figure>

The internal page `chrome://usb-internals` also comes in handy and allows you
to simulate connection connection and disconnection of virtual WebUSB devices.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
to simulate connection connection and disconnection of virtual WebUSB devices.
to simulate connection connection and disconnection of virtual WebUSB devices.
Suggested change
to simulate connection connection and disconnection of virtual WebUSB devices.
to simulate connection and disconnection of virtual WebUSB devices.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


The internal page `chrome://usb-internals` also comes in handy and allows you
to simulate connection connection and disconnection of virtual WebUSB devices.
This is be useful for doing UI testing without the need for real hardware.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This is be useful for doing UI testing without the need for real hardware.
This is be useful for doing UI testing without real hardware.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


where `[yourdevicevendor]` is `2341` if your device is an Arduino for instance.
`ATTR{idProduct}` can also be added for a more specific rule. Make sure your
`user` is a member of the `plugdev` group. Then, just reconnect your device.
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the plugdev group? How do I make sure I'm a member of it? Links will be fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added a link that includes both answers.

`ATTR{idProduct}` can also be added for a more specific rule. Make sure your
`user` is a member of the `plugdev` group. Then, just reconnect your device.

## What's next
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this section need to be updated? I couldn't find any features for shared or service workers on Chrome Status. I did find this: https://www.chromestatus.com/features/5928209916887040

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I've missed this. You're right.
I've removed this "What's next" section

@jpmedley jpmedley merged commit 40dfa97 into GoogleChrome:master Oct 21, 2020
@beaufortfrancois beaufortfrancois added the content update for issues that do not require new content (only for updates to existing content) label Feb 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Contributor has signed the CLA content update for issues that do not require new content (only for updates to existing content)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants