This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
hi I wrote a small program to test some serial stuff. I was puzzled because I recall that I was able to set baud rate on a serial port before, but now I cannot. I call tcgetattr() after I open the serial port, but it fails (the tcsetattr() also fails which first got my attention). I enclose a short example, and cygwin details, too. Any ideas? regards, ahnkle
Attachment:
cygcheck.out
Description: Text document
#include <fcntl.h> #include <termios.h> #include <unistd.h> #include <errno.h> #include <stdio.h> #ifndef PORT #define PORT "com1" #endif int main(int argc, char** argv) { int fd; fd = open(PORT, O_RDWR | O_NOCTTY ); if (fd < 0) { perror(PORT); return -1; } else { struct termios oldtio; int rc = tcgetattr(fd,&oldtio); /* save current port settings */ if (rc != 0) { printf("ERROR: tcgetattr returned %i (errno=%i)\n", rc, errno); return -1; } close(fd); } return 0; } // Local variables: // compile-command: "gcc -g -Wall test1.cpp -o test1" // End:
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |