Re: Custom baud rates: recommended methods?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Peter,
thanks for the quick reply.

> The short answer is there is no portable method to setting non-standard
> baud rates.
Fair enough; I should've better described what I'm looking for. By
"custom" I meant 10400bps, 62.5k, 5bps (very limited hardware
support, but I have fallbacks in place), etc.
Obviously I'd like to see as few #ifdefs as possible, and allow the
largest variety of hardware to be used. I'm not looking for hard guarantees;
I know how diverse UARTs can be.

> That said, cfsetispeed/cfsetospeed is the generic method; you could
> feature test for BXXXXXXXX macros on each platform at build time.
In some cases I do use standard speeds, so I could do that. But 10400 is
very important, and probably no system in existence has B10400
defined...

I dream of an API that works the same on every "modern" kernel ( >=3 ?)
that lets me try to set any speed (expressed as a number, not a macro!) on
any serial port, and then read back the speed actually used. If it's X % off,
perfect. If it's only the nearest standard or even a random number,
no problem - as long as I have a way of knowing.


> > 1- B38400 + ASYNC_SPD_CUST:
> Don't use this method.

Glad to hear that ! thanks.
Can you think of any serial driver or platform that would only support that
method and not #2 (BOTHER) ? I.e., any reason at all to keep the old
implementation?

> > - BOTHER isn't always/ever defined in <termios.h> ?
> > - #include <asm/termios.h> may cause problems,
> >   and looks like a non-portable hack ?
> > - There's a connection with "termios2" vs glibc which I'm unsure of.
> BOTHER is for setting a completely custom rate (ie., not one of the
> defined BXXXXXX rates). You may get varying results doing this
> because there is no guarantee the uart clock can get within a
> reasonable degree of error of the baud rate you want.

As I mentioned that's not necessarily a problem, but I'd like to know
more about the availability of BOTHER with respect to termios / termios2
/ <asm/termios.h>... In particular, the fact that tty_ioctl.c needs
to have "#ifdef BOTHER" , well... "bothers" me.

Thanks!
Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux