• Alan Cox's avatar
    [PATCH] tty: improve encode_baud_rate logic · 78137e3b
    Alan Cox authored
    Mostly so people can see the work in progress.  This enhances the encode
    function which isn't currently used in the base tree but is when using some of
    the testing tty patches.
    
    This resolves a problem with some hardware where applications got confusing
    information from the tty ioctls.  Correct but confusing.
    
    In some situations asking for, say, 9600 baud actually gets you 9595 baud or
    similar near-miss values.  With the old code this meant that a request for
    B9600 got a return of BOTHER, 9595 which programs interpreted as a failure.
    
    The new code now works on the following basis
    
    - If you ask for specific rate via BOTHER, you get a precise return
    
    - If you ask for a standard Bfoo rate and the result is close you get a Bfoo
      return
    
    - If you ask for a standard Bfoo rate and get something way off you get a
      BOTHER/rate return
    
    This seems to fix up the cases I've found where this broke compatibility.
    Signed-off-by: default avatarAlan Cox <alan@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    78137e3b
tty_ioctl.c 22 KB