raspberrypi / tools

1.89k stars 865 forks source link

Bit definition wrong on bits/termios.h #88

Closed dega03 closed 6 years ago

dega03 commented 6 years ago

I believe the bit definition in termios.h should be in hex format, at the moment they aren't.

I tried a short program:

#include <termios.h>
#include <stdio.h>

int main()
{
    printf("CSTOPB=%X CLOCAL=%X, PARENB=%X PARODD=%X, CRTSCTS=%X\n", CSTOPB, CLOCAL, PARENB, PARODD, CRTSCTS );
    return 0;
}

and I am getting

CSTOPB=40 CLOCAL=800, PARENB=100 PARODD=200, CRTSCTS=80000000

however in the definition there is:

#define CSTOPB      0000100
#define CLOCAL 0004000
#define PARENB 0000400
#define PARODD  0001000
#define CRTSCTS 020000000000
pelwell commented 6 years ago

That's octal - a bit weird, but not that unusual. Are you saying the values are wrong? (Hint: they aren't)

dega03 commented 6 years ago

I was really struggling with this, thanks!