Bug 112821

Summary: Cannot change the number of bits (CS5/CS6/CS7) or parity (PARENB) in a PTY
Product: Drivers Reporter: Paulo Costa (me)
Component: SerialAssignee: Russell King (rmk)
Status: NEW ---    
Severity: low    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.1.13 Subsystem:
Regression: No Bisected commit-id:

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.