Is there any way to check which baud rates are supported for a serial device on Linux?
I've poked around the
/sys/class/tty/ttyS0 directory, but I can't see anything in there that lists this type of information.
You seem to be asking two different questions.
The answer would depend on (1) the capabilities of the hardware, i.e. the UART/USART/SCC, and the range of divisors that the device driver can use in the baud rate generator; consult the device data sheet; (2) the frequency of the clock/oscillator connected to the serial port device; consult the board documentation.
The one of the defined baud rates in
Serial port drivers typically do not have any means of reporting/advertising which of these baud rates are actually supported/configurable/implemented. There is a capabilities value for attributes like FIFO and sleeping but not for baud rates. A driver could define an ioctl() call to configure (nonstandard) baud rates, although that would make programs using it non-portable.
You can check the device baud rate using the "stty" command on the console:
You can also change the baud rate with the following command: