This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
configuration:telephone-on-serial [2017/10/23 16:14] fachet |
configuration:telephone-on-serial [2017/10/23 16:20] fachet [SDK-Script] |
||
---|---|---|---|
Line 97: | Line 97: | ||
if (ret != 0) { | if (ret != 0) { | ||
nb_syslog("Could not set serial attributes on %s return code %i", DEV, ret); | nb_syslog("Could not set serial attributes on %s return code %i", DEV, ret); | ||
- | exit(3); | + | exit(2); |
} | } | ||
fd = nb_serial_open(DEV); | fd = nb_serial_open(DEV); | ||
if (fd < 0) { | if (fd < 0) { | ||
nb_syslog("Unable to open %s\n", DEV); | nb_syslog("Unable to open %s\n", DEV); | ||
- | exit(4); | + | exit(3); |
} | } | ||
Line 111: | Line 111: | ||
msg = right(msg, strlen(msg) - 6); | msg = right(msg, strlen(msg) - 6); | ||
msg = strcat(msg, "\r\n"); | msg = strcat(msg, "\r\n"); | ||
+ | len = strlen(msg); | ||
- | if (write(fd, msg, strlen(msg) < 0 ); | + | if (write(fd, msg, len) != len) { |
- | nb_syslog("Error on writing to %s\n", DEV); | + | nb_syslog("Error on writing %d bytes to %s", len, DEV); |
close(fd); | close(fd); | ||
- | exit(5); | + | exit(4); |
} | } | ||
+ | } | ||
} | } | ||
/* not reached */ | /* not reached */ |