aboutsummaryrefslogtreecommitdiffstats
path: root/sercp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sercp.c')
-rw-r--r--sercp.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sercp.c b/sercp.c
index 07054f4..a044639 100644
--- a/sercp.c
+++ b/sercp.c
@@ -65,7 +65,7 @@
#define FALSE 0
#define true 1
#define TRUE 1
-const char* _version = "v0.3.2";
+const char* _version = "v0.3.3";
// SERIAL
FILE *tapout_fd = NULL;
int is_outfile = 0;
@@ -515,7 +515,7 @@ void sercpSend(void) {
uint8_t num_blocks = 0;
ssize_t odeslano;
uint32_t len_sent;
- uint16_t sent_size;
+ uint16_t send_size;
uint32_t overall_sent;
#ifdef _WIN32
unsigned long ulNumBytes;
@@ -595,14 +595,18 @@ void sercpSend(void) {
while (file_len) {
len = fread(buff, 1, 16384, tap_fd); // read 16kiB from file
p_buff = buff;
- sent_size = 256;
+ if (len > 256) {
+ send_size = 256;
+ } else {
+ send_size = len;
+ }
len_sent = len;
while (len_sent) {
#ifdef _WIN32
WriteFile(serial_fd, (void*)p_buff, sent_size, &ulNumBytes, NULL);
odeslano = (size_t)ulNumBytes;
#else
- odeslano = write (serial_fd, (void*)p_buff, sent_size);
+ odeslano = write (serial_fd, (void*)p_buff, send_size);
if (tcdrain(serial_fd) == -1) {
perror("tcdrain err2: ");
return;
@@ -612,7 +616,7 @@ void sercpSend(void) {
overall_sent += odeslano;
len_sent -= odeslano;
if (len_sent < 256) {
- sent_size = len_sent;
+ send_size = len_sent;
}
DoProgress(overall_sent, st.st_size, PROGRESS_PERCENT);
}
@@ -708,6 +712,7 @@ int OpenUart() {
cfmakeraw(&newtio);
cfsetspeed(&newtio, baud_rate);
#if defined (__APPLE__) || defined (BSD)
+ // pro jabkace | CNEW_RTSCTS
newtio.c_cflag = CS8 | CLOCAL | CREAD | CCTS_OFLOW | CRTS_IFLOW; // CSTOPB - two stop bits NOT
#else
newtio.c_cflag = CS8 | CLOCAL | CREAD | CRTSCTS;