From 89837326d864a66999104bc2d40144091ce0c19d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20M=C3=BCller?= Date: Sat, 22 Sep 2018 09:32:01 +0200 Subject: [PATCH] Make framer_open_p300 more robust (#37) * fixed ">FRAMER: addr was still active FE06" error log * fixed some formattings (again ...) * send EOT for all attempts in framer_open_p300() --- src/framer.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/framer.c b/src/framer.c index 0b35a369..ebe4a6e6 100644 --- a/src/framer.c +++ b/src/framer.c @@ -170,7 +170,7 @@ static int framer_preset_result(char *r_buf, int r_len, unsigned long *petime) return FRAMER_ERROR; } -// Synchronization for P300 + switch to P300, back to normal for close -> repeating 05 +// Synchronization for P300 + switch to P300, back to normal for close -> repeating P300X_ATTEMPTS static int framer_close_p300(int fd) { char string[100]; @@ -227,13 +227,13 @@ static int framer_open_p300(int fd) unsigned long etime; int rlen; - if (! framer_close_p300(fd)) { - snprintf(string, sizeof(string), ">FRAMER: could not set start condition"); - logIT(LOG_ERR, string); - return FRAMER_ERROR; - } - for (i = 0; i < P300X_ATTEMPTS; i++) { + if (! framer_close_p300(fd)) { + snprintf(string, sizeof(string), ">FRAMER: could not set start condition"); + logIT(LOG_ERR, string); + return FRAMER_ERROR; + } + if (! my_send(fd, enable, sizeof(enable))) { framer_set_result(P300_ERROR); snprintf(string, sizeof(string), ">FRAMER: enable not send");