Files
OpenCellular/extra/input.c
Bill Richardson c46f569a39 Add standalone lightbar simulation tool
This adds an "extra/" directory to hold various experiments and optional
programs. With this change, we add a tool that can simulate the lightbar
behavior on the build machine. That can be used to experment with variations
in the lightbar pattern code without needing to reflash a Pixel with a new
EC to see the effect.

There is no functional change to the EC code, just a couple of #ifdefs to
allow common/lightbar.c to be compiled separately from the EC.

BUG=none
BRANCH=ToT
TEST=make buildall -j

  cd extra
  make
  ./lightbar

You may need to install the libxcb1-dev package on your build machine.

Change-Id: I847ce7ea97cae792b1de1b91f488819e873b6555
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199883
2014-05-15 05:20:14 +00:00

47 lines
875 B
C

/*
* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "simulation.h"
void *entry_input(void *ptr)
{
char *got, buf[80];
char *str, *word, *saveptr;
int argc;
char *argv[40];
int ret;
do {
printf("lightbar%% ");
got = fgets(buf, sizeof(buf), stdin);
if (got) {
argc = 0;
argv[argc++] = "lightbar";
word = str = buf;
while (word && argc < ARRAY_SIZE(argv)) {
word = strtok_r(str, " \t\r\n", &saveptr);
if (word)
argv[argc++] = word;
str = 0;
}
argv[argc] = 0;
ret = fake_consolecmd_lightbar(argc, argv);
if (ret)
printf("ERROR %d\n", ret);
}
} while (got);
exit(0);
return 0;
}