Skip to content

Commit

Permalink
samples: webusb: Update README
Browse files Browse the repository at this point in the history
Update webusb README with recent changes after index.html was moved to
sample from the external repository.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
  • Loading branch information
finikorg committed Sep 8, 2023
1 parent 73b3d83 commit 695d05a
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions samples/subsys/usb/webusb/README.rst
Expand Up @@ -13,7 +13,7 @@ Sample Overview
***************

This simple echo application demonstrates the WebUSB sample application.
This application receives the data and echoed back to the WebUSB
This application receives the data and echoes back to the WebUSB
based web application (web page) running in the browser at host.
This application is intended for testing purposes only. For running
real usecase, implement applications based on the WebUSB API.
Expand All @@ -37,15 +37,15 @@ Build and flash webusb sample with:
:goals: flash
:compact:

Testing with latest Google Chrome on host
*****************************************
Testing with the latest Google Chrome on host
*********************************************

This sample application requires latest Google Chrome, a web page
This sample application requires the latest Google Chrome, a web page
based on WebUSB API to connect to the USB device and optionally
http server running on localhost to serve the web page.

WebUSB is a powerful new feature added to the Web and it is available
only to secure origins. This means the web page/site that used to
only to secure origins. This means the web page/site that is used to
connect to the device must be served over a secure connection (HTTPS).

Follow these steps to run the demo on your host system:
Expand All @@ -55,22 +55,25 @@ Follow these steps to run the demo on your host system:
#. Implement a web app (web page) using WebUSB API and run
it on localhost.

See the sample at https://github.com/finikorg/webusb-sample
The sample can be found in the webusb sample directory:
:zephyr_file:`samples/subsys/usb/webusb/index.html`.

This sample web page demonstrate how to create and use a WebUSB
This sample web page demonstrates how to create and use a WebUSB
interface, as well as demonstrate the communication between browser
and WebUSB enabled device.

see :doc:`demo`
There are two ways to access this sample page:

#. To access JS app go to https://finikorg.github.io/webusb-sample/
* Using Chrome browser go to :doc:`demo`

#. To host the demo page locally: Clone the repo and start a web server
in the appropriate directory.
* Host the demo page locally: Start a web server
in the webusb sample directory.

.. code-block:: console
.. code-block:: console
$ python -m http.server
$ python -m http.server
Using Chrome browser open url http://localhost:8001/

#. Connect the board to your host.

Expand All @@ -80,7 +83,8 @@ Follow these steps to run the demo on your host system:
Note that at the moment WebUSB landing page notification is disabled
in Chrome on Windows. See https://github.com/WICG/webusb#implementation-status

#. Click on Connect button to connect to the device.
#. Click on the :guilabel:`Connect` button to connect to the device.

#. Send some text to the device by clicking on the Send button. The demo app
will receive the same text from the device and display it in the textarea.
#. Send some text to the device by clicking on the :guilabel:`Send` button.
The demo app will receive the same text from the device and display it in
the text area.

0 comments on commit 695d05a

Please sign in to comment.