-
Notifications
You must be signed in to change notification settings - Fork 16
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 protocol.md #73
Open
konradybcio
wants to merge
1
commit into
master
Choose a base branch
from
topic/protomd
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add protocol.md #73
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# CDBA protocol description | ||
|
||
## General stuff: | ||
|
||
### cdba operates over ssh | ||
|
||
### Client: | ||
* `~/.ssh/config` is effectively the 'real' config on the client side | ||
* The connection is established by executing: | ||
```sh | ||
# serverbinaryname defaults to 'cdba-server' | ||
/usr/bin/ssh user@server serverbinaryname | ||
``` | ||
* ssh `stdout` receives `messages` and the client is expected to handle them instantly after receiving, until `EOF` | ||
* ssh `stderr` receives `status updates` (blue text) and the client is expected to handle them instantly after receiving, until `EOF` | ||
|
||
### Server: | ||
* The server enumerates all of the connected devices, based on a configuration file | ||
* Client messages are received over `stdin` | ||
* Messages are sent to the clients over `stdout`, until the connection is closed (or drops) | ||
* The server opens a tty to the serial port on the device and forwards the output via `MSG_CONSOLE` | ||
|
||
## Supported messages | ||
`C - client | S - server` | ||
|
||
|
||
### 1 - MSG_SELECT_BOARD [C -> S] | ||
> ```data = string board name | len = sizeof(data) ``` | ||
> | ||
> Select the board to operate on. | ||
> | ||
> Return [**S**]: Echo the command back with `len = 0`. | ||
|
||
### 2 - MSG_CONSOLE [C <-> S] | ||
> ```data = string_buffer | len = sizeof(data) ``` | ||
> Send TTY I/O. | ||
> | ||
> Return [**C**/**S**]: Echo the command back with `len = sizeof(buf), data = buf`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way you describe hte protocol looks almost like a request/response. But at least MSG_CONSOLE isn't a request/response thing, is it? |
||
|
||
### 3 - MSG_HARDRESET | ||
`<unused>` | ||
|
||
### 4 - MSG_POWER_ON [C -> S] | ||
> ```len = 0``` | ||
> | ||
> Power on the board. | ||
> | ||
> Return [**S**]: Echo the command back with `len = 0`. | ||
|
||
### 5 - MSG_POWER_OFF [C -> S] | ||
> ```len = 0``` | ||
> | ||
> Power off the board. | ||
> | ||
> Return [**S**]: Echo the command back with `len = 0`. | ||
|
||
### 6 - MSG_FASTBOOT_PRESENT [S -> C] | ||
> ```data = 0 / 1 | len = 1 ``` | ||
> | ||
> Signal that the device is available over fastboot and ready to receive further commands. | ||
> Return [**C**]: MSG_FASTBOOT_DOWNLOAD or MSG_FASTBOOT_CONTINUE with `len = 0`. | ||
|
||
### 7 - MSG_FASTBOOT_DOWNLOAD [C -> S] | ||
> ```data = binary_chunk | len = sizeof(data)``` | ||
> | ||
> Send binary data for fastboot. | ||
> | ||
> Return [**S**]: Echo the command back with `len = 0`. | ||
|
||
### 8 - MSG_FASTBOOT_BOOT | ||
`<unused>` | ||
|
||
### 9 - MSG_STATUS_UPDATE [C -> S] | ||
> TODO: json | ||
> | ||
>Return: | ||
|
||
### 10 - MSG_VBUS_ON [C -> S] | ||
> Enable USB VBUS going to the board. | ||
> | ||
> Return [**S**]: None | ||
|
||
### 11 - MSG_VBUS_OFF [C -> S] | ||
> Disable USB VBUS going to the board. | ||
> | ||
> Return [**S**]: None | ||
|
||
### 12 - MSG_FASTBOOT_REBOOT | ||
`<unused>` | ||
|
||
### 13 - MSG_SEND_BREAK [C -> S] | ||
> ```len = 0``` | ||
> | ||
> Send a tcsendbreak to the board. | ||
> | ||
> Return [**S**]: None | ||
|
||
### 14 - MSG_LIST_DEVICES [C - > S] | ||
> ```len = 0``` | ||
> | ||
> List the available boards. | ||
> | ||
> Return [**S**]: Echo the command back NUM_DEVICES times with `len = sizeof(buf), data = buf`. Once done, echo the command back with `len = 0`. | ||
|
||
### 15 - MSG_BOARD_INFO [C -> S] | ||
> ```data = string board name | len = sizeof(data) ``` | ||
> | ||
> Get the board description. | ||
> | ||
> Return [**S**]: Echo the command back with `len = sizeof(buf), data = buf`. | ||
|
||
### 16 - MSG_FASTBOOT_CONTINUE [C -> S] | ||
> ```len = 0``` | ||
> | ||
> Send `fastboot continue` to the board. | ||
> | ||
> Return [**S**]: Echo the command back with `len = 0`. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is isually called "Respond". Also you have been using term 'message' instead of 'command.