Re: [Ftdi-usb-sio-devel] Communication problems between Ubuntu Linux and Suunto D6 over FTDI usbser
Brought to you by:
bryder
From: Michael P. <mic...@gm...> - 2010-04-28 15:35:55
|
Matti Dahlbom wrote: >> // configure the new port settings for 9600baud, 8N1, raw output >> termios options = termios(); >> options.c_cflag = B9600 | CS8 | CLOCAL | CREAD; >> options.c_iflag = 0; >> options.c_oflag = 0; >> options.c_lflag = 0; >> >> // 1 second port read timeout >> options.c_cc[VMIN] = 0; >> options.c_cc[VTIME] = 10; >> >> // register the new port settings >> tcflush(m_fd, TCIFLUSH); >> if ( tcsetattr(m_fd, TCSANOW, &options) == -1 ) Just a guess, since I don't generally use my ftdi chips this way (but have used real serial ports this way), but termios has other members. I'm not entirely sure what the termios() function does (constructor of some sort?), but you might try a memset(&options, 0, sizeof(options)); before you start fiddling with them, or, better yet, a tcgetattr() first. I have no idea if tcflush() can fail, but you might also printf its return value. Michael |