More attempts to stop termios
This commit is contained in:
parent
bb1a94f020
commit
2c9da64f19
|
@ -39,7 +39,10 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
int serial_fd = serial_init(serial_port, speed);
|
int serial_fd = serial_init(serial_port, speed);
|
||||||
serial_flush(serial_fd);
|
serial_flush(serial_fd);
|
||||||
|
if (!strcmp(speed, "0")) {
|
||||||
|
printf("Serial initialized, press any key to continue.\n");
|
||||||
|
getc(stdin);
|
||||||
|
}
|
||||||
uint8_t rem = (uint8_t)(argc - optind);
|
uint8_t rem = (uint8_t)(argc - optind);
|
||||||
if (rem) {
|
if (rem) {
|
||||||
if (strcmp(argv[optind], "image") == 0) {
|
if (strcmp(argv[optind], "image") == 0) {
|
||||||
|
|
|
@ -25,8 +25,6 @@ speed_from_string(char const *s)
|
||||||
return DEFAULT_SPEED;
|
return DEFAULT_SPEED;
|
||||||
}
|
}
|
||||||
switch (speed) {
|
switch (speed) {
|
||||||
case 0:
|
|
||||||
return B0;
|
|
||||||
case 9600:
|
case 9600:
|
||||||
return B9600;
|
return B9600;
|
||||||
case 115200:
|
case 115200:
|
||||||
|
@ -57,13 +55,8 @@ serial_init(char const *serial_port, char const *speed)
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
exit(ERR_SERIAL_PORT);
|
exit(ERR_SERIAL_PORT);
|
||||||
}
|
}
|
||||||
if (!strcmp(speed, "0")) {
|
|
||||||
// Skip setup on special baud to allow manual register twidling
|
|
||||||
return serial_fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct termios t_options;
|
struct termios t_options;
|
||||||
|
|
||||||
if (tcgetattr(serial_fd, &t_options) < 0) {
|
if (tcgetattr(serial_fd, &t_options) < 0) {
|
||||||
fprintf(stderr, "Failed to get termios attrs.\n");
|
fprintf(stderr, "Failed to get termios attrs.\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue