Bug 112821 - Cannot change the number of bits (CS5/CS6/CS7) or parity (PARENB) in a PTY
Summary: Cannot change the number of bits (CS5/CS6/CS7) or parity (PARENB) in a PTY
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Serial (show other bugs)
Hardware: All Linux
: P1 low
Assignee: Russell King
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-21 22:55 UTC by Paulo Costa
Modified: 2016-02-21 22:55 UTC (History)
0 users

See Also:
Kernel Version: 4.1.13
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Paulo Costa 2016-02-21 22:55:01 UTC
Short version:

PTYs are stuck on 8 data bits and no parity. 

Is that a bug or a feature? Why?

https://github.com/torvalds/linux/blob/1f55c718c290616889c04946864a13ef30f64929/drivers/tty/pty.c#L290-L291


Long version:

I'm working on an IO expansion board. Among other things, it exposes a bunch of serial ports, which I want to expose as TTY devices on my host.

I'm probably going to write a kernel module for it later, but for now I'm using a PTY as bridge between the kernel and my "driver" program.

Whenever there is a change to the PTY's `struct termios` (baud, parity, number of bits, etc) I make the corresponding changes on my expansion board.

This works fine for most of the parameters, but not the number of data bits or parity.

After some digging, I found that changes to these configurations are explicitly ignored on the PTY driver and it is stuck on 8 data bits, no parity.

I wonder if we really want PTYs to do this (why?), and why it doesn't affect other options, like speed and number of stop bits.

Note You need to log in before you can comment on or make changes to this bug.