mirror of
https://github.com/linux-msm/cdba.git
synced 2026-02-25 13:11:56 -08:00
cdba: Add option to run cdba-server locally without ssh
cdba is mainly intended for remote usage, but it also works well for controlling devices that you just need occasionally and then directly connect to your local laptop instead of a remote server. Another use case is if you just use cdba to power up a standard distro on a remote board and then SSH into it remotely. To avoid interruptions, it's better to start cdba locally on the server in a tmux session. That way, temporary disconnections do not power down the board. From a protocol perspective, everything is transferred through STDIN and STDOUT. It makes no difference if we have ssh piping the data to a remote server, or if the data is directly passed to the cdba-server binary started locally. The functionality works exactly the same. Add an option for this in the cdba client. If the -h <host> option is omitted, cdba-server is started locally.
This commit is contained in:
5
README
5
README
@@ -19,11 +19,12 @@ 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>] [-s <status-fifo>] [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. If [boot.img] is omitted,
|
||||
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
|
||||
|
||||
18
cdba.c
18
cdba.c
@@ -103,8 +103,13 @@ static int fork_ssh(const char *host, const char *cmd, int *pipes)
|
||||
close(piped_stderr[0]);
|
||||
close(piped_stderr[1]);
|
||||
|
||||
execlp("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]);
|
||||
@@ -583,12 +588,12 @@ static void usage(void)
|
||||
{
|
||||
extern const char *__progname;
|
||||
|
||||
fprintf(stderr, "usage: %s -b <board> -h <host> [-t <timeout>] "
|
||||
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);
|
||||
}
|
||||
@@ -667,9 +672,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (!host)
|
||||
usage();
|
||||
|
||||
switch (verb) {
|
||||
case CDBA_BOOT:
|
||||
if (optind > argc || !board)
|
||||
|
||||
Reference in New Issue
Block a user