explicitly turn display on in updater (#2362)
	
		
	
				
					
				
			* explicitly turn display on * clean that up * update binary Co-authored-by: Comma Device <device@comma.ai>pull/214/head
							parent
							
								
									cdf812de1e
								
							
						
					
					
						commit
						2fd5ab782b
					
				
				 5 changed files with 3 additions and 117 deletions
			
			
		
									
										Binary file not shown.
									
								
							
						@ -1,69 +0,0 @@ | 
				
			|||||||
CC = clang
 | 
					 | 
				
			||||||
CXX = clang++
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
PHONELIBS = ../../../phonelibs
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
WARN_FLAGS = -Werror=implicit-function-declaration \
 | 
					 | 
				
			||||||
             -Werror=incompatible-pointer-types \
 | 
					 | 
				
			||||||
             -Werror=int-conversion \
 | 
					 | 
				
			||||||
             -Werror=return-type \
 | 
					 | 
				
			||||||
             -Werror=format-extra-args
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
CFLAGS = -std=gnu11 -g -fPIC -O2 $(WARN_FLAGS)
 | 
					 | 
				
			||||||
CXXFLAGS = -std=c++1z -g -fPIC -O2 $(WARN_FLAGS)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ZMQ_FLAGS = -I$(PHONELIBS)/zmq/aarch64/include
 | 
					 | 
				
			||||||
ZMQ_LIBS = -L$(PHONELIBS)/zmq/aarch64/lib \
 | 
					 | 
				
			||||||
           -l:libzmq.a \
 | 
					 | 
				
			||||||
           -lgnustl_shared
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
NANOVG_FLAGS = -I$(PHONELIBS)/nanovg
 | 
					 | 
				
			||||||
JSON_FLAGS = -I$(PHONELIBS)/json/src
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OPENGL_LIBS = -lGLESv3
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
FRAMEBUFFER_LIBS = -lutils -lgui -lEGL
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OBJS = test.o \
 | 
					 | 
				
			||||||
       ../../common/framebuffer.o \
 | 
					 | 
				
			||||||
       ../../common/touch.o
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
DEPS := $(OBJS:.o=.d)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
all: test | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
test: $(OBJS) | 
					 | 
				
			||||||
	@echo "[ LINK ] $@"
 | 
					 | 
				
			||||||
	$(CXX) -fPIC -o '$@' $^ \
 | 
					 | 
				
			||||||
	      $(FRAMEBUFFER_LIBS) \
 | 
					 | 
				
			||||||
	      $(CEREAL_LIBS) \
 | 
					 | 
				
			||||||
	      $(ZMQ_LIBS) \
 | 
					 | 
				
			||||||
        -L/system/vendor/lib64 \
 | 
					 | 
				
			||||||
        -lhardware \
 | 
					 | 
				
			||||||
        $(OPENGL_LIBS) \
 | 
					 | 
				
			||||||
        -lcutils -lm -llog
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%.o: %.cc | 
					 | 
				
			||||||
	@echo "[ CXX ] $@"
 | 
					 | 
				
			||||||
	$(CXX) $(CXXFLAGS) -MMD \
 | 
					 | 
				
			||||||
           -Iinclude -I.. -I../.. \
 | 
					 | 
				
			||||||
           -I$(PHONELIBS)/android_frameworks_native/include \
 | 
					 | 
				
			||||||
           -I$(PHONELIBS)/android_system_core/include \
 | 
					 | 
				
			||||||
           -I$(PHONELIBS)/android_hardware_libhardware/include \
 | 
					 | 
				
			||||||
           -c -o '$@' '$<'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%.o: %.c | 
					 | 
				
			||||||
	@echo "[ CC ] $@"
 | 
					 | 
				
			||||||
	$(CC) $(CFLAGS) -MMD \
 | 
					 | 
				
			||||||
          -I.. -I../.. \
 | 
					 | 
				
			||||||
          $(NANOVG_FLAGS) \
 | 
					 | 
				
			||||||
          $(ZMQ_FLAGS) \
 | 
					 | 
				
			||||||
          $(CEREAL_CFLAGS) \
 | 
					 | 
				
			||||||
          $(JSON_FLAGS) \
 | 
					 | 
				
			||||||
          -c -o '$@' '$<'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.PHONY: clean | 
					 | 
				
			||||||
clean: | 
					 | 
				
			||||||
	rm -f ui $(OBJS) $(DEPS)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-include $(DEPS) | 
					 | 
				
			||||||
@ -1,48 +0,0 @@ | 
				
			|||||||
#include <stdio.h> | 
					 | 
				
			||||||
#include <stdlib.h> | 
					 | 
				
			||||||
#include <stdbool.h> | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <GLES3/gl3.h> | 
					 | 
				
			||||||
#include <EGL/egl.h> | 
					 | 
				
			||||||
#include <EGL/eglext.h> | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "common/framebuffer.h" | 
					 | 
				
			||||||
#include "common/touch.h" | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef struct UIState { | 
					 | 
				
			||||||
  FramebufferState *fb; | 
					 | 
				
			||||||
  int fb_w, fb_h; | 
					 | 
				
			||||||
  EGLDisplay display; | 
					 | 
				
			||||||
  EGLSurface surface; | 
					 | 
				
			||||||
} UIState; | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TouchState touch = {0}; | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void wait_for_touch() { | 
					 | 
				
			||||||
  int touch_x = -1, touch_y = -1; | 
					 | 
				
			||||||
  while (1) { | 
					 | 
				
			||||||
    int touched = touch_poll(&touch, &touch_x, &touch_y, 0); | 
					 | 
				
			||||||
    if (touched == 1) { break; } | 
					 | 
				
			||||||
  } | 
					 | 
				
			||||||
} | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int main() { | 
					 | 
				
			||||||
  UIState uistate; | 
					 | 
				
			||||||
  UIState *s = &uistate; | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  memset(s, 0, sizeof(UIState)); | 
					 | 
				
			||||||
  s->fb = framebuffer_init("ui", 0x00010000, true, | 
					 | 
				
			||||||
                           &s->display, &s->surface, &s->fb_w, &s->fb_h); | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  touch_init(&touch); | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  printf("waiting for touch with screen on\n"); | 
					 | 
				
			||||||
  framebuffer_set_power(s->fb, HWC_POWER_MODE_NORMAL); | 
					 | 
				
			||||||
  wait_for_touch(); | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  printf("waiting for touch with screen off\n"); | 
					 | 
				
			||||||
  framebuffer_set_power(s->fb, HWC_POWER_MODE_OFF); | 
					 | 
				
			||||||
  wait_for_touch(); | 
					 | 
				
			||||||
  printf("done\n"); | 
					 | 
				
			||||||
} | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue