Last active
March 14, 2023 02:58
-
-
Save begriffs/1cde9a47538627d25a80d66b139cd8d9 to your computer and use it in GitHub Desktop.
Revisions
-
begriffs revised this gist
Mar 14, 2023 . 1 changed file with 17 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,4 @@ #include <stdio.h> #include <sys/ioctl.h> #include <fcntl.h> #include <stdlib.h> @@ -11,32 +8,30 @@ int main(int argc, char *argv[]) { int fd; int RTS_flag; int error = 0; fd = open(argv[1],O_RDWR | O_NOCTTY ); if (fd == -1 ) { error = errno; printf("Error opening device - %s : %s\n", argv[1], strerror(error)); exit(error); } RTS_flag = TIOCM_RTS; if ( ioctl(fd,TIOCMBIS,&RTS_flag) == -1 ) { error = errno; printf("Error TIOCMBIS RTS device - %s : %s\n", argv[1], strerror(error)); exit(error); } printf("Press any key to disable PTT..."); getchar(); if ( ioctl(fd,TIOCMBIC,&RTS_flag) == -1 ) { error = errno; printf("Error TIOCMBIC RTS device - %s : %s\n", argv[1], strerror(error)); exit(error); } close(fd); return 0; } -
begriffs created this gist
Mar 14, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ #include <sys/ioctl.h> #include <stdio.h> #include <sys/types.h> #include <termios.h> #include <sys/ioctl.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <errno.h> int main(int argc, char *argv[]) { int fd; int RTS_flag; int error = 0; fd = open(argv[1],O_RDWR | O_NOCTTY ); if (fd == -1 ) { error = errno; printf("Error opening device - %s : %s\n", argv[1], strerror(error)); exit(error); } RTS_flag = TIOCM_RTS; ioctl(fd,TIOCMBIS,&RTS_flag); if (fd == -1 ) { error = errno; printf("Error TIOCMBIS RTS device - %s : %s\n", argv[1], strerror(error)); exit(error); } printf("Press any key to disable PTT..."); getchar(); ioctl(fd,TIOCMBIC,&RTS_flag); if (fd == -1 ) { error = errno; printf("Error TIOCMBIC RTS device - %s : %s\n", argv[1], strerror(error)); exit(error); } close(fd); return 0; }