|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
17 #define MAX_FILENAME 255
18 #define SHELL "/root/develop/allthings_obc2014/src/popcorn/popcorn.sh"
22 "lua props=require(\"propcase\");print(\"SetupScript\");set_prop(props.ISO_MODE,3200);set_prop(props.FLASH_MODE,2);set_prop(props.RESOLUTION,0);set_prop(props.DATE_STAMP,0);set_prop(props.AF_ASSIST_BEAM,0);set_prop(props.QUALITY,0);print(\"Ready\");\n";
27 static pid_t
popen2(
const char *command,
int *infp,
int *outfp);
54 perror(
"Can't start SHELL");
60 write(
fi,
"connect\n", 8);
68 write(
fi,
"rec\n", 4);
86 write(
fi,
"quit\n", 3);
94 write(
fi,
"rs /root\n", 9);
106 int filename_idx = 0;
108 while (hash_cnt < 4) {
109 if (read(
fo, &ch, 1)) {
112 }
else if (hash_cnt >= 2 && ch !=
'#') {
113 filename[filename_idx++] = ch;
118 filename[filename_idx] = 0;
137 static pid_t
popen2(
const char *command,
int *infp,
int *outfp)
139 int p_stdin[2], p_stdout[2];
142 if (pipe(p_stdin) != 0 || pipe(p_stdout) != 0) {
150 }
else if (pid == 0) {
151 close(p_stdin[
WRITE]);
153 close(p_stdout[
READ]);
156 execl(
"/bin/sh",
"sh",
"-c", command, NULL);
162 close(p_stdin[
WRITE]);
164 *infp = p_stdin[
WRITE];
168 close(p_stdout[
READ]);
170 *outfp = p_stdout[
READ];
static void wait_for_img(char *filename, int timeout)
Wait for the image to be available TODO: add timeout.
static void wait_for_cmd(int timeout)
Wait for the commandline to be available TODO: add timeout.
void chdk_pipe_deinit(void)
Deinitialize CHDK pipe.
void chdk_pipe_shoot(char *filename)
Shoot an image.
static pid_t popen2(const char *command, int *infp, int *outfp)
Open a process with stdin and stdout.
void chdk_pipe_init(void)
Initialize the CHDK pipe.