cfsetispeed - Linux


Overview

cfsetispeed is a command-line utility used to set the input baud rate for a serial port represented by file descriptor fd. It is primarily used in communication with serial devices such as modems or embedded systems.

Syntax

cfsetispeed fd speed

Options/Flags

  • speed: The desired input baud rate, specified as an integer value.

Examples

Set the input baud rate to 9600 for a serial port represented by file descriptor 3:

cfsetispeed 3 9600

Set the input baud rate to 115200:

cfsetispeed 0 115200

Common Issues

  • Incorrect file descriptor: Ensure the file descriptor fd points to a valid serial port device.
  • Invalid baud rate: Verify that the baud rate is within the supported range for the serial port.

Integration

Get the current input baud rate:

stty -F /dev/ttyS0 -icanon min 1 time 1 -echo

Set the output baud rate and establish communication with a modem:

cfsetospeed 0 115200
setserial /dev/ttyS0 port 0

Related Commands

  • cfsetospeed: Sets the output baud rate for a serial port.
  • stty: Configures serial port settings.
  • setserial: Controls various serial port options.