Release Vulpes OS 2.7-preview.24
This commit is contained in:
parent
49572b6b45
commit
97ef99f827
135 changed files with 7717 additions and 2524 deletions
|
|
@ -31,6 +31,7 @@
|
|||
#include "beatles-lid.h"
|
||||
static volatile sig_atomic_t interrupted;
|
||||
static int phone_controls;
|
||||
static int camera_broker_active;
|
||||
static void interrupt(int sig) { interrupted = sig; }
|
||||
static void inventory_camera_nodes(void) {
|
||||
static const int minors[] = {0, 1, 32, 33};
|
||||
|
|
@ -238,6 +239,11 @@ static void inside(int seconds) {
|
|||
require(mount("/proc", ROOT "/proc", NULL, MS_BIND, NULL), "bind proc");
|
||||
require(mount("/sys", ROOT "/sys", NULL, MS_BIND, NULL), "bind sys");
|
||||
require(mount(NULL, ROOT "/sys", NULL, MS_BIND | MS_REMOUNT | MS_RDONLY, NULL), "readonly sys");
|
||||
if (camera_broker_active) {
|
||||
if (mkdir(ROOT "/work/camera-ipc",0777) && errno!=EEXIST) _exit(1);
|
||||
require(mount(BASE "/camera-ipc",ROOT "/work/camera-ipc",NULL,MS_BIND,NULL),"camera IPC mount");
|
||||
require(chmod(ROOT "/work/camera-ipc",0777),"camera IPC permissions");
|
||||
}
|
||||
require(mount("tmpfs", ROOT "/dev", "tmpfs", MS_NOSUID, "size=1m,mode=0755"), "devices");
|
||||
node(ROOT "/dev/null",1,3,0666); node(ROOT "/dev/zero",1,5,0666);
|
||||
node(ROOT "/dev/random",1,8,0666); node(ROOT "/dev/urandom",1,9,0666);
|
||||
|
|
@ -261,6 +267,7 @@ static void inside(int seconds) {
|
|||
setenv("VULPES_TRIAL_MANUAL",seconds >= 900 ? "1" : "0",1);
|
||||
setenv("VULPES_TUNDRA_RADIO",phone_controls?"1":"0",1);
|
||||
setenv("VULPES_TUNDRA_WIFI",phone_controls?"1":"0",1);
|
||||
setenv("VULPES_TUNDRA_CAMERA",camera_broker_active?"1":"0",1);
|
||||
setenv("LANG","C",1); setenv("DISPLAY",":0",1);
|
||||
setenv("LD_LIBRARY_PATH","/usr/lib/arm-linux-gnueabihf:/lib/arm-linux-gnueabihf",1);
|
||||
execl("/bin/sh","sh","/work/display-test.sh",NULL);
|
||||
|
|
@ -272,6 +279,7 @@ int main(int argc, char **argv) {
|
|||
int seconds = !strcmp(argv[1],"--temporary-45s") ? 45 :
|
||||
!strcmp(argv[1],"--temporary-90s") ? 90 :
|
||||
(!strcmp(argv[1],"--temporary-180s") || !strcmp(argv[1],"--phone-180s")) ? 180 :
|
||||
!strcmp(argv[1],"--temporary-240s") ? 240 :
|
||||
(!strcmp(argv[1],"--interactive-900s") || !strcmp(argv[1],"--phone-900s")) ? 900 :
|
||||
(!strcmp(argv[1],"--interactive-1800s") || !strcmp(argv[1],"--phone-1800s")) ? 1800 : 0;
|
||||
if (!seconds) return 2;
|
||||
|
|
@ -309,6 +317,17 @@ int main(int argc, char **argv) {
|
|||
* previous run's image be mistaken for a frame from this session. */
|
||||
unlink(ROOT "/work/camera-frame.yuv");
|
||||
unlink(ROOT "/work/camera-photo.jpg");
|
||||
/* These names belong to our API-23 diagnostic; adb shell cannot remove
|
||||
* camera-UID files from Android's sticky /data/local/tmp directory. */
|
||||
unlink("/data/local/tmp/vulpes-camera-frame.nv21");
|
||||
unlink("/data/local/tmp/vulpes-camera-frame20.nv21");
|
||||
unlink("/data/local/tmp/vulpes-camera-graphic.nv21");
|
||||
unlink("/data/local/tmp/vulpes-camera-photo.jpg");
|
||||
unlink("/data/local/tmp/vulpes-camera-glconsumer.ppm");
|
||||
unlink("/data/local/tmp/vulpes-camera-gonkqueue.nv21");
|
||||
unlink("/data/local/tmp/vulpes-camera-gonkqueue.txt");
|
||||
unlink("/data/local/tmp/vulpes-camera-callback.yuv");
|
||||
unlink("/data/local/tmp/vulpes-camera-callback.jpg");
|
||||
sleep(2);
|
||||
if (!access(BASE "/camera-probe-once", F_OK)) {
|
||||
unlink(BASE "/camera-probe-once");
|
||||
|
|
@ -326,12 +345,80 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
int result = android_service("/system/bin/stop");
|
||||
printf("stop b2g: %d\n",result);
|
||||
pid_t child = -1, radio = -1;
|
||||
pid_t child = -1, radio = -1, permission_bridge = -1, camera_broker = -1;
|
||||
struct lid_state lid;lid_init(&lid,fb);
|
||||
if (!result) {
|
||||
sleep(1);
|
||||
puts("Camera node inventory after stopping B2G");
|
||||
inventory_camera_nodes();
|
||||
int gl_camera_probe = !access(BASE "/camera-gl-probe-once", F_OK);
|
||||
int camera_service_probe = !access(BASE "/camera-service-probe-once", F_OK);
|
||||
if (gl_camera_probe || camera_service_probe) {
|
||||
unlink(BASE "/camera-service-probe-once");
|
||||
unlink(BASE "/camera-gl-probe-once");
|
||||
permission_bridge = fork();
|
||||
if (!permission_bridge) {
|
||||
int output = open(BASE "/camera-permission-bridge.log",
|
||||
O_CREAT | O_TRUNC | O_WRONLY, 0644);
|
||||
if (output >= 0) {
|
||||
fchmod(output, 0644);
|
||||
dup2(output, STDOUT_FILENO);
|
||||
dup2(output, STDERR_FILENO);
|
||||
close(output);
|
||||
}
|
||||
setenv("LD_LIBRARY_PATH", "/system/lib:/data/local/tmp", 1);
|
||||
execl("/data/local/tmp/vulpes-camera-permission-bridge",
|
||||
"vulpes-camera-permission-bridge", NULL);
|
||||
_exit(127);
|
||||
}
|
||||
if (permission_bridge > 0) sleep(2);
|
||||
pid_t probe = fork();
|
||||
if (!probe) {
|
||||
int output = open(gl_camera_probe ? BASE "/camera-gl-probe.log" :
|
||||
BASE "/camera-service-probe.log",
|
||||
O_CREAT | O_TRUNC | O_WRONLY, 0644);
|
||||
if (output >= 0) {
|
||||
fchmod(output, 0644);
|
||||
dup2(output, STDOUT_FILENO);
|
||||
dup2(output, STDERR_FILENO);
|
||||
close(output);
|
||||
}
|
||||
gid_t groups[] = {1006};
|
||||
if (setgroups(1, groups) || setgid(1006) || setuid(1006)) _exit(126);
|
||||
setenv("LD_LIBRARY_PATH", "/system/lib:/data/local/tmp", 1);
|
||||
if (gl_camera_probe)
|
||||
execl("/data/local/tmp/vulpes-camera-gl-probe-20261023",
|
||||
"vulpes-camera-gl-probe-20261023", NULL);
|
||||
else
|
||||
execl("/data/local/tmp/vulpes-camera-probe-20261023",
|
||||
"vulpes-camera-probe-20261023", "0", NULL);
|
||||
_exit(127);
|
||||
}
|
||||
if (probe > 0) {
|
||||
int probe_status = 0, finished = 0;
|
||||
for (int attempt = 0; attempt < (gl_camera_probe ? 200 : 100); attempt++) {
|
||||
if (waitpid(probe, &probe_status, WNOHANG) == probe) {
|
||||
finished = 1;
|
||||
break;
|
||||
}
|
||||
usleep(100000);
|
||||
}
|
||||
if (!finished) {
|
||||
kill(probe, SIGKILL);
|
||||
waitpid(probe, &probe_status, 0);
|
||||
printf("Camera%s probe timed out after %d seconds\n",
|
||||
gl_camera_probe ? " EGL/GLConsumer" : "1", gl_camera_probe ? 20 : 10);
|
||||
} else {
|
||||
printf("CameraService probe exit: %d\n",
|
||||
WIFEXITED(probe_status) ? WEXITSTATUS(probe_status) : -1);
|
||||
}
|
||||
}
|
||||
if (permission_bridge > 0) {
|
||||
kill(permission_bridge, SIGTERM);
|
||||
waitpid(permission_bridge, NULL, 0);
|
||||
permission_bridge = -1;
|
||||
}
|
||||
}
|
||||
int preview_dump_probe = !access(BASE "/qcamera-preview-dump-once", F_OK);
|
||||
if (!access(BASE "/qcamera-probe-once", F_OK) || preview_dump_probe) {
|
||||
unlink(BASE "/qcamera-probe-once");
|
||||
|
|
@ -393,6 +480,47 @@ int main(int argc, char **argv) {
|
|||
if (prop > 0) waitpid(prop, NULL, 0);
|
||||
if (!umount(dump_path)) rmdir(dump_path);
|
||||
}
|
||||
camera_broker_active = !access(BASE "/camera-broker-once",F_OK);
|
||||
if (camera_broker_active) {
|
||||
unlink(BASE "/camera-broker-once");
|
||||
if (mkdir(BASE "/camera-ipc",0777) && errno!=EEXIST) perror("camera IPC directory");
|
||||
chmod(BASE "/camera-ipc",0777);
|
||||
unlink(BASE "/camera-ipc/camera.sock");
|
||||
permission_bridge=fork();
|
||||
if(!permission_bridge) {
|
||||
int output=open(BASE "/camera-permission-bridge.log",O_CREAT|O_TRUNC|O_WRONLY,0644);
|
||||
if(output>=0){fchmod(output,0644);dup2(output,STDOUT_FILENO);dup2(output,STDERR_FILENO);close(output);}
|
||||
setenv("LD_LIBRARY_PATH","/system/lib:/data/local/tmp",1);
|
||||
execl("/data/local/tmp/vulpes-camera-permission-bridge","vulpes-camera-permission-bridge",NULL);
|
||||
_exit(127);
|
||||
}
|
||||
if(permission_bridge>0) {
|
||||
int ready=0;
|
||||
for(int i=0;i<50;i++) {
|
||||
FILE *log=fopen(BASE "/camera-permission-bridge.log","r");
|
||||
if(log){char line[256];while(fgets(line,sizeof(line),log))if(strstr(line,"permission bridge ready"))ready=1;fclose(log);}
|
||||
if(ready)break;
|
||||
usleep(100000);
|
||||
}
|
||||
}
|
||||
camera_broker=fork();
|
||||
if(!camera_broker) {
|
||||
int output=open(BASE "/camera-broker.log",O_CREAT|O_TRUNC|O_WRONLY,0644);
|
||||
if(output>=0){fchmod(output,0644);dup2(output,STDOUT_FILENO);dup2(output,STDERR_FILENO);close(output);}
|
||||
setenv("LD_LIBRARY_PATH","/system/lib:/data/local/tmp",1);
|
||||
execl("/data/local/tmp/vulpes-beatles-camera-broker","vulpes-beatles-camera-broker",NULL);
|
||||
_exit(127);
|
||||
}
|
||||
if(camera_broker>0) {
|
||||
int ready=0;
|
||||
for(int i=0;i<50;i++) {
|
||||
struct stat info;
|
||||
if(!stat(BASE "/camera-ipc/camera.sock",&info) && S_ISSOCK(info.st_mode)){ready=1;break;}
|
||||
usleep(100000);
|
||||
}
|
||||
if(!ready){fprintf(stderr,"Camera broker did not create its socket\n");camera_broker_active=0;}
|
||||
}
|
||||
}
|
||||
if (seconds >= 180) {
|
||||
radio = fork();
|
||||
if (!radio) radio_inside();
|
||||
|
|
@ -450,6 +578,18 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
if(radio>0) {kill(-radio,SIGKILL);waitpid(radio,NULL,0);}
|
||||
}
|
||||
if (camera_broker > 0) {
|
||||
kill(-camera_broker,SIGTERM);
|
||||
for(int i=0;i<30;i++) {
|
||||
if(waitpid(camera_broker,NULL,WNOHANG)==camera_broker){camera_broker=-1;break;}
|
||||
usleep(100000);
|
||||
}
|
||||
if(camera_broker>0){kill(-camera_broker,SIGKILL);waitpid(camera_broker,NULL,0);}
|
||||
}
|
||||
if (permission_bridge > 0) {
|
||||
kill(permission_bridge, SIGTERM);
|
||||
waitpid(permission_bridge, NULL, 0);
|
||||
}
|
||||
clean_runtime();
|
||||
lid_restore(&lid);
|
||||
if (ioctl(fb,FBIOPUT_VSCREENINFO,&original)) perror("restore framebuffer mode");
|
||||
|
|
|
|||
Loading…
Reference in a new issue