Serial custom speed deprecated?
Quoted 3 lines
Or we could just add a standardised extra set of speed ioctls, but then we need to decide what occurs if I set the speed and then issue a termios call - does it override or not.
Actually, we're not QUITE out of bits. CBAUDEX | B0 is not taken. That would make a reasonable encoding for a custom speed. (But I haven't checked glibc... ah, yes, it should work! See glibc-2.4/sysdeps/unix/sysv/linux/speed.c; browse at
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/?cvsroot=glibc
if you don't have a local copy source handy.)
What I'd do is, when converting to the old-style for tcgetattr, if the current baud rate is not representable, cache it somewhere and return that (or some other magic value). If a tcsetatt call comes in that specifies that magic value, use the cached baud rate.
If you make the cache just the current baud rate setting (the magic value on set means "don't alter"), that will handle a lot of programs that just want to play with handshaking.
If you make the cache separate, you can also survive an old-interface-using program switching to a different baud rate and then switching back.
Also note that if you truly want to support all baud rates in historical use, you'll need to include at least one fractional bit for 134.5 baud. (Unless you're sure that IBM 2741 terminals are truly dead. :-))
Alternatively, you could observe that asynchronous communications only requires agreement withing 5% between sender and receiver, so specifying a baud rate to much better than 1% is not too important.
Half-precision floating point would be ideal for the job. :-)
Quoted 4 lines · [email protected] wrote:
Quoted 3 lines
Or we could just add a standardised extra set of speed ioctls, but then we need to decide what occurs if I set the speed and then issue a termios call - does it override or not.
<snip>
Quoted 3 lines
Alternatively, you could observe that asynchronous communications only requires agreement withing 5% between sender and receiver, so specifying a baud rate to much better than 1% is not too important.
To nitpick.
For a 10 bit long word, if the receiver syncs to within 1/8th of the middle of a bit-time at the start, you've got 2/8th of a bit-time of disagreement possible, before you are likely to get errors, especially on limited slew-rate signals. (more modern chips will likely sample faster) Or 3/80, or 2.5%. If the other side has made a similar calculation, then you should only really rely on 1%.
5% is the best possible case - that will in most circumstances cause errors.
Quoted 8 lines
To nitpick.
For a 10 bit long word, if the receiver syncs to within 1/8th of the middle of a bit-time at the start, you've got 2/8th of a bit-time of disagreement possible, before you are likely to get errors, especially on limited slew-rate signals. (more modern chips will likely sample faster) Or 3/80, or 2.5%. If the other side has made a similar calculation, then you should only really rely on 1%.
5% is the best possible case - that will in most circumstances cause errors.
You're quite right; 5% assumes perfect signal edges, which you don't get in practice, especially at high baud rates. Also, you have frational stop bit tricks from some modems.
Still, as I suggested, half-precision floating point (1 sign, 5 exponent, 10 mantissa) as used for HDR graphics has a relative error range of 1/1024 (0.098%) to 1/2047 (0.049%), and would be an excellent match.
It's not a terribly serious suggestion, as I don't think 134.5 baud is a serious issue these days, but it does make clear that there's no difference between 115,200 baud and 115,299 baud.
Quoted 5 lines · On Sat, 26 Aug 2006 [email protected] wrote:
Quoted 3 lines
Or we could just add a standardised extra set of speed ioctls, but then we need to decide what occurs if I set the speed and then issue a termios call - does it override or not.
Actually, we're not QUITE out of bits. CBAUDEX | B0 is not taken.
B0 is not a bit (there are no bits in 0). It won't work.
Quoted 28 lines
That would make a reasonable encoding for a custom speed. (But I haven't checked glibc... ah, yes, it should work! See
glibc-2.4/sysdeps/unix/sysv/linux/speed.c; browse at
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/?cvsroot=glibc
if you don't have a local copy source handy.)What I'd do is, when converting to the old-style for tcgetattr, if the current baud rate is not representable, cache it somewhere and return that (or some other magic value). If a tcsetatt call comes in that specifies that magic value, use the cached baud rate.
If you make the cache just the current baud rate setting (the magic value on set means "don't alter"), that will handle a lot of programs that just want to play with handshaking.
If you make the cache separate, you can also survive an old-interface-using program switching to a different baud rate and then switching back.
Also note that if you truly want to support all baud rates in historical use, you'll need to include at least one fractional bit for 134.5 baud. (Unless you're sure that IBM 2741 terminals are truly dead. :-))
Alternatively, you could observe that asynchronous communications only requires agreement withing 5% between sender and receiver, so specifying a baud rate to much better than 1% is not too important.
Quoted 7 lines
Half-precision floating point would be ideal for the job. :-) -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.62 BogoMips). New book: http://www.AbominableFirebug.com/
_
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
Ar Llu, 2006-08-28 am 08:17 -0400, ysgrifennodd linux-os (Dick Johnson):
Quoted 9 lines · On Sat, 26 Aug 2006 [email protected] wrote:
Quoted 6 lines
Quoted 4 lines
Or we could just add a standardised extra set of speed ioctls, but then we need to decide what occurs if I set the speed and then issue a termios call - does it override or not.
Actually, we're not QUITE out of bits. CBAUDEX | B0 is not taken.
B0 is not a bit (there are no bits in 0). It won't work.
Well that is how it is implemented and everyone else seems happy. If it violates your personal laws of physics you'll just have to cope.
Quoted 7 lines · Alan Cox
Ar Llu, 2006-08-28 am 08:17 -0400, ysgrifennodd linux-os (Dick Johnson):
Quoted 6 lines · On Sat, 26 Aug 2006 [email protected] wrote:
Quoted 5 lines
Quoted 4 lines
Or we could just add a standardised extra set of speed ioctls, but then we need to decide what occurs if I set the speed and then issue a termios call - does it override or not.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Actually, we're not QUITE out of bits. CBAUDEX | B0 is not taken.
B0 is not a bit (there are no bits in 0). It won't work.
Well that is how it is implemented and everyone else seems happy. If it violates your personal laws of physics you'll just have to cope.
It has nothing to do with 'personal laws of physics'. On all recent implementations, B0 is 0, i.e., the absence of any bits set. Therefore, there is no observable difference between CBAUDEX and CBAUDEX | B0, as shown above. Therefore, as I stated, it won't work.
Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.62 BogoMips). New book: http://www.AbominableFirebug.com/
_
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
Quoted 13 lines · linux-os \(Dick Johnson\)
Quoted 11 lines · Alan Cox
Ar Llu, 2006-08-28 am 08:17 -0400, ysgrifennodd linux-os (Dick Johnson):
Quoted 9 lines · On Sat, 26 Aug 2006 [email protected] wrote:
Quoted 6 lines
Quoted 4 lines
Or we could just add a standardised extra set of speed ioctls, but then we need to decide what occurs if I set the speed and then issue a termios call - does it override or not.
Actually, we're not QUITE out of bits. CBAUDEX | B0 is not taken.
B0 is not a bit (there are no bits in 0). It won't work.
Quoted 7 lines
Quoted 2 lines
Well that is how it is implemented and everyone else seems happy. If it violates your personal laws of physics you'll just have to cope.
It has nothing to do with 'personal laws of physics'. On all recent implementations, B0 is 0, i.e., the absence of any bits set. Therefore, there is no observable difference between CBAUDEX and CBAUDEX | B0, as shown above. Therefore, as I stated, it won't work.
What baud rate does your system define CBAUDEX | B0 to be? On my AMD64 machine, both the x86-64 and i386 asm/termbits.h files skip CBAUDEX -- B38400 is 0000017 and B57600 is 0010001 (CBAUDEX | B50). The headers do not define any baud rate between those two, either by rate or by c_cflag value.
Michael Poole
Quoted 18 lines · Michael Poole
Quoted 16 lines · linux-os \(Dick Johnson\)
Quoted 13 lines · Alan Cox
Ar Llu, 2006-08-28 am 08:17 -0400, ysgrifennodd linux-os (Dick Johnson):
Quoted 9 lines · On Sat, 26 Aug 2006 [email protected] wrote:
Quoted 6 lines
Quoted 4 lines
Or we could just add a standardised extra set of speed ioctls, but then we need to decide what occurs if I set the speed and then issue a termios call - does it override or not.
Actually, we're not QUITE out of bits. CBAUDEX | B0 is not taken.
B0 is not a bit (there are no bits in 0). It won't work.
Well that is how it is implemented and everyone else seems happy. If it violates your personal laws of physics you'll just have to cope.
Quoted 6 lines
Quoted 4 lines
It has nothing to do with 'personal laws of physics'. On all recent implementations, B0 is 0, i.e., the absence of any bits set. Therefore, there is no observable difference between CBAUDEX and CBAUDEX | B0, as shown above. Therefore, as I stated, it won't work.
What baud rate does your system define CBAUDEX | B0 to be? On my
B0 is 0 (zero), no bits. If you are trying to play semantic games and claim B0 is 1, i.e., bit 0, then it would not be written as B0, it would be written as B(0) or B:0. B0 is defined to be the baud-rate used to hang up the modem. It is zero in all bits on most all implementations including my Sun. On most recent Linux distributions, CBAUDEX is (octal) 0010000. Since B0 is zero, ORing it into CBAUDEX does nothing.
Quoted 7 lines
AMD64 machine, both the x86-64 and i386
asm/termbits.hfiles skip CBAUDEX -- B38400 is 0000017 and B57600 is 0010001 (CBAUDEX | B50). The headers do not define any baud rate between those two, either by rate or byc_cflagvalue.Michael Poole
Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.62 BogoMips). New book: http://www.AbominableFirebug.com/
_
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
Quoted 11 lines · linux-os \(Dick Johnson\)
Quoted 1 line · Michael Poole
What baud rate does your system define CBAUDEX | B0 to be? On my
B0 is 0 (zero), no bits. If you are trying to play semantic games and claim B0 is 1, i.e., bit 0, then it would not be written as B0, it would be written as B(0) or B:0. B0 is defined to be the baud-rate used to hang up the modem. It is zero in all bits on most all implementations including my Sun. On most recent Linux distributions, CBAUDEX is (octal) 0010000. Since B0 is zero, ORing it into CBAUDEX does nothing.
Thanks, Sherlock! Again: What does CBAUDEX, by itself, do on your system? As Alan Cox obviously thought the rest of the world was bright enough to notice, and as I tried to explain, the CBAUDEX bit is currently not defined when set by itself (i.e. as if it were CBAUDEX, CBAUDEX | B0, CBAUDEX << 0 or however else you want to denote it); there is always some other low-order (CBAUD) bit associated with it:
Quoted 4 lines
Quoted 4 lines
AMD64 machine, both the x86-64 and i386
asm/termbits.hfiles skip CBAUDEX -- B38400 is 0000017 and B57600 is 0010001 (CBAUDEX | B50). The headers do not define any baud rate between those two, either by rate or byc_cflagvalue.
Michael Poole
Quoted 14 lines · Michael Poole
Quoted 11 lines · linux-os \(Dick Johnson\)
Quoted 1 line · Michael Poole
What baud rate does your system define CBAUDEX | B0 to be? On my
B0 is 0 (zero), no bits. If you are trying to play semantic games and claim B0 is 1, i.e., bit 0, then it would not be written as B0, it would be written as B(0) or B:0. B0 is defined to be the baud-rate used to hang up the modem. It is zero in all bits on most all implementations including my Sun. On most recent Linux distributions, CBAUDEX is (octal) 0010000. Since B0 is zero, ORing it into CBAUDEX does nothing.
Quoted 7 lines
Thanks, Sherlock! Again: What does CBAUDEX, by itself, do on your system? As Alan Cox obviously thought the rest of the world was bright enough to notice, and as I tried to explain, the CBAUDEX bit is currently not defined when set by itself (i.e. as if it were CBAUDEX, CBAUDEX | B0, CBAUDEX << 0 or however else you want to denote it); there is always some other low-order (CBAUD) bit associated with it:
Certainly CBAUDEX does not represent a baud-rate itself. It is a bit that is used to extend the baud-rate setting from the values that could fit within the (CBAUD & ~CBAUDEX) mask so B50 through B38400 could become B57600 through B4000000 when this bit is set.
The confusion arises when you use B0 in your argument. CBAUDEX was the relevant bit, sufficiently defined, without adding a non-existent bit.
I am sensitive to 'B0' because any new implementation must also provide for its functionality. There still are modem-controlled or connected devices that need to secure a line by hanging up.
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
AMD64 machine, both the x86-64 and i386
asm/termbits.hfiles skip CBAUDEX -- B38400 is 0000017 and B57600 is 0010001 (CBAUDEX | B50). The headers do not define any baud rate between those two, either by rate or byc_cflagvalue.Michael Poole
Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.62 BogoMips). New book: http://www.AbominableFirebug.com/
_
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
Ar Llu, 2006-08-28 am 10:50 -0400, ysgrifennodd linux-os (Dick Johnson):
Quoted 4 lines
It has nothing to do with 'personal laws of physics'. On all recent implementations, B0 is 0, i.e., the absence of any bits set. Therefore, there is no observable difference between CBAUDEX and CBAUDEX | B0, as shown above.
Correct
Quoted 1 line
Therefore, as I stated, it won't work.
Incorrect
The state
(flag & CBAUD) == (CBAUDEX|0)
is not currently used
CBAUDEX|1 .. CBAUDX|15 are used as are 0-15.
Quoted 7 lines
The state
(flag & CBAUD) == (CBAUDEX|0)is not currently used
CBAUDEX|1 .. CBAUDX|15 are used as are 0-15.
a) thank you; I've been wondering why so many people seem unable to see the obvious.
b) I should mention, on the Alpha, CBAUDEX is defined as 0, and the used states are 0..30, so the spare state is 31
But again, there *is* a spare state that can be used when a custom baud rate is queried via the backward-compatible inerface.