Commit d72360d8 authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Last few fixes for new console and controller

parent 4311b6a7
......@@ -75,8 +75,12 @@ rel_trace: rel_utils
$(MAKE) -C $(REL_BUILD_DIR)/common/trace >/dev/null; \
echo " Done"
rel_log:
@echo "****** Building common/log"; \
$(MAKE) -C $(REL_BUILD_DIR)/common/log >/dev/null; \
echo " Done"
rel_ctrl: rel_trace
rel_ctrl: rel_trace rel_log
@echo "****** Building controller"; \
$(MAKE) -C $(REL_BUILD_DIR)/controller >/dev/null; \
echo " Done"
......@@ -88,7 +92,7 @@ rel_libnova: rel_clone_dir
echo " Done"
rel_cons: rel_trace rel_libnova
rel_cons: rel_trace rel_libnova rel_log
@echo "****** Building console"; \
$(MAKE) -C $(REL_BUILD_DIR)/console >/dev/null; \
echo " Done"
......
......@@ -100,14 +100,16 @@ int main (int argc, char **argv)
int fdnew;
fd_set fd_rd;
struct timeval timeout;
int high;
int high = 0;
timeout.tv_usec = 0;
timeout.tv_sec = 1;
FD_ZERO(&fd_rd);
FD_SET(fd_log, &fd_rd);
high = fd_log;
if (fd_log >= 0) {
FD_SET(fd_log, &fd_rd);
high = fd_log;
}
FD_SET(fd_listen, &fd_rd);
high = MAX(high, fd_listen);
command_server_fdset_add(cmd_srv, &fd_rd, &high);
......
......@@ -103,7 +103,7 @@ struct trace *trace_open (char *name)
fd = tcp_connect(tr_host, tr_port);
if (fd < 0) {
printf("Error connecting\n");
printf("Error connecting to %s:%d\n", tr_host, tr_port);
return NULL;
}
......
......@@ -793,13 +793,11 @@ void ec_datagram_sample(void)
static int init_done = 0;
static bool init_success = false;
static bool init_done = false;
bool ec_initialized(void)
{
return init_success;
return init_done;
}
int ec_init(char *ifname, bool single_cycle)
......@@ -834,9 +832,9 @@ int ec_init(char *ifname, bool single_cycle)
eth_timeout_set(ec_sock, &timeout, &timeout);
if (ec_slave_count() >= 0) {
init_success = true;
log_send(LOG_T_DEBUG, "Found ethercat slaves");
} else {
goto err_init;
log_send(LOG_T_WARNING, "No ethercat slaves found");
}
log_send(LOG_T_DEBUG,
"Successfull init, %d slaves found.", ec_slave_count());
......@@ -845,13 +843,10 @@ int ec_init(char *ifname, bool single_cycle)
controller_sample_start_hook(ec_datagram_sample_init, NULL);
init_done = 1;
init_done = true;
return 0;
err_init:
close(ec_sock);
ec_sock = -1;
err_nosocket:
log_send(LOG_T_ERROR, "Failed to initialize Ethercat subsystem");
return -1;
......
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