summaryrefslogtreecommitdiffstats
path: root/src/qmode.c
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2013-01-14 19:30:10 +0100
committerPali Rohár <pali.rohar@gmail.com>2013-01-14 19:30:10 +0100
commita6ec475a92ebfb9ab42685cb63b42a39656705ab (patch)
treee18051a5a7514511a72a52cb6dc57965c1b21d28 /src/qmode.c
parent783222ed007f93d16bfb224df3d10ddb47bf4a74 (diff)
parenta6ef73359c0e0537ebf83795ebacbbfaee2c9c28 (diff)
download0xFFFF-legacy.tar.bz2
Merge branch 'pvc' into legacylegacy
Diffstat (limited to 'src/qmode.c')
-rw-r--r--src/qmode.c49
1 files changed, 22 insertions, 27 deletions
diff --git a/src/qmode.c b/src/qmode.c
index 64ee94a..e23e457 100644
--- a/src/qmode.c
+++ b/src/qmode.c
@@ -43,38 +43,33 @@ void process_message(char *msg)
{
char *str;
char *arg;
- int c=1;
if (msg == NULL)
return;
printf("[x] (%s)\n", msg);
str = strdup(msg);
arg = strchr(str, ':');
- if (c!=0) {
- arg[0]='\0';
- arg = arg +1;
- if (!strcmp(str, "flash")) {
- const char *type = fpid_file(arg);
- if (type == NULL) {
- squeue_push2(p, "error", "Unknown piece format", 1);
- } else flash_image(arg, type, NULL, NULL, NULL);
- } else
- if (!strcmp(str, "reset")) {
- if (reboot_board() == 0) {
- squeue_push2(p,"info", "Device reboots", 1);
- } else squeue_push2(p,"error", "Cannot reboot device", 1);
- } else
- if (!strcmp(str, "info")) {
- get_rd_flags();
- squeue_push2(p, "info", strbuf, 1);
- get_nolo_version();
- squeue_push2(p, "info", strbuf, 1);
- get_usb_mode();
- squeue_push2(p, "info", strbuf, 1);
- } else
- squeue_push2(p, "error", "invalid command", 0);
- } else {
- squeue_push2(p, "error", "invalid command format", 0);
- }
+ arg[0]='\0';
+ arg = arg +1;
+ if (!strcmp(str, "flash")) {
+ const char *type = fpid_file(arg);
+ if (type == NULL) {
+ squeue_push2(p, "error", "Unknown piece format", 1);
+ } else flash_image(arg, type, NULL, NULL, NULL);
+ } else
+ if (!strcmp(str, "reset")) {
+ if (reboot_board() == 0) {
+ squeue_push2(p,"info", "Device reboots", 1);
+ } else squeue_push2(p,"error", "Cannot reboot device", 1);
+ } else
+ if (!strcmp(str, "info")) {
+ get_rd_flags();
+ squeue_push2(p, "info", strbuf, 1);
+ get_nolo_version();
+ squeue_push2(p, "info", strbuf, 1);
+ get_usb_mode();
+ squeue_push2(p, "info", strbuf, 1);
+ } else
+ squeue_push2(p, "error", "invalid command", 0);
free(str);
}