diff options
Diffstat (limited to 'extra')
-rw-r--r-- | extra/main.c | 18 | ||||
-rw-r--r-- | extra/simulation.h | 7 | ||||
-rw-r--r-- | extra/windows.c | 19 |
3 files changed, 34 insertions, 10 deletions
diff --git a/extra/main.c b/extra/main.c index 6433f49557..38234e743c 100644 --- a/extra/main.c +++ b/extra/main.c @@ -164,7 +164,8 @@ uint8_t *system_get_jump_tag(uint16_t tag, int *version, int *size) } /* Copied from util/ectool.c */ -int lb_read_params_from_file(const char *filename, struct lightbar_params *p) +int lb_read_params_from_file(const char *filename, + struct lightbar_params_v1 *p) { FILE *fp; char buf[80]; @@ -207,7 +208,18 @@ int lb_read_params_from_file(const char *filename, struct lightbar_params *p) READ(1); p->s3_sleep_for = val[0]; READ(1); p->s3_ramp_up = val[0]; READ(1); p->s3_ramp_down = val[0]; - READ(1); p->new_s0 = val[0]; + READ(1); p->tap_tick_delay = val[0]; + READ(1); p->tap_display_time = val[0]; + + READ(1); p->tap_pct_red = val[0]; + READ(1); p->tap_pct_green = val[0]; + READ(1); p->tap_seg_min_on = val[0]; + READ(1); p->tap_seg_max_on = val[0]; + READ(1); p->tap_seg_osc = val[0]; + READ(3); + p->tap_idx[0] = val[0]; + p->tap_idx[1] = val[1]; + p->tap_idx[2] = val[2]; READ(2); p->osc_min[0] = val[0]; @@ -267,6 +279,8 @@ int lb_read_params_from_file(const char *filename, struct lightbar_params *p) p->color[i].b = val[2]; } +#undef READ + /* Yay */ r = 0; done: diff --git a/extra/simulation.h b/extra/simulation.h index a746ca8549..569107023b 100644 --- a/extra/simulation.h +++ b/extra/simulation.h @@ -21,7 +21,8 @@ void *entry_windows(void *); void *entry_input(void *); void *entry_lightbar(void *); void init_windows(void); -int lb_read_params_from_file(const char *filename, struct lightbar_params *p); +int lb_read_params_from_file(const char *filename, + struct lightbar_params_v1 *p); /* Interfaces to the EC code that we're encapsulating */ void lightbar_task(void); int fake_consolecmd_lightbar(int argc, char *argv[]); @@ -32,6 +33,10 @@ int fake_consolecmd_lightbar(int argc, char *argv[]); #ifndef CONFIG_CONSOLE_CMDHELP #define CONFIG_CONSOLE_CMDHELP #endif +#ifndef CONFIG_LIGHTBAR_POWER_RAILS +#define CONFIG_LIGHTBAR_POWER_RAILS +#endif + /* Stuff that's too interleaved with the rest of the EC to just include */ diff --git a/extra/windows.c b/extra/windows.c index fd09af53f5..20b3a5780c 100644 --- a/extra/windows.c +++ b/extra/windows.c @@ -27,7 +27,7 @@ static xcb_drawable_t win; static xcb_gcontext_t foreground; static xcb_colormap_t colormap_id; -static int lb_power; +static int fake_power; void init_windows(void) { @@ -124,7 +124,7 @@ void update_window(void) int i; uint16_t copyleds[NUM_LEDS][3]; - if (lb_power) { + if (fake_power) { pthread_mutex_lock(&leds_mutex); memcpy(copyleds, leds, sizeof(leds)); pthread_mutex_unlock(&leds_mutex); @@ -220,27 +220,32 @@ int lb_get_rgb(unsigned int led, uint8_t *red, uint8_t *green, uint8_t *blue) void lb_init(void) { - if (lb_power) + if (fake_power) lb_set_rgb(NUM_LEDS, 0, 0, 0); }; void lb_off(void) { - lb_power = 0; + fake_power = 0; update_window(); }; void lb_on(void) { - lb_power = 1; + fake_power = 1; update_window(); }; void lb_start_builtin_cycle(void) { }; void lb_hc_cmd_dump(struct ec_response_lightbar *out) { - printf("lightbar is %s\n", lb_power ? "on" : "off"); - memset(out, lb_power, sizeof(*out)); + printf("lightbar is %s\n", fake_power ? "on" : "off"); + memset(out, fake_power, sizeof(*out)); }; void lb_hc_cmd_reg(const struct ec_params_lightbar *in) { }; +int lb_power(int enabled) +{ + return fake_power; +} + /*****************************************************************************/ /* Event handling stuff */ |