Code Monkey home page Code Monkey logo

cdba's Introduction

= CDBA control tool
The CDBA control tool is used for remotely booting images on development boards
attached using a CDB Assist [https://github.com/sonyxperiadev/CDB-Assist] or Conmux.

= Dependencies
sudo apt-get install libudev-dev libyaml-dev libftdi1-dev pkg-config meson for debian systems
dnf install systemd-devel libyaml-devel libftdi1-devel pkg-config meson for fedora systems
pacman -S libftdi libgpiod libyaml pkgconf meson for Arch systems

= Device side
On the host with the CDB Assist or Conmux attached the "cdba-server" executable is run
from sandbox/cdba/cdba-server. Available devices are read from $HOME/.cdba

= Build instructions

# meson . build
# ninja -C build

= Client side
The client is invoked as:

  cdba -b <board> -h <host> [-c <power-cylce-count>] [-s <status-fifo>] boot.img

<host> will be connected to using ssh and <board> will be selected for
operation. As the board's fastboot interface shows up the given boot.img will
be transfered and booted on the device.

The board will execute until the key sequence ^A q is invoked or the board
outputs a sequence of 20 ~ (tilde) chards in a row.

If the optional -c is given, the board will upon receiving the tilde sequence
restart the board the given number of times. Each time booting the given
boot.img.

The optional -s argument can be used to specify that a fifo should be created
and opened. cdba will request the server to start sending status/measurement
updates, which will be written to this fifo.

How to quit the console and close session: ctrl+a then q

= Server side

== Device configuration
The list of attached devices is read from $HOME/.cdba and is YAML formatted.

== Status command

The "status-cmd" property for a board specifies a command line that should be
executed to perform measurements and report status updates to the client. The
command is expected to run for the duration of the board session and should
produce a continuous stream of json-formatted lines of status updates according
to the format defined in this document.

=== Example
devices:
  - board: db2k
    cdba: 00000001
    name: "DragonBoard2k"
    fastboot: abcdef1
    voltage: 8000

  - board: mtp2k
    conmux: mtp2k
    fastboot: abcdef2
    fastboot_set_active: true

  - board: evb2k
    users:
      - username
    console: /dev/ttyUSB0
    fastboot: abcdef3
    fastboot_set_active: true

  - board: qrd8550
    alpaca: /dev/serial/by-id/usb-QUALCOMM_Inc._Embedded_Power_Measurement__EPM__device_6E02020620151F14-if01
    console: /dev/serial/by-id/usb-QUALCOMM_MTP_Debug_Board_MT77TGG2-if00-port0
    name: QRD8550
    fastboot: 91671140
    fastboot_set_active: true
    fastboot_key_timeout: 2

  - board: testboard
    console: /dev/serial/by-id/usb-1234-if00-port0
    name: GPIO controller board
    local_gpio:
      power:
        chip: gpiochip0
        line: 7
        active_low: true
      fastboot_key:
        chip: gpiochip0
        line: 8
        active_low: true
      power_key:
        chip: gpiochip0
        line: 14
        active_low: true
      usb_disconnect:
        chip: gpiochip1
        line: 4
    fastboot: cacafada
    fastboot_set_active: true
    fastboot_key_timeout: 2

  - board: testboard2
    console: /dev/serial/by-id/usb-1234-if00-port0
    name: FTDI controller board
    ftdi_gpio:
      vendor: "0x0403"
      product: "0x6011"
      index: 0
      power:
        interface: D
        line: 7
        active_low: true
      fastboot_key:
        interface: D
        line: 8
        active_low: true
      power_key:
        interface: D
        line: 3
        active_low: true
      usb_disconnect:
        interface: D
        line: 2
    fastboot: cacafada
    fastboot_set_active: true
    fastboot_key_timeout: 2

= Status messages

The status messages that are used by the client fifo and the server's status
command should be json-formatted, with one status update per line.

Each message should contain one timestamp member "ts", and one or more
measurement members. Like so:

  {"ts":%d.%03d, "name": {["mv"|"ma"]: %u}(, "name2": {["mv"|"ma"]: %u})*}

The timestamp member ("ts"), should provide the time since first measurement in
decimal form with millisecond accuracy.

The key for the measurement members should be an identifier of the measured
resources, and the value should be an object with members for each unit
measured for the given resource and the measured value.

Valid units to report are "mv", "ma", and "mw".

Note that the cadence of measurement might differ between different items to be
measured, so not all status messages contains data for all items that can be
measured.

== Examples

Single resource "dc" measured at 20.271s, with voltage and current reported:

  {"ts":20.271, "dc":{ "mv": 12165, "ma": 114}}

Multiple resources measured in a single status message, followed by single
resource measurement, all with voltage and current reported:

  {"ts":38.341, "battery":{"mv":8023, "ma":725}, "vdd_cx":{"mv":750, "ma":466}}
  {"ts":44.339, "battery":{"mv":8023, "ma":733}}

cdba's People

Contributors

0xb0d avatar andersson avatar calebccff avatar eberman-quic avatar idlethread avatar konradybcio avatar krzk avatar lumag avatar niej avatar quic-bjorande avatar superna9999 avatar vinodkoul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cdba's Issues

Feature: report cdba server/client version

E.g.

cdba -h my-lab -l

Would return

board1 Very Cool Board (cdba 1.0-g1234abc)

Conversely, the server could log:

[x.yyyyyy] user User logged in from xx.yy.zz.aa (cdba-1.2-g4321def)

Feature: client config w/ multi-server support

Rough sketch:

~/.config/cdba/config

server1
   blah

server2
    blah

User runs:

cdba -l

User gets:

server1
 boardA-n
 boardB-m

server2
 boardA-k
 boardC-l

Additional ideas:

  • Let the user request "boardA", grab the first available one (across servers and -numbers)
  • Add preferred order / check ping/throughput for best ux
  • Let the user specify "server1/boardA" and "server1/boardA-n" in case a specific board is of interest

Add YAML config for ftdi_gpio

As of today, a single string configures the FTDI gpios.

Switch from:

    ftdi_gpio: "s:0xVEND:0xPROD:SERIAL;D;POWER,0,ACTIVE_LOW;FASTBOOT_KEY,1,ACTIVE_HIGH;POWER_KEY,2,ACTIVE_HIGH;USB_DISCONNECT,3,ACTIVE_LOW"

to

    ftdi_gpio:
     description: "s:0xVEND:0xPROD:SERIAL"
     interface: D
     gpios:
        - power:
            line: 0
            active_low: true
        - fastboot_key:
            line: 1
        - power_key:
            line: 2
        - usb_disconnect:
            line: 3
            active_low: true

but still accept the previous format with a warning

Release 1.0

I think it might be nice to mark the 1.0 release at some point.
Let's define the features that we need there before we can cut a release:

Feature: remotely flashing the board

Add support for flashing the board via the separate utility.
Server config should restrict this on a per-user basics:
For example:

devices:
  - board: rb5-1
    all-other-properties
    flash:
      rootfs:
       -  someuser@host
       - anotheruser
      modem:
        -  admin@localhost

Feature: (configurably) tell the user who's currently using the board

Sometimes you can see

Starting cdba server
cdba-server: board is in use, waiting...

which doesn't help you to determine e.g. whether the board/connection has hung with no timeout or someone is actually using the board, and if so, who that is.. Add an option (for obvious reasons) to demistify this a bit.. Maybe even something like this:

Starting cdba server
cdba-server: board is currently in use by konrad (1337 seconds), waiting...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.