arjun kumar
arjun kumar

Reputation: 193

C Linux ioctl TCGETS and TCSETS errno 25

For an assignment, I am required to use ioctl, TCGETS and TCSETS. I cannot use tcgetattr and tcsetattr.

Here's my code so far:

    struct termios term;
    int openLocation
    int ioResult
    openLocation = open("../../dev/fb0",O_RDWR);
    ioResult = ioctl(openLocation,TCGETS,&term);

This gets me errno 25. I'm not really sure what the issue is. I ultimately need to disable canonical mode by unsetting the ICANON bit and disabling ECHO, and, again, I need to use ioctl. Thanks for your help guys

Upvotes: 1

Views: 5786

Answers (2)

user149341
user149341

Reputation:

/dev/fb0 is a framebuffer device, not a terminal. You can't use TCGETS on it.

Do you perhaps mean /dev/tty0?

Upvotes: 4

Rich
Rich

Reputation: 650

The addition of a perror or strerror would probably help you see that (as @kch mentioned) that your open call failed and the ioctl was being called on an invalid file (ENOTTY).

Upvotes: 1

Related Questions