summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Vymetálek <pavel@vym.cz>2018-09-19 13:38:45 +0200
committerPavel Vymetálek <pavel@vym.cz>2018-09-19 13:38:45 +0200
commitdee8c4ce49131e11614436639701244328f4319d (patch)
tree7fa1152fb01b262e60845f8f1ddac49a5cc1f579
parent9e6664c2db35fe654f9c0a0437d4eaeede8c0903 (diff)
downloadtaptoserial-dee8c4ce49131e11614436639701244328f4319d.tar.gz
Zjednodušení nastavení serioveho portu
-rw-r--r--taptoser.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/taptoser.c b/taptoser.c
index 3e21f4d..263e4d5 100644
--- a/taptoser.c
+++ b/taptoser.c
@@ -155,7 +155,7 @@ void decode(unsigned char *header) {
printf("Flag: %4u ", (unsigned int)*header);
n = getword(header+14);
h_len = getword(header+12);
-
+
switch(*(header+1)) {
case '\0':
printf("Type: 0 => program\nProgram length: %6u bytes ", h_len);
@@ -206,7 +206,7 @@ void DoProgress(size_t pos, size_t max, unsigned char csum_ok) {
p = pos;
m = max;
percent = 100 / m * p;
- ipercent = percent / 100 * imax;
+ ipercent = percent / 100 * imax;
if (is_binary) progress_char = '#';
else progress_char = '=';
printf ("Proceed bytes: %6d/%6d [", (int) pos, (int)max);
@@ -342,13 +342,13 @@ void SendTap() {
unsigned int err, no, len;
struct stat st;
unsigned char header[19];
-
+
no = stat(tap_file, &st);
if (no != 0) {
err = errno;
error(1, err, "can't stat input file");
}
-
+
tap_fd = fopen(tap_file, "r");
if (tap_fd == NULL) {
err = errno;
@@ -429,7 +429,7 @@ int main(int argc, char** argv, char** env)
switch (baud_rate){
default:
baud_rate = 57600; // default speed
- newtio.c_cflag = B57600 | CS8 | CLOCAL | CREAD | CSTOPB | CRTSCTS;
+ newtio.c_cflag = B57600 | CS8 | CLOCAL | CREAD | CSTOPB;// | CRTSCTS;
break;
case 57600:
newtio.c_cflag = B57600 | CS8 | CLOCAL | CREAD | CSTOPB | CRTSCTS;
@@ -445,11 +445,11 @@ int main(int argc, char** argv, char** env)
break;
}
printf ("Serial device: %s, communication speed is: %d Bd\n", MODEMDEVICE, baud_rate);
- newtio.c_iflag &= ~(IXON | IXOFF | IXANY); // vypne XON/XOFF
- newtio.c_iflag = IGNPAR | IXOFF;
+// newtio.c_iflag &= ~(IXON | IXOFF | IXANY); // vypne XON/XOFF
+ newtio.c_iflag = 0;IGNPAR | IXOFF;
newtio.c_oflag = 0;
- newtio.c_oflag &= ~OPOST;
- newtio.c_lflag = NOFLSH;
+// newtio.c_oflag &= ~OPOST;
+ newtio.c_lflag = 0; //NOFLSH;
newtio.c_cc[VMIN] = 0;
newtio.c_cc[VTIME] = 10;
tcsetattr(serial_fd, TCSANOW, &newtio);