diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 6de644c3368f36..5562dc98b50f5f 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -47,7 +47,7 @@ def unblock_stdout(): if is_neos: version = int(open("/VERSION").read()) if os.path.isfile("/VERSION") else 0 revision = int(open("/REVISION").read()) if version >= 10 else 0 # Revision only present in NEOS 10 and up - neos_update_required = version < 10 or (version == 10 and revision != 3) + neos_update_required = version < 10 or (version == 10 and revision != 4) if neos_update_required: # update continue.sh before updating NEOS @@ -504,8 +504,24 @@ def manager_prepare(): # build all processes os.chdir(os.path.dirname(os.path.abspath(__file__))) - for p in managed_processes: + + params = Params() + process_cnt = len(managed_processes) + loader_proc = subprocess.Popen(["./spinner"], stdin = subprocess.PIPE, + cwd=os.path.join(BASEDIR, "selfdrive", "ui", "spinner"), + close_fds=True) + spinner_text = "chffrplus" if params.get("Passive")=="1" else "openpilot" + + for n,p in enumerate(managed_processes): + if os.getenv("PREPAREONLY") is None: + loader_text = "loading {0}: {1}/{2} {3}".format(spinner_text, n+1, process_cnt, p) + loader_proc.stdin.write(loader_text + "\n") prepare_managed_process(p) + + loader_proc.stdin.close() + loader_proc.terminate() + # end subprocesses here to stop screen flickering + #[loader_proc[pc].terminate() for pc in range(process_cnt) if loader_proc] def uninstall(): cloudlog.warning("uninstalling") @@ -518,6 +534,9 @@ def main(): # the flippening! os.system('LD_LIBRARY_PATH="" content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1') + # disable bluetooth + os.system('service call bluetooth_manager 8') + if os.getenv("NOLOG") is not None: del managed_processes['loggerd'] del managed_processes['tombstoned'] @@ -585,9 +604,11 @@ def main(): spinner_proc = None else: spinner_text = "chffrplus" if params.get("Passive")=="1" else "openpilot" - spinner_proc = subprocess.Popen(["./spinner", "loading %s"%spinner_text], + init_text = "initializing {0}".format(spinner_text) + spinner_proc = subprocess.Popen(["./spinner"], stdin = subprocess.PIPE, cwd=os.path.join(BASEDIR, "selfdrive", "ui", "spinner"), close_fds=True) + spinner_proc.stdin.write(init_text + "\n") try: manager_update() manager_init() diff --git a/selfdrive/ui/spinner/spinner b/selfdrive/ui/spinner/spinner index acc86c78cd1229..50f2bce6e7bab7 100755 Binary files a/selfdrive/ui/spinner/spinner and b/selfdrive/ui/spinner/spinner differ diff --git a/selfdrive/ui/spinner/spinner.c b/selfdrive/ui/spinner/spinner.c index ad74251502155f..95780d2623f258 100644 --- a/selfdrive/ui/spinner/spinner.c +++ b/selfdrive/ui/spinner/spinner.c @@ -16,13 +16,14 @@ #include "common/framebuffer.h" -int main(int argc, char** argv) { +int main() { int err; - - const char* spintext = NULL; - if (argc >= 2) { - spintext = argv[1]; - } + fd_set readfds; + FD_ZERO(&readfds); + struct timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 0; + char spintext[50]; // spinner int fb_w, fb_h; @@ -35,7 +36,7 @@ int main(int argc, char** argv) { NVGcontext *vg = nvgCreateGLES3(NVG_ANTIALIAS | NVG_STENCIL_STROKES); assert(vg); - int font = nvgCreateFont(vg, "Bold", "../../assets/OpenSans-SemiBold.ttf"); + int font = nvgCreateFont(vg, "Bold", "../../assets/fonts/opensans_semibold.ttf"); assert(font >= 0); int spinner_img = nvgCreateImage(vg, "../../assets/img_spinner_track.png", 0); @@ -49,6 +50,11 @@ int main(int argc, char** argv) { assert(spinner_comma_img >= 0); for (int cnt = 0; ; cnt++) { + FD_SET(STDIN_FILENO, &readfds); + if (select(1, &readfds, NULL, NULL, &timeout)) { + fgets(spintext, sizeof spintext, stdin); + spintext[strcspn(spintext, "\n")] = 0; + } glClearColor(0.1, 0.1, 0.1, 1.0); glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glEnable(GL_BLEND); @@ -85,11 +91,9 @@ int main(int argc, char** argv) { nvgFill(vg); // message - if (spintext) { - nvgTextAlign(vg, NVG_ALIGN_CENTER | NVG_ALIGN_TOP); - nvgFontSize(vg, 96.0f); - nvgText(vg, fb_w/2, (fb_h*2/3)+24, spintext, NULL); - } + nvgTextAlign(vg, NVG_ALIGN_CENTER | NVG_ALIGN_TOP); + nvgFontSize(vg, 96.0f); + nvgText(vg, fb_w/2, (fb_h*2/3)+24, spintext, NULL); nvgEndFrame(vg); eglSwapBuffers(display, surface);