Commit 824e2f22 authored by Mikhail Karpenko's avatar Mikhail Karpenko

Switch to a reading state

parent af2b156c
...@@ -1315,9 +1315,11 @@ int parse_cmd(camogm_state *state, FILE* npipe) ...@@ -1315,9 +1315,11 @@ int parse_cmd(camogm_state *state, FILE* npipe)
} }
return 28; return 28;
} else if (strcmp(cmd, "rawdev_read") == 0) { } else if (strcmp(cmd, "rawdev_read") == 0) {
if (state->rawdev_op) if (state->rawdev_op && state->prog_state == STATE_STOPPED) {
// camogm_read(state); state->prog_state = STATE_READING;
build_index(state); } else {
D0(fprintf(debug_file, "Unable to switch state to 'reading' from current state. Check settings.\n"));
}
return 29; return 29;
} }
...@@ -1468,6 +1470,9 @@ int listener_loop(camogm_state *state) ...@@ -1468,6 +1470,9 @@ int listener_loop(camogm_state *state)
} // switch camogm_start() } // switch camogm_start()
if ((rslt != 0) && (rslt != CAMOGM_TOO_EARLY) && (rslt != CAMOGM_FRAME_NOT_READY) && (rslt != CAMOGM_FRAME_CHANGED) ) state->last_error_code = rslt; if ((rslt != 0) && (rslt != CAMOGM_TOO_EARLY) && (rslt != CAMOGM_FRAME_NOT_READY) && (rslt != CAMOGM_FRAME_CHANGED) ) state->last_error_code = rslt;
} else if (state->prog_state == STATE_READING) {
build_index(state);
state->prog_state = STATE_STOPPED;
} else { // not running, not starting } else { // not running, not starting
usleep(COMMAND_LOOP_DELAY); // make it longer but interruptible by signals? usleep(COMMAND_LOOP_DELAY); // make it longer but interruptible by signals?
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment