Gaute Svanes Lunde | e7347ea | 2023-01-09 19:43:07 +0100 | [diff] [blame] | 1 | --- |
| 2 | orphan: true |
| 3 | --- |
| 4 | |
rgoliver | 7f860ce | 2021-07-21 00:33:36 -0400 | [diff] [blame] | 5 | # CHIP RPC CONSOLE |
| 6 | |
| 7 | This python application provides a console for interacting with rpc-enabled chip |
| 8 | devices. |
| 9 | |
| 10 | The console uses the [pigweed pw_console](https://pigweed.dev/pw_console/), but |
| 11 | with customizations to work better with CHIP, including containing all rpc proto |
| 12 | files required for CHIP. |
| 13 | |
| 14 | - [CHIP RPC CONSOLE](#chip-rpc-console) |
| 15 | - [Building](#building) |
| 16 | - [Running](#running) |
| 17 | |
| 18 | --- |
| 19 | |
| 20 | ## Building |
| 21 | |
cpagravel | ba1b65d | 2022-06-10 06:47:40 -0700 | [diff] [blame] | 22 | If this is the first time using the checkout the environment must first be |
| 23 | bootstrapped to install all dependencies. |
rgoliver | 7f860ce | 2021-07-21 00:33:36 -0400 | [diff] [blame] | 24 | |
cpagravel | ba1b65d | 2022-06-10 06:47:40 -0700 | [diff] [blame] | 25 | ``` |
| 26 | $ source <project_root>/scripts/bootstrap.sh |
| 27 | ``` |
rgoliver | 7f860ce | 2021-07-21 00:33:36 -0400 | [diff] [blame] | 28 | |
cpagravel | ba1b65d | 2022-06-10 06:47:40 -0700 | [diff] [blame] | 29 | If bootstrap has previously been run, then simply activate. |
rgoliver | 7f860ce | 2021-07-21 00:33:36 -0400 | [diff] [blame] | 30 | |
cpagravel | ba1b65d | 2022-06-10 06:47:40 -0700 | [diff] [blame] | 31 | ``` |
| 32 | $ source <project_root>/scripts/activate.sh |
| 33 | ``` |
rgoliver | 7f860ce | 2021-07-21 00:33:36 -0400 | [diff] [blame] | 34 | |
cpagravel | ba1b65d | 2022-06-10 06:47:40 -0700 | [diff] [blame] | 35 | The python console is built and installed in the venv using gn: |
rgoliver | 7f860ce | 2021-07-21 00:33:36 -0400 | [diff] [blame] | 36 | |
cpagravel | ba1b65d | 2022-06-10 06:47:40 -0700 | [diff] [blame] | 37 | ``` |
| 38 | $ cd <project_root>/examples/common/pigweed/rpc_console |
| 39 | $ gn gen out/debug |
| 40 | $ ninja -C out/debug |
| 41 | ``` |
rgoliver | 7f860ce | 2021-07-21 00:33:36 -0400 | [diff] [blame] | 42 | |
cpagravel | ba1b65d | 2022-06-10 06:47:40 -0700 | [diff] [blame] | 43 | After building the output directory also contains a folder |
| 44 | (chip_rpc_console_wheels), with all the wheels required for the tool. These can |
| 45 | be used to install the console without needing the sdk. Simply install all the |
| 46 | wheels in the folder: |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame] | 47 | |
cpagravel | ba1b65d | 2022-06-10 06:47:40 -0700 | [diff] [blame] | 48 | ``` |
| 49 | $ cd <project_root>/examples/common/pigweed/rpc_console/out/debug |
| 50 | $ pip install chip_rpc_console_wheels/*.whl |
| 51 | ``` |
rgoliver | 7f860ce | 2021-07-21 00:33:36 -0400 | [diff] [blame] | 52 | |
| 53 | ## Running |
| 54 | |
| 55 | To start the console provide the path to the device, for example: |
| 56 | |
cpagravel | ba1b65d | 2022-06-10 06:47:40 -0700 | [diff] [blame] | 57 | ``` |
| 58 | $ chip-console --device /dev/ttyUSB0 |
| 59 | ``` |
rgoliver | 7f860ce | 2021-07-21 00:33:36 -0400 | [diff] [blame] | 60 | |
cpagravel | 913aca0 | 2022-04-04 17:53:15 -0700 | [diff] [blame] | 61 | Note that `chip-console` is an entry point for chip_rpc.console and could also |
| 62 | be run with `python -m chip_rpc.console`. |
| 63 | |
rgoliver | 7f860ce | 2021-07-21 00:33:36 -0400 | [diff] [blame] | 64 | An example RPC command: |
| 65 | |
cpagravel | ba1b65d | 2022-06-10 06:47:40 -0700 | [diff] [blame] | 66 | ```python |
| 67 | rpcs.chip.rpc.Device.GetDeviceInfo() |
| 68 | ``` |