mirror of
https://github.com/linux-msm/cdba.git
synced 2026-02-25 13:11:56 -08:00
Compare commits
73 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6c766db1f | ||
|
|
031948ff19 | ||
|
|
30c30ce84c | ||
|
|
95a40706be | ||
|
|
4320c482d3 | ||
|
|
cdee00d9a4 | ||
|
|
5bade34946 | ||
|
|
3c1e7cc886 | ||
|
|
bad935cbf2 | ||
|
|
9335390898 | ||
|
|
b6d70e8b0c | ||
|
|
06531f3db1 | ||
|
|
828d76df63 | ||
|
|
e799564f44 | ||
|
|
720922913c | ||
|
|
8bd8eeda33 | ||
|
|
f801448422 | ||
|
|
3922dc793a | ||
|
|
61babbf9ac | ||
|
|
358fea7207 | ||
|
|
b0df12edc0 | ||
|
|
59db2941f5 | ||
|
|
8715e3b74d | ||
|
|
aa0e50bb1d | ||
|
|
0852da5424 | ||
|
|
2f3e661f4d | ||
|
|
2899fbcbb1 | ||
|
|
61139604fb | ||
|
|
cbad92a838 | ||
|
|
95ff3049f8 | ||
|
|
5db3df360a | ||
|
|
02210fe6e2 | ||
|
|
b3b50a7441 | ||
|
|
c86932d361 | ||
|
|
d77816052d | ||
|
|
f4e95f6f0c | ||
|
|
8f668bde64 | ||
|
|
798a76ad62 | ||
|
|
ca5f95d6cd | ||
|
|
762879fd0c | ||
|
|
62dc594cb1 | ||
|
|
2f1caa28c0 | ||
|
|
f6bd2d01d7 | ||
|
|
bde90b4a15 | ||
|
|
b6c6807add | ||
|
|
1da135b08e | ||
|
|
efd1b44e74 | ||
|
|
baa48a82c2 | ||
|
|
98b4aa893a | ||
|
|
d678216fd7 | ||
|
|
68ca7e49b4 | ||
|
|
30e6838a12 | ||
|
|
f9c4d71650 | ||
|
|
266d885cde | ||
|
|
4a38c0e8e1 | ||
|
|
316119c473 | ||
|
|
fcada07889 | ||
|
|
65d867355e | ||
|
|
581f14d8f6 | ||
|
|
2c465e56dd | ||
|
|
d35abc800d | ||
|
|
5edc55cff8 | ||
|
|
43ed93357d | ||
|
|
b32d98f7a4 | ||
|
|
3269b8b891 | ||
|
|
0ad34da4f2 | ||
|
|
6d8ff75e31 | ||
|
|
cc91b34f3a | ||
|
|
81e46878ed | ||
|
|
c8e29e3400 | ||
|
|
130720a6df | ||
|
|
0a3d51e9c8 | ||
|
|
1cef583b11 |
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
@@ -43,10 +43,15 @@ jobs:
|
||||
# Fails on configure on GCC and clang (process restrictions?)
|
||||
# - fedora:rawhide
|
||||
- fedora:latest
|
||||
- fedora:42
|
||||
- fedora:41
|
||||
- fedora:40
|
||||
- fedora:39
|
||||
- fedora:38
|
||||
- fedora:37
|
||||
- ubuntu:lunar # EOL 01.2024
|
||||
- ubuntu:latest
|
||||
- ubuntu:oracular
|
||||
- ubuntu:noble
|
||||
- ubuntu:jammy
|
||||
- ubuntu:focal
|
||||
# On Ubuntu Bionic the Meson doesn't support feature options
|
||||
@@ -178,7 +183,7 @@ jobs:
|
||||
echo "PKG_CONFIG_PATH: $PKG_CONFIG_PATH"
|
||||
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install additional packages
|
||||
run: |
|
||||
|
||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -24,7 +24,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
|
||||
2
.github/workflows/yaml.yml
vendored
2
.github/workflows/yaml.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install additional packages
|
||||
run: |
|
||||
|
||||
60
README
60
README
@@ -5,6 +5,7 @@ attached using a CDB Assist [https://github.com/sonyxperiadev/CDB-Assist] or Con
|
||||
= 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
|
||||
@@ -18,11 +19,13 @@ from sandbox/cdba/cdba-server. Available devices are read from $HOME/.cdba
|
||||
= Client side
|
||||
The client is invoked as:
|
||||
|
||||
cdba -b <board> -h <host> [-c <power-cylce-count>] boot.img
|
||||
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.
|
||||
operation. As the board's fastboot interface shows up the given boot.img
|
||||
will be transfered and booted on the device. If <host> is omitted, the
|
||||
cdba-server is started locally without using ssh. If [boot.img] is omitted,
|
||||
"fastboot continue" is run to boot the installed operating system.
|
||||
|
||||
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.
|
||||
@@ -31,9 +34,25 @@ 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
|
||||
@@ -110,3 +129,38 @@ devices:
|
||||
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}}
|
||||
|
||||
87
cdba-power.c
Normal file
87
cdba-power.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Linaro Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "cdba-server.h"
|
||||
#include "device.h"
|
||||
#include "device_parser.h"
|
||||
#include "watch.h"
|
||||
|
||||
void cdba_send_buf(int type, size_t len, const void *buf)
|
||||
{
|
||||
/* ignore console messages */
|
||||
}
|
||||
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s <board> on|off\n", name);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static struct device *selected_device;
|
||||
|
||||
bool ready(void)
|
||||
{
|
||||
return device_is_running(selected_device);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *home;
|
||||
const char *name;
|
||||
bool on;
|
||||
int ret;
|
||||
|
||||
if (argc != 3)
|
||||
usage(argv[0]);
|
||||
|
||||
if (!strcmp(argv[2], "on"))
|
||||
on = true;
|
||||
else if (!strcmp(argv[2], "off"))
|
||||
on = false;
|
||||
else
|
||||
usage(argv[0]);
|
||||
|
||||
home = getenv("HOME");
|
||||
if (home)
|
||||
chdir(home);
|
||||
|
||||
ret = device_parser(".cdba");
|
||||
if (ret) {
|
||||
ret = device_parser("/etc/cdba");
|
||||
if (ret) {
|
||||
fprintf(stderr, "device parser: unable to open config file\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
name = argv[1];
|
||||
selected_device = device_open(name, "nobody");
|
||||
if (!selected_device) {
|
||||
fprintf(stderr, "failed to open %s\n", name);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (on) {
|
||||
device_power(selected_device, true);
|
||||
watch_main_loop(ready);
|
||||
|
||||
selected_device->usb_always_on = true;
|
||||
selected_device->power_always_on = true;
|
||||
} else {
|
||||
device_usb(selected_device, false);
|
||||
device_power(selected_device, false);
|
||||
}
|
||||
|
||||
device_close(selected_device);
|
||||
|
||||
return 0;
|
||||
}
|
||||
251
cdba-server.c
251
cdba-server.c
@@ -2,34 +2,8 @@
|
||||
* Copyright (c) 2016-2018, Linaro Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include <sys/time.h>
|
||||
#include <alloca.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@@ -38,6 +12,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "cdba-server.h"
|
||||
#include "circ_buf.h"
|
||||
@@ -45,40 +20,12 @@
|
||||
#include "device_parser.h"
|
||||
#include "fastboot.h"
|
||||
#include "list.h"
|
||||
#include "watch.h"
|
||||
|
||||
static bool quit_invoked;
|
||||
static const char *username;
|
||||
|
||||
struct device *selected_device;
|
||||
|
||||
int tty_open(const char *tty, struct termios *old)
|
||||
{
|
||||
struct termios tios;
|
||||
int ret;
|
||||
int fd;
|
||||
|
||||
fd = open(tty, O_RDWR | O_NOCTTY | O_EXCL);
|
||||
if (fd < 0)
|
||||
err(1, "unable to open \"%s\"", tty);
|
||||
|
||||
ret = tcgetattr(fd, old);
|
||||
if (ret < 0)
|
||||
err(1, "unable to retrieve \"%s\" tios", tty);
|
||||
|
||||
memset(&tios, 0, sizeof(tios));
|
||||
tios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
|
||||
tios.c_iflag = IGNPAR;
|
||||
tios.c_oflag = 0;
|
||||
|
||||
tcflush(fd, TCIFLUSH);
|
||||
|
||||
ret = tcsetattr(fd, TCSANOW, &tios);
|
||||
if (ret < 0)
|
||||
err(1, "unable to update \"%s\" tios", tty);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
static void fastboot_opened(struct fastboot *fb, void *data)
|
||||
{
|
||||
const uint8_t one = 1;
|
||||
@@ -108,10 +55,12 @@ static struct fastboot_ops fastboot_ops = {
|
||||
|
||||
static void msg_select_board(const void *param)
|
||||
{
|
||||
selected_device = device_open(param, username, &fastboot_ops);
|
||||
selected_device = device_open(param, username);
|
||||
if (!selected_device) {
|
||||
fprintf(stderr, "failed to open %s\n", (const char *)param);
|
||||
quit_invoked = true;
|
||||
watch_quit();
|
||||
} else {
|
||||
device_fastboot_open(selected_device, &fastboot_ops);
|
||||
}
|
||||
|
||||
cdba_send(MSG_SELECT_BOARD);
|
||||
@@ -144,6 +93,34 @@ static void msg_fastboot_download(const void *data, size_t len)
|
||||
}
|
||||
}
|
||||
|
||||
static void msg_fastboot_continue(void)
|
||||
{
|
||||
device_fastboot_continue(selected_device);
|
||||
cdba_send(MSG_FASTBOOT_CONTINUE);
|
||||
}
|
||||
|
||||
static void msg_key_release(void *data)
|
||||
{
|
||||
int key = (int)(uintptr_t)data;
|
||||
|
||||
device_key(selected_device, key, false);
|
||||
}
|
||||
|
||||
static void msg_key_press(const void *data, size_t len)
|
||||
{
|
||||
const struct key_press *press = data;
|
||||
|
||||
if (len != sizeof(*press))
|
||||
return;
|
||||
|
||||
if (press->state == KEY_PRESS_PULSE) {
|
||||
device_key(selected_device, press->key, true);
|
||||
watch_timer_add(100, msg_key_release, (void*)(uintptr_t)press->key);
|
||||
} else {
|
||||
device_key(selected_device, press->key, !!press->state);
|
||||
}
|
||||
}
|
||||
|
||||
void cdba_send_buf(int type, size_t len, const void *buf)
|
||||
{
|
||||
struct msg msg = {
|
||||
@@ -210,7 +187,7 @@ static int handle_stdin(int fd, void *buf)
|
||||
// fprintf(stderr, "fastboot boot\n");
|
||||
break;
|
||||
case MSG_STATUS_UPDATE:
|
||||
device_print_status(selected_device);
|
||||
device_status_enable(selected_device);
|
||||
break;
|
||||
case MSG_VBUS_ON:
|
||||
device_usb(selected_device, true);
|
||||
@@ -227,6 +204,12 @@ static int handle_stdin(int fd, void *buf)
|
||||
case MSG_BOARD_INFO:
|
||||
device_info(username, msg->data, msg->len);
|
||||
break;
|
||||
case MSG_FASTBOOT_CONTINUE:
|
||||
msg_fastboot_continue();
|
||||
break;
|
||||
case MSG_KEY_PRESS:
|
||||
msg_key_press(msg->data, msg->len);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "unk %d len %d\n", msg->type, msg->len);
|
||||
exit(1);
|
||||
@@ -238,124 +221,33 @@ static int handle_stdin(int fd, void *buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct watch {
|
||||
struct list_head node;
|
||||
|
||||
int fd;
|
||||
int (*cb)(int, void*);
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct timer {
|
||||
struct list_head node;
|
||||
struct timeval tv;
|
||||
|
||||
void (*cb)(void *);
|
||||
void *data;
|
||||
};
|
||||
|
||||
static struct list_head read_watches = LIST_INIT(read_watches);
|
||||
static struct list_head timer_watches = LIST_INIT(timer_watches);
|
||||
|
||||
void watch_add_readfd(int fd, int (*cb)(int, void*), void *data)
|
||||
{
|
||||
struct watch *w;
|
||||
|
||||
w = calloc(1, sizeof(*w));
|
||||
w->fd = fd;
|
||||
w->cb = cb;
|
||||
w->data = data;
|
||||
|
||||
list_add(&read_watches, &w->node);
|
||||
}
|
||||
|
||||
void watch_timer_add(int timeout_ms, void (*cb)(void *), void *data)
|
||||
{
|
||||
struct timeval tv_timeout;
|
||||
struct timeval now;
|
||||
struct timer *t;
|
||||
|
||||
t = calloc(1, sizeof(*t));
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
tv_timeout.tv_sec = timeout_ms / 1000;
|
||||
tv_timeout.tv_usec = (timeout_ms % 1000) * 1000;
|
||||
|
||||
t->cb = cb;
|
||||
t->data = data;
|
||||
timeradd(&now, &tv_timeout, &t->tv);
|
||||
|
||||
list_add(&timer_watches, &t->node);
|
||||
}
|
||||
|
||||
static struct timeval *watch_timer_next(void)
|
||||
{
|
||||
static struct timeval timeout;
|
||||
struct timeval now;
|
||||
struct timer *next;
|
||||
struct timer *t;
|
||||
|
||||
if (list_empty(&timer_watches))
|
||||
return NULL;
|
||||
|
||||
next = list_entry_first(&timer_watches, struct timer, node);
|
||||
|
||||
list_for_each_entry(t, &timer_watches, node) {
|
||||
if (timercmp(&t->tv, &next->tv, <))
|
||||
next = t;
|
||||
}
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
timersub(&next->tv, &now, &timeout);
|
||||
if (timeout.tv_sec < 0) {
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 0;
|
||||
}
|
||||
|
||||
return &timeout;
|
||||
}
|
||||
|
||||
static void watch_timer_invoke(void)
|
||||
{
|
||||
struct timeval now;
|
||||
struct timer *tmp;
|
||||
struct timer *t;
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
list_for_each_entry_safe(t, tmp, &timer_watches, node) {
|
||||
if (timercmp(&t->tv, &now, <)) {
|
||||
t->cb(t->data);
|
||||
|
||||
list_del(&t->node);
|
||||
free(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sigpipe_handler(int signo)
|
||||
{
|
||||
quit_invoked = true;
|
||||
watch_quit();
|
||||
}
|
||||
|
||||
void watch_quit(void)
|
||||
static void atexit_handler(void)
|
||||
{
|
||||
quit_invoked = true;
|
||||
syslog(LOG_INFO, "exiting");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct timeval *timeoutp;
|
||||
struct watch *w;
|
||||
fd_set rfds;
|
||||
int flags;
|
||||
int nfds;
|
||||
int ret;
|
||||
|
||||
signal(SIGPIPE, sigpipe_handler);
|
||||
|
||||
fprintf(stderr, "Starting cdba server\n");
|
||||
|
||||
username = getenv("CDBA_USER");
|
||||
if (!username)
|
||||
username = getenv("USER");
|
||||
if (!username)
|
||||
username = "nobody";
|
||||
|
||||
openlog("cdba-server", LOG_PID, LOG_DAEMON);
|
||||
atexit(atexit_handler);
|
||||
|
||||
ret = device_parser(".cdba");
|
||||
if (ret) {
|
||||
@@ -371,40 +263,7 @@ int main(int argc, char **argv)
|
||||
flags = fcntl(STDIN_FILENO, F_GETFL, 0);
|
||||
fcntl(STDIN_FILENO, F_SETFL, flags | O_NONBLOCK);
|
||||
|
||||
while (!quit_invoked) {
|
||||
nfds = 0;
|
||||
|
||||
list_for_each_entry(w, &read_watches, node) {
|
||||
nfds = MAX(nfds, w->fd);
|
||||
FD_SET(w->fd, &rfds);
|
||||
}
|
||||
|
||||
if (!FD_ISSET(STDIN_FILENO, &rfds)) {
|
||||
fprintf(stderr, "rfds is trash!\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
timeoutp = watch_timer_next();
|
||||
ret = select(nfds + 1, &rfds, NULL, NULL, timeoutp);
|
||||
if (ret < 0 && errno == EINTR)
|
||||
continue;
|
||||
else if (ret < 0)
|
||||
break;
|
||||
|
||||
watch_timer_invoke();
|
||||
|
||||
list_for_each_entry(w, &read_watches, node) {
|
||||
if (FD_ISSET(w->fd, &rfds)) {
|
||||
ret = w->cb(w->fd, w->data);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "cb returned %d\n", ret);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
watch_run();
|
||||
|
||||
/* if we got here, stdin/out/err might be not accessible anymore */
|
||||
ret = open("/dev/null", O_RDWR);
|
||||
|
||||
@@ -6,14 +6,6 @@
|
||||
|
||||
#include "cdba.h"
|
||||
|
||||
void watch_add_readfd(int fd, int (*cb)(int, void*), void *data);
|
||||
int watch_add_quit(int (*cb)(int, void*), void *data);
|
||||
void watch_timer_add(int timeout_ms, void (*cb)(void *), void *data);
|
||||
void watch_quit(void);
|
||||
int watch_run(void);
|
||||
|
||||
int tty_open(const char *tty, struct termios *old);
|
||||
|
||||
void cdba_send_buf(int type, size_t len, const void *buf);
|
||||
#define cdba_send(type) cdba_send_buf(type, 0, NULL)
|
||||
|
||||
|
||||
182
cdba.c
182
cdba.c
@@ -2,31 +2,7 @@
|
||||
* Copyright (c) 2016-2018, Linaro Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include <sys/select.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -51,6 +27,9 @@
|
||||
static bool quit;
|
||||
static bool fastboot_repeat;
|
||||
static bool fastboot_done;
|
||||
static bool fastboot_continue;
|
||||
|
||||
static int status_fd = -1;
|
||||
|
||||
static const char *fastboot_file;
|
||||
|
||||
@@ -124,8 +103,13 @@ static int fork_ssh(const char *host, const char *cmd, int *pipes)
|
||||
close(piped_stderr[0]);
|
||||
close(piped_stderr[1]);
|
||||
|
||||
execl("/usr/bin/ssh", "ssh", host, cmd, NULL);
|
||||
err(1, "launching ssh failed");
|
||||
if (host) {
|
||||
execlp("ssh", "ssh", host, cmd, NULL);
|
||||
err(1, "launching ssh failed");
|
||||
} else {
|
||||
execlp(cmd, cmd, NULL);
|
||||
err(1, "launching cdba-server failed");
|
||||
}
|
||||
default:
|
||||
close(piped_stdin[0]);
|
||||
close(piped_stdout[1]);
|
||||
@@ -164,8 +148,25 @@ static int cdba_send_buf(int fd, int type, size_t len, const void *buf)
|
||||
return ret < 0 ? ret : 0;
|
||||
}
|
||||
|
||||
static int cdba_send_key(int fd, int key, uint8_t state)
|
||||
{
|
||||
struct key_press press = {
|
||||
.key = key,
|
||||
.state = state,
|
||||
};
|
||||
|
||||
return cdba_send_buf(fd, MSG_KEY_PRESS, sizeof(press), &press);
|
||||
}
|
||||
|
||||
static int cdba_toggle_key(int fd, int key, bool key_state[DEVICE_KEY_COUNT])
|
||||
{
|
||||
key_state[key] = !key_state[key];
|
||||
return cdba_send_key(fd, key, key_state[key]);
|
||||
}
|
||||
|
||||
static int tty_callback(int *ssh_fds)
|
||||
{
|
||||
static bool key_state[DEVICE_KEY_COUNT];
|
||||
static const char ctrl_a = 0x1;
|
||||
static bool special;
|
||||
char buf[32];
|
||||
@@ -205,6 +206,18 @@ static int tty_callback(int *ssh_fds)
|
||||
case 'B':
|
||||
cdba_send(ssh_fds[0], MSG_SEND_BREAK);
|
||||
break;
|
||||
case 'o':
|
||||
cdba_send_key(ssh_fds[0], DEVICE_KEY_POWER, KEY_PRESS_PULSE);
|
||||
break;
|
||||
case 'O':
|
||||
cdba_toggle_key(ssh_fds[0], DEVICE_KEY_POWER, key_state);
|
||||
break;
|
||||
case 'f':
|
||||
cdba_send_key(ssh_fds[0], DEVICE_KEY_FASTBOOT, KEY_PRESS_PULSE);
|
||||
break;
|
||||
case 'F':
|
||||
cdba_toggle_key(ssh_fds[0], DEVICE_KEY_FASTBOOT, key_state);
|
||||
break;
|
||||
}
|
||||
|
||||
special = false;
|
||||
@@ -338,6 +351,22 @@ static void request_power_off(void)
|
||||
list_add(&work_items, &work.node);
|
||||
}
|
||||
|
||||
static void request_fastboot_continue_fn(struct work *work, int ssh_stdin)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = cdba_send(ssh_stdin, MSG_FASTBOOT_CONTINUE);
|
||||
if (ret < 0)
|
||||
err(1, "failed to send fastboot continue request");
|
||||
}
|
||||
|
||||
static void request_fastboot_continue(void)
|
||||
{
|
||||
static struct work work = { request_fastboot_continue_fn };
|
||||
|
||||
list_add(&work_items, &work.node);
|
||||
}
|
||||
|
||||
struct fastboot_download_work {
|
||||
struct work work;
|
||||
|
||||
@@ -398,12 +427,40 @@ static void request_fastboot_files(void)
|
||||
|
||||
static void handle_status_update(const void *data, size_t len)
|
||||
{
|
||||
char *str = alloca(len + 1);
|
||||
if (status_fd < 0)
|
||||
return;
|
||||
|
||||
memcpy(str, data, len);
|
||||
str[len] = '\n';
|
||||
write(status_fd, data, len);
|
||||
}
|
||||
|
||||
write(STDOUT_FILENO, str, len + 1);
|
||||
static void status_enable_fn(struct work *work, int ssh_stdin)
|
||||
{
|
||||
cdba_send(ssh_stdin, MSG_STATUS_UPDATE);
|
||||
|
||||
free(work);
|
||||
}
|
||||
|
||||
static void status_pipe_open(const char *path)
|
||||
{
|
||||
struct work *work;
|
||||
int ret;
|
||||
int fd;
|
||||
|
||||
ret = mkfifo(path, 0600);
|
||||
if (ret < 0 && errno != EEXIST)
|
||||
err(1, "failed to create fifo %s", path);
|
||||
|
||||
fd = open(path, O_RDWR | O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
err(1, "failed to open fifo %s", path);
|
||||
|
||||
status_fd = fd;
|
||||
|
||||
/* Queue a MSG_STATUS_UPDATE request */
|
||||
work = malloc(sizeof(*work));
|
||||
work->fn = status_enable_fn;
|
||||
|
||||
list_add(&work_items, &work->node);
|
||||
}
|
||||
|
||||
static void handle_list_devices(const void *data, size_t len)
|
||||
@@ -502,17 +559,19 @@ static int handle_message(struct circ_buf *buf)
|
||||
case MSG_FASTBOOT_PRESENT:
|
||||
if (*(uint8_t*)msg->data) {
|
||||
// printf("======================================== MSG_FASTBOOT_PRESENT(on)\n");
|
||||
if (!fastboot_done || fastboot_repeat)
|
||||
if (fastboot_continue) {
|
||||
request_fastboot_continue();
|
||||
fastboot_continue = false;
|
||||
} else if (!fastboot_done || fastboot_repeat) {
|
||||
request_fastboot_files();
|
||||
else
|
||||
} else {
|
||||
quit = true;
|
||||
} else {
|
||||
fastboot_done = true;
|
||||
// printf("======================================== MSG_FASTBOOT_PRESENT(off)\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MSG_FASTBOOT_DOWNLOAD:
|
||||
// printf("======================================== MSG_FASTBOOT_DOWNLOAD\n");
|
||||
fastboot_done = true;
|
||||
break;
|
||||
case MSG_FASTBOOT_BOOT:
|
||||
// printf("======================================== MSG_FASTBOOT_BOOT\n");
|
||||
@@ -527,6 +586,10 @@ static int handle_message(struct circ_buf *buf)
|
||||
handle_board_info(msg->data, msg->len);
|
||||
return -1;
|
||||
break;
|
||||
case MSG_FASTBOOT_CONTINUE:
|
||||
// printf("======================================== MSG_FASTBOOT_CONTINUE\n");
|
||||
fastboot_done = true;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "unk %d len %d\n", msg->type, msg->len);
|
||||
return -1;
|
||||
@@ -554,12 +617,12 @@ static void usage(void)
|
||||
{
|
||||
extern const char *__progname;
|
||||
|
||||
fprintf(stderr, "usage: %s -b <board> -h <host> [-t <timeout>] "
|
||||
"[-T <inactivity-timeout>] boot.img\n",
|
||||
fprintf(stderr, "usage: %s -b <board> [-h <host>] [-t <timeout>] "
|
||||
"[-T <inactivity-timeout>] [boot.img]\n",
|
||||
__progname);
|
||||
fprintf(stderr, "usage: %s -i -b <board> -h <host>\n",
|
||||
fprintf(stderr, "usage: %s -i -b <board> [-h <host>]\n",
|
||||
__progname);
|
||||
fprintf(stderr, "usage: %s -l -h <host>\n",
|
||||
fprintf(stderr, "usage: %s -l [-h <host>]\n",
|
||||
__progname);
|
||||
exit(1);
|
||||
}
|
||||
@@ -575,8 +638,10 @@ int main(int argc, char **argv)
|
||||
bool power_cycle_on_timeout = true;
|
||||
struct timeval timeout_inactivity_tv;
|
||||
struct timeval timeout_total_tv;
|
||||
struct timeval *timeout = NULL;
|
||||
struct termios *orig_tios;
|
||||
const char *server_binary = "cdba-server";
|
||||
const char *status_pipe = NULL;
|
||||
int timeout_inactivity = 0;
|
||||
int timeout_total = 600;
|
||||
struct work *next;
|
||||
@@ -597,7 +662,7 @@ int main(int argc, char **argv)
|
||||
int opt;
|
||||
int ret;
|
||||
|
||||
while ((opt = getopt(argc, argv, "b:c:C:h:ilRt:S:T:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "b:c:C:h:ilRt:S:s:T:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'b':
|
||||
board = optarg;
|
||||
@@ -623,6 +688,9 @@ int main(int argc, char **argv)
|
||||
case 'S':
|
||||
server_binary = optarg;
|
||||
break;
|
||||
case 's':
|
||||
status_pipe = optarg;
|
||||
break;
|
||||
case 't':
|
||||
timeout_total = atoi(optarg);
|
||||
break;
|
||||
@@ -634,18 +702,17 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (!host)
|
||||
usage();
|
||||
|
||||
switch (verb) {
|
||||
case CDBA_BOOT:
|
||||
if (optind >= argc || !board)
|
||||
if (optind > argc || !board)
|
||||
usage();
|
||||
|
||||
fastboot_file = argv[optind];
|
||||
if (lstat(fastboot_file, &sb))
|
||||
if (!fastboot_file)
|
||||
fastboot_continue = true;
|
||||
else if (lstat(fastboot_file, &sb))
|
||||
err(1, "unable to read \"%s\"", fastboot_file);
|
||||
if (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode))
|
||||
else if (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode))
|
||||
errx(1, "\"%s\" is not a regular file", fastboot_file);
|
||||
|
||||
request_select_board(board);
|
||||
@@ -661,6 +728,9 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
if (status_pipe)
|
||||
status_pipe_open(status_pipe);
|
||||
|
||||
ret = fork_ssh(host, server_binary, ssh_fds);
|
||||
if (ret)
|
||||
err(1, "failed to connect to \"%s\"", host);
|
||||
@@ -669,6 +739,8 @@ int main(int argc, char **argv)
|
||||
|
||||
timeout_total_tv = get_timeout(timeout_total);
|
||||
timeout_inactivity_tv = get_timeout(timeout_inactivity);
|
||||
if (timeout_total || timeout_inactivity)
|
||||
timeout = &tv;
|
||||
|
||||
while (!quit) {
|
||||
if (received_power_off || reached_timeout) {
|
||||
@@ -706,14 +778,16 @@ int main(int argc, char **argv)
|
||||
if (!list_empty(&work_items))
|
||||
FD_SET(ssh_fds[0], &wfds);
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
if (timeout_inactivity && timercmp(&timeout_inactivity_tv, &timeout_total_tv, <)) {
|
||||
timersub(&timeout_inactivity_tv, &now, &tv);
|
||||
} else {
|
||||
timersub(&timeout_total_tv, &now, &tv);
|
||||
if (timeout) {
|
||||
gettimeofday(&now, NULL);
|
||||
if (timeout_inactivity && (!timeout_total ||
|
||||
timercmp(&timeout_inactivity_tv, &timeout_total_tv, <))) {
|
||||
timersub(&timeout_inactivity_tv, &now, timeout);
|
||||
} else {
|
||||
timersub(&timeout_total_tv, &now, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
ret = select(nfds + 1, &rfds, &wfds, NULL, &tv);
|
||||
ret = select(nfds + 1, &rfds, &wfds, NULL, timeout);
|
||||
#if 0
|
||||
printf("select: %d (%c%c%c)\n", ret, FD_ISSET(STDIN_FILENO, &rfds) ? 'X' : '-',
|
||||
FD_ISSET(ssh_fds[1], &rfds) ? 'X' : '-',
|
||||
|
||||
19
cdba.h
19
cdba.h
@@ -30,6 +30,25 @@ enum {
|
||||
MSG_SEND_BREAK,
|
||||
MSG_LIST_DEVICES,
|
||||
MSG_BOARD_INFO,
|
||||
MSG_FASTBOOT_CONTINUE,
|
||||
MSG_KEY_PRESS,
|
||||
};
|
||||
|
||||
struct key_press {
|
||||
uint8_t key;
|
||||
uint8_t state;
|
||||
} __packed;
|
||||
|
||||
enum {
|
||||
DEVICE_KEY_FASTBOOT,
|
||||
DEVICE_KEY_POWER,
|
||||
DEVICE_KEY_COUNT
|
||||
};
|
||||
|
||||
enum {
|
||||
KEY_PRESS_RELEASE,
|
||||
KEY_PRESS_PRESS,
|
||||
KEY_PRESS_PULSE,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,7 +17,7 @@ case $CC in
|
||||
esac
|
||||
|
||||
pacman -Syu --noconfirm \
|
||||
libftdi-compat \
|
||||
libftdi \
|
||||
libyaml \
|
||||
systemd-libs \
|
||||
libgpiod \
|
||||
|
||||
26
circ_buf.c
26
circ_buf.c
@@ -2,31 +2,7 @@
|
||||
* Copyright (c) 2018, Linaro Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
26
circ_buf.h
26
circ_buf.h
@@ -2,31 +2,7 @@
|
||||
* Copyright (c) 2018, Linaro Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef __CIRC_BUF_H__
|
||||
#define __CIRC_BUF_H__
|
||||
|
||||
8
config-samples/sample11.yaml
Normal file
8
config-samples/sample11.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
devices:
|
||||
- board: myboard
|
||||
name: "My Board"
|
||||
alpaca: /dev/ttyACM0
|
||||
console: /dev/ttyUSB0
|
||||
fastboot: cacafada
|
||||
status-cmd: /usr/bin/sample-measure-app --sample-rate 100 /dev/measure0
|
||||
13
config-samples/sample12.yaml
Normal file
13
config-samples/sample12.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
devices:
|
||||
- board: myboard
|
||||
name: "My Board"
|
||||
description: |
|
||||
My Awesome board
|
||||
console: /dev/ttyABC0
|
||||
fastboot: cacafada
|
||||
fastboot_set_active: true
|
||||
fastboot_key_timeout: 2
|
||||
laurent:
|
||||
server: laurent.lan
|
||||
relay: 5
|
||||
@@ -73,3 +73,32 @@ devices:
|
||||
power:
|
||||
interface: D
|
||||
line: 6
|
||||
- board: myboard-5
|
||||
name: "My Board 5"
|
||||
description: |
|
||||
My super awesome board Number 5
|
||||
console: /dev/ttyABC1
|
||||
fastboot: cacafada
|
||||
ftdi_gpio:
|
||||
vendor: "0x0403"
|
||||
product: "0x6011"
|
||||
index: 0
|
||||
power:
|
||||
interface: B
|
||||
line: 1
|
||||
active_low: true
|
||||
fastboot_key:
|
||||
interface: B
|
||||
line: 0
|
||||
active_low: true
|
||||
power_key:
|
||||
interface: B
|
||||
line: 2
|
||||
usb0_disconnect:
|
||||
interface: C
|
||||
line: 7
|
||||
active_low: true
|
||||
usb1_disconnect:
|
||||
interface: A
|
||||
line: 4
|
||||
active_low: true
|
||||
|
||||
28
console.c
28
console.c
@@ -2,31 +2,7 @@
|
||||
* Copyright (c) 2020, Linaro Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -37,6 +13,8 @@
|
||||
|
||||
#include "cdba-server.h"
|
||||
#include "device.h"
|
||||
#include "tty.h"
|
||||
#include "watch.h"
|
||||
|
||||
struct console {
|
||||
int console_fd;
|
||||
|
||||
130
device.c
130
device.c
@@ -2,31 +2,7 @@
|
||||
* Copyright (c) 2016-2018, Linaro Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -39,12 +15,15 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "cdba-server.h"
|
||||
#include "device.h"
|
||||
#include "fastboot.h"
|
||||
#include "list.h"
|
||||
#include "ppps.h"
|
||||
#include "status-cmd.h"
|
||||
#include "watch.h"
|
||||
|
||||
#define ARRAY_SIZE(x) ((sizeof(x)/sizeof((x)[0])))
|
||||
|
||||
@@ -85,15 +64,21 @@ static void device_lock(struct device *device)
|
||||
if (fd < 0)
|
||||
err(1, "failed to open lockfile %s", lock);
|
||||
|
||||
n = flock(fd, LOCK_EX | LOCK_NB);
|
||||
if (!n)
|
||||
return;
|
||||
while (1) {
|
||||
char c;
|
||||
|
||||
warnx("board is in use, waiting...");
|
||||
n = flock(fd, LOCK_EX | LOCK_NB);
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
n = flock(fd, LOCK_EX);
|
||||
if (n < 0)
|
||||
err(1, "failed to lock lockfile %s", lock);
|
||||
warnx("board is in use, waiting...");
|
||||
|
||||
sleep(3);
|
||||
|
||||
/* check that connection isn't gone */
|
||||
if (read(STDIN_FILENO, &c, 1) == 0)
|
||||
errx(1, "connection is gone");
|
||||
}
|
||||
}
|
||||
|
||||
static bool device_check_access(struct device *device,
|
||||
@@ -115,9 +100,10 @@ static bool device_check_access(struct device *device,
|
||||
return false;
|
||||
}
|
||||
|
||||
static int device_power_off(struct device *device);
|
||||
|
||||
struct device *device_open(const char *board,
|
||||
const char *username,
|
||||
struct fastboot_ops *fastboot_ops)
|
||||
const char *username)
|
||||
{
|
||||
struct device *device;
|
||||
|
||||
@@ -126,11 +112,17 @@ struct device *device_open(const char *board,
|
||||
goto found;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "user %s asked for non-existing board %s", username, board);
|
||||
return NULL;
|
||||
|
||||
found:
|
||||
if (!device_check_access(device, username))
|
||||
if (!device_check_access(device, username)) {
|
||||
syslog(LOG_INFO, "user %s access denied to the board %s", username, board);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "user %s opening board %s", username, board);
|
||||
|
||||
assert(device->console_ops);
|
||||
assert(device->console_ops->open);
|
||||
@@ -148,11 +140,21 @@ found:
|
||||
if (!device->console)
|
||||
errx(1, "failed to open device console");
|
||||
|
||||
/*
|
||||
* Power off before opening fastboot. Otherwise if the device is
|
||||
* already in the fastboot state, CDBA will detect it, then power up
|
||||
* procedure will restart the device causing fastboot to disappear and
|
||||
* appear again. This will cause CDBA to exit, ending up with the
|
||||
* unbreakable fastboot-reset-second_fastboot-quit cycle.
|
||||
* */
|
||||
if (device->power_always_on) {
|
||||
device_power_off(device);
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
if (device->usb_always_on)
|
||||
device_usb(device, true);
|
||||
|
||||
device->fastboot = fastboot_open(device->serial, fastboot_ops, NULL);
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
@@ -161,7 +163,7 @@ static void device_impl_power(struct device *device, bool on)
|
||||
device_control(device, power, on);
|
||||
}
|
||||
|
||||
static void device_key(struct device *device, int key, bool asserted)
|
||||
void device_key(struct device *device, int key, bool asserted)
|
||||
{
|
||||
if (device_has_control(device, key))
|
||||
device_control(device, key, key, asserted);
|
||||
@@ -231,6 +233,11 @@ static void device_tick(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
bool device_is_running(struct device *device)
|
||||
{
|
||||
return device->state == DEVICE_STATE_RUNNING;
|
||||
}
|
||||
|
||||
static int device_power_on(struct device *device)
|
||||
{
|
||||
if (!device || !device_has_control(device, power))
|
||||
@@ -260,17 +267,25 @@ int device_power(struct device *device, bool on)
|
||||
return device_power_off(device);
|
||||
}
|
||||
|
||||
void device_print_status(struct device *device)
|
||||
void device_status_enable(struct device *device)
|
||||
{
|
||||
if (device_has_control(device, print_status))
|
||||
device_control(device, print_status);
|
||||
if (device->status_enabled)
|
||||
return;
|
||||
|
||||
if (device_has_control(device, status_enable))
|
||||
device_control(device, status_enable);
|
||||
|
||||
if (device->status_cmd)
|
||||
status_cmd_open(device);
|
||||
|
||||
device->status_enabled = true;
|
||||
}
|
||||
|
||||
void device_usb(struct device *device, bool on)
|
||||
{
|
||||
if (device->ppps_path)
|
||||
ppps_power(device, on);
|
||||
else if (device_has_control(device, usb))
|
||||
if (device_has_control(device, usb))
|
||||
device_control(device, usb, on);
|
||||
}
|
||||
|
||||
@@ -282,13 +297,36 @@ int device_write(struct device *device, const void *buf, size_t len)
|
||||
return device_console(device, write, buf, len);
|
||||
}
|
||||
|
||||
void device_fastboot_open(struct device *device,
|
||||
struct fastboot_ops *fastboot_ops)
|
||||
{
|
||||
device->fastboot = fastboot_open(device->serial, fastboot_ops, NULL);
|
||||
}
|
||||
|
||||
void device_fastboot_boot(struct device *device)
|
||||
{
|
||||
if (!device->fastboot) {
|
||||
fprintf(stderr, "fastboot not opened\n");
|
||||
return;
|
||||
}
|
||||
fastboot_boot(device->fastboot);
|
||||
}
|
||||
|
||||
void device_fastboot_continue(struct device *device)
|
||||
{
|
||||
if (!device->fastboot) {
|
||||
fprintf(stderr, "fastboot not opened\n");
|
||||
return;
|
||||
}
|
||||
fastboot_continue(device->fastboot);
|
||||
}
|
||||
|
||||
void device_fastboot_flash_reboot(struct device *device)
|
||||
{
|
||||
if (!device->fastboot) {
|
||||
fprintf(stderr, "fastboot not opened\n");
|
||||
return;
|
||||
}
|
||||
fastboot_flash(device->fastboot, "boot");
|
||||
fastboot_reboot(device->fastboot);
|
||||
}
|
||||
@@ -300,6 +338,11 @@ void device_boot(struct device *device, const void *data, size_t len)
|
||||
fastboot_set_active(device->fastboot, device->set_active);
|
||||
fastboot_download(device->fastboot, data, len);
|
||||
device->boot(device);
|
||||
|
||||
if (device->status_enabled && !device->usb_always_on) {
|
||||
warnx("disabling USB, use ^A V to enable");
|
||||
device_usb(device, false);
|
||||
}
|
||||
}
|
||||
|
||||
void device_send_break(struct device *device)
|
||||
@@ -356,7 +399,8 @@ void device_close(struct device *dev)
|
||||
{
|
||||
if (!dev->usb_always_on)
|
||||
device_usb(dev, false);
|
||||
device_power(dev, false);
|
||||
if (!dev->power_always_on)
|
||||
device_power(dev, false);
|
||||
|
||||
if (device_has_control(dev, close))
|
||||
device_control(dev, close);
|
||||
|
||||
24
device.h
24
device.h
@@ -2,6 +2,7 @@
|
||||
#define __DEVICE_H__
|
||||
|
||||
#include <termios.h>
|
||||
#include "cdba.h"
|
||||
#include "list.h"
|
||||
|
||||
struct cdb_assist;
|
||||
@@ -17,7 +18,7 @@ struct control_ops {
|
||||
int (*power)(struct device *dev, bool on);
|
||||
void (*usb)(struct device *dev, bool on);
|
||||
void (*key)(struct device *device, int key, bool asserted);
|
||||
void (*print_status)(struct device *dev);
|
||||
void (*status_enable)(struct device *dev);
|
||||
};
|
||||
|
||||
struct console_ops {
|
||||
@@ -41,11 +42,14 @@ struct device {
|
||||
unsigned voltage;
|
||||
bool tickle_mmc;
|
||||
bool usb_always_on;
|
||||
bool power_always_on;
|
||||
struct fastboot *fastboot;
|
||||
unsigned int fastboot_key_timeout;
|
||||
int state;
|
||||
bool has_power_key;
|
||||
|
||||
bool status_enabled;
|
||||
|
||||
void (*boot)(struct device *);
|
||||
|
||||
const struct control_ops *control_ops;
|
||||
@@ -56,6 +60,8 @@ struct device {
|
||||
void *cdb;
|
||||
void *console;
|
||||
|
||||
char *status_cmd;
|
||||
|
||||
struct list_head node;
|
||||
};
|
||||
|
||||
@@ -68,27 +74,26 @@ struct device_user {
|
||||
void device_add(struct device *device);
|
||||
|
||||
struct device *device_open(const char *board,
|
||||
const char *username,
|
||||
struct fastboot_ops *fastboot_ops);
|
||||
const char *username);
|
||||
void device_close(struct device *dev);
|
||||
int device_power(struct device *device, bool on);
|
||||
void device_key(struct device *device, int key, bool asserted);
|
||||
|
||||
void device_print_status(struct device *device);
|
||||
void device_status_enable(struct device *device);
|
||||
void device_usb(struct device *device, bool on);
|
||||
int device_write(struct device *device, const void *buf, size_t len);
|
||||
|
||||
void device_boot(struct device *device, const void *data, size_t len);
|
||||
|
||||
void device_fastboot_open(struct device *device,
|
||||
struct fastboot_ops *fastboot_ops);
|
||||
void device_fastboot_boot(struct device *device);
|
||||
void device_fastboot_flash_reboot(struct device *device);
|
||||
void device_send_break(struct device *device);
|
||||
void device_list_devices(const char *username);
|
||||
void device_info(const char *username, const void *data, size_t dlen);
|
||||
|
||||
enum {
|
||||
DEVICE_KEY_FASTBOOT,
|
||||
DEVICE_KEY_POWER,
|
||||
};
|
||||
void device_fastboot_continue(struct device *device);
|
||||
bool device_is_running(struct device *device);
|
||||
|
||||
extern const struct control_ops alpaca_ops;
|
||||
extern const struct control_ops cdb_assist_ops;
|
||||
@@ -97,6 +102,7 @@ extern const struct control_ops ftdi_gpio_ops;
|
||||
extern const struct control_ops local_gpio_ops;
|
||||
extern const struct control_ops external_ops;
|
||||
extern const struct control_ops qcomlt_dbg_ops;
|
||||
extern const struct control_ops laurent_ops;
|
||||
|
||||
extern const struct console_ops conmux_console_ops;
|
||||
extern const struct console_ops console_ops;
|
||||
|
||||
@@ -2,31 +2,7 @@
|
||||
* Copyright (c) 2018, Linaro Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
@@ -46,6 +22,11 @@ static void nextsym(struct device_parser *dp)
|
||||
{
|
||||
if (!yaml_parser_parse(&dp->parser, &dp->event)) {
|
||||
fprintf(stderr, "device parser: error %u\n", dp->parser.error);
|
||||
fprintf(stderr,
|
||||
"device parser: index %zu, line %zu, column %zu\n",
|
||||
dp->parser.context_mark.index,
|
||||
dp->parser.context_mark.line,
|
||||
dp->parser.context_mark.column);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -67,6 +48,33 @@ int device_parser_accept(struct device_parser *dp, int type,
|
||||
}
|
||||
}
|
||||
|
||||
void decode_yaml_type_error(struct device_parser *dp, int type)
|
||||
{
|
||||
char event_type[11][26] = {
|
||||
"YAML_NO_EVENT",
|
||||
"YAML_STREAM_START_EVENT",
|
||||
"YAML_STREAM_END_EVENT",
|
||||
"YAML_DOCUMENT_START_EVENT",
|
||||
"YAML_DOCUMENT_END_EVENT",
|
||||
"YAML_ALIAS_EVENT",
|
||||
"YAML_SCALAR_EVENT",
|
||||
"YAML_SEQUENCE_START_EVENT",
|
||||
"YAML_SEQUENCE_END_EVENT",
|
||||
"YAML_MAPPING_START_EVENT",
|
||||
"YAML_MAPPING_END_EVENT"
|
||||
};
|
||||
|
||||
fprintf(stderr,
|
||||
"device parser: expected %s got %s\n",
|
||||
event_type[type],
|
||||
event_type[dp->event.type]);
|
||||
fprintf(stderr,
|
||||
"device parser: index %zu, line %zu, column %zu\n",
|
||||
dp->parser.mark.index,
|
||||
dp->parser.mark.line,
|
||||
dp->parser.mark.column);
|
||||
}
|
||||
|
||||
bool device_parser_expect(struct device_parser *dp, int type,
|
||||
char *scalar, size_t scalar_len)
|
||||
{
|
||||
@@ -74,7 +82,7 @@ bool device_parser_expect(struct device_parser *dp, int type,
|
||||
return true;
|
||||
}
|
||||
|
||||
fprintf(stderr, "device parser: expected %d got %u\n", type, dp->event.type);
|
||||
decode_yaml_type_error(dp, type);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -139,6 +147,11 @@ static void parse_board(struct device_parser *dp)
|
||||
if (dev->control_options)
|
||||
set_control_ops(dev, &ftdi_gpio_ops);
|
||||
continue;
|
||||
} else if (!strcmp(key, "laurent")) {
|
||||
dev->control_options = laurent_ops.parse_options(dp);
|
||||
if (dev->control_options)
|
||||
set_control_ops(dev, &laurent_ops);
|
||||
continue;
|
||||
}
|
||||
|
||||
device_parser_expect(dp, YAML_SCALAR_EVENT, value, TOKEN_LENGTH);
|
||||
@@ -193,6 +206,10 @@ static void parse_board(struct device_parser *dp)
|
||||
dev->ppps_path = strdup(value);
|
||||
} else if (!strcmp(key, "ppps3_path")) {
|
||||
dev->ppps3_path = strdup(value);
|
||||
} else if (!strcmp(key, "status-cmd")) {
|
||||
dev->status_cmd = strdup(value);
|
||||
} else if (!strcmp(key, "power_always_on")) {
|
||||
dev->power_always_on = !strcmp(value, "true");
|
||||
} else {
|
||||
fprintf(stderr, "device parser: unknown key \"%s\"\n", key);
|
||||
exit(1);
|
||||
|
||||
@@ -2,31 +2,7 @@
|
||||
* Copyright (c) 2018, Linaro Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
@@ -41,8 +17,8 @@
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "cdba-server.h"
|
||||
#include "device.h"
|
||||
#include "tty.h"
|
||||
|
||||
struct alpaca {
|
||||
int alpaca_fd;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user