Here's some code you can build on:
struct termios ti;
int modem;
modem = open("/dev/ttyS1", O_RDWR, 0);
ioctl(modem, TCGETS, &ti); /* fill the termios struct with the
current settings */
cfsetispeed(&ti, B9600); /* set input speed to 9600, could be B300 -
B230400 */
cfsetospeed(&ti, B9600); /* set output speed */
ioctl(modem, TCSETS, &ti);
close(modem);
You can check out the termios man page for more details.
C.J.LAWSON wrote:
> Hi,
> I am trying to set the baud rate of one of my serial ports I am
> writing and application for and I am really at a loss. I have even tried
> to use the setserial package, however I cannot get it to work (probably
> because I do not understand the documentation). Does anyone have/know of
> any code (native C) which does this, which I can learn from.
>
> Thanking you very much in advance
>
> Jonathan
>
> --
> TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
> [EMAIL PROTECTED] .
> Trouble? e-mail to [EMAIL PROTECTED] .
--
Jens B. Jorgensen
[EMAIL PROTECTED]
--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] .
Trouble? e-mail to [EMAIL PROTECTED] .