Benches iOS and iPadOS

3

termios.h and 921600 baud rate support

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Hi,

I've been porting my application from Linux to Mac OS X when I got stuck with serial port support, the lack of 921600 baud rate in particular. There are no definitions of speeds higher than 230400 in the termios.h file. Defining it manually using the constants from Linux doesn't help either.. as it's simply not implemented. Is there any way I can get this?

Thanks in advance,

Piotr

3 replies

Sign in or join Beachball Help to reply.

  1. 0

    Brett Hunsaker

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Starting with Tiger, the IOSSIOSPEED ioctl can be used to set arbitrary baud rates other than those specified by POSIX. The driver for the underlying serial hardware ultimately determines which baud rates can be used. This ioctl sets both the input and output speed. The speed will not be reflected in the termios structure.

    <pre>

    speed_t speed = 14400; // Set 14400 baud

    if ( ioctl( fileDescriptor, IOSSIOSPEED, &speed ) == -1 )

    {

    printf( "Error %d calling ioctl( ..., IOSSIOSPEED, ... )n", errno );

    }

    </pre>

  2. 0

    piopawlu

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thank you very much ! 🙂

  3. 0

    men_with_ties

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    greetings;

    i am trying to understand the underlying structure of these calls. is it possible to explain to me why the IOSSIOSPEED call in IOSS.H refers to an "_IOW" as opposed to an "_IOWR" which would seem more logical?

    my calls to IOSSIOSPEED are not having the expected results -- the calls are ostensibly successful but the baudrate is not updated.

    thank you in advance for clarifying this for me!