Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/cfsetispeed.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/cfsetispeed.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/cfsetispeed.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/cfsetispeed.html on line 8
Set the input baud rate in a termios structure
#include <termios.h>
int cfsetispeed( struct termios* termios_p,
speed_t speed );
- termios_p
- A pointer to a
termios
structure that describes the terminal's control attributes.
- speed
- The new speed.
Valid values for speed are defined in <termios.h>.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The cfsetispeed() function sets the input baud rate within
the termios structure pointed to by termios_p to be
speed.
You can get a valid termios control structure for an opened
device by calling
tcgetattr().
|
- The new baud rate isn't effective until you call
tcsetattr()
with this modified termios structure.
- Attempts to set baud rates to values that aren't supported by the hardware
are ignored, and cause tcsetattr() to return an error,
but cfsetispeed() doesn't indicate an error.
- Attempts to set input baud rates to a value that's different
from the output baud rate, when the hardware doesn't support
split baud rates, cause the input baud rate to be ignored, but
no error is generated.
|
- 0
- Success.
- -1
- An error occurred (errno is set).
- EINVAL
- One of the arguments is invalid.
- ENOTTY
- This function isn't supported by the system.
#include <termios.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
int main( void )
{
int fd;
struct termios termios_p;
speed_t speed;
fd = open( "/dev/ser1", O_RDWR );
tcgetattr( fd, &termios_p);
/*
* Set input baud rate
*/
speed = 9600;
cfsetispeed( &termios_p, speed );
tcsetattr( fd, TCSADRAIN, &termios_p);
close( fd );
return EXIT_SUCCESS;
}
POSIX 1003.1
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
errno,
cfgetispeed(),
cfgetospeed(),
cfsetospeed(),
tcgetattr(),
tcsetattr(),
termios
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/cfsetispeed.html on line 209
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/cfsetispeed.html on line 209