* Reading accurate size of recepts from serial port
@ 2003-08-26 8:32 Laurent Hugé
2003-08-26 8:47 ` Russell King
0 siblings, 1 reply; 8+ messages in thread
From: Laurent Hugé @ 2003-08-26 8:32 UTC (permalink / raw)
To: linux-kernel
Hi,
I feel sorry to annoy you again with my problem, but I can't imagine there is
no way to know the accurate size of a recept on the serial port.
I'm trying to implement a network driver above this port :
- I've done a raw read from 0x03f8 but it was not fast enougth (I'm working
at 115200 bauds) ;
- I've created a line discipline, but it can't (according to this mailing
list) give me the real size of what was read.
Does anybody know a way to read from the serial port with speed and accuracy ?
I'm really confused because the serial driver on Windows can do such a thing,
and, since I've no other way to find the size of PDU (CCSDS segments), I'm
obliged to rely on the serial port to let me know that size.
Thanks in advance,
--
Laurent Hugé.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Reading accurate size of recepts from serial port
2003-08-26 8:32 Reading accurate size of recepts from serial port Laurent Hugé
@ 2003-08-26 8:47 ` Russell King
2003-08-26 13:39 ` Laurent Hugé
0 siblings, 1 reply; 8+ messages in thread
From: Russell King @ 2003-08-26 8:47 UTC (permalink / raw)
To: Laurent Hugé; +Cc: linux-kernel
On Tue, Aug 26, 2003 at 10:32:13AM +0200, Laurent Hugé wrote:
> I feel sorry to annoy you again with my problem, but I can't imagine there is
> no way to know the accurate size of a recept on the serial port.
The serial driver can not and does not know in advance how many characters
the other is going to send. As far as the serial driver is concerned, it's
just a meaningless stream of characters.
To give an example, if your device sends the following character stream:
first last
v v
.....................................................
your line discipline may receive this as four separate blocks:
................ block 1
................ block 2
................. block 3
.... block 4
It may not receive it like the above - it may be several blocks of 8
characters or whatever, depending on the UARTs FIFO, interrupt load,
etc.
There is just no way for the serial driver itself to batch them back
up.
--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Reading accurate size of recepts from serial port
2003-08-26 8:47 ` Russell King
@ 2003-08-26 13:39 ` Laurent Hugé
2003-08-26 14:22 ` Stuart MacDonald
0 siblings, 1 reply; 8+ messages in thread
From: Laurent Hugé @ 2003-08-26 13:39 UTC (permalink / raw)
To: Russell King; +Cc: linux-kernel
Le Mardi 26 Août 2003 10:47, Russell King a écrit :
> There is just no way for the serial driver itself to batch them back
> up.
Ok. Thanks for your explanation. I'm going to try and find another solution.
--
Laurent Hugé.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Reading accurate size of recepts from serial port
2003-08-26 13:39 ` Laurent Hugé
@ 2003-08-26 14:22 ` Stuart MacDonald
2003-08-26 15:23 ` Laurent Hugé
0 siblings, 1 reply; 8+ messages in thread
From: Stuart MacDonald @ 2003-08-26 14:22 UTC (permalink / raw)
To: 'Laurent Hugé', 'Russell King'; +Cc: linux-kernel
From: linux-kernel-owner@vger.kernel.org
> Le Mardi 26 Août 2003 10:47, Russell King a écrit :
> > There is just no way for the serial driver itself to batch them back
> > up.
> Ok. Thanks for your explanation. I'm going to try and find
> another solution.
I may be mistaken, but I believe that Windows serial drivers work the
same way; so whatever you meant by your previous comment that you can
get what you want under windows, either you can get the same thing
under linux, or windows doesn't behave like you think it does.
..Stu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Reading accurate size of recepts from serial port
2003-08-26 14:22 ` Stuart MacDonald
@ 2003-08-26 15:23 ` Laurent Hugé
2003-08-27 14:50 ` Herbert Pötzl
0 siblings, 1 reply; 8+ messages in thread
From: Laurent Hugé @ 2003-08-26 15:23 UTC (permalink / raw)
To: Stuart MacDonald, 'Russell King'; +Cc: linux-kernel
Le Mardi 26 Août 2003 16:22, Stuart MacDonald a écrit :
> I may be mistaken, but I believe that Windows serial drivers work the
> same way; so whatever you meant by your previous comment that you can
> get what you want under windows, either you can get the same thing
> under linux, or windows doesn't behave like you think it does.
I actually don't know how it works, because I didn't contrive it (I can only
rely on what has been told to me by the people whom has done it). I'm only in
charge of porting it to Linux.
Anyway, I'm on the way to another solution (by using some property of CCSDS
segments, and see what happens).
--
Laurent Hugé.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Reading accurate size of recepts from serial port
2003-08-26 15:23 ` Laurent Hugé
@ 2003-08-27 14:50 ` Herbert Pötzl
2003-08-27 16:53 ` Laurent Hugé
0 siblings, 1 reply; 8+ messages in thread
From: Herbert Pötzl @ 2003-08-27 14:50 UTC (permalink / raw)
To: Laurent Hugé; +Cc: Stuart MacDonald, 'Russell King', linux-kernel
On Tue, Aug 26, 2003 at 05:23:04PM +0200, Laurent Hugé wrote:
> Le Mardi 26 Août 2003 16:22, Stuart MacDonald a écrit :
> > I may be mistaken, but I believe that Windows serial drivers work the
> > same way; so whatever you meant by your previous comment that you can
> > get what you want under windows, either you can get the same thing
> > under linux, or windows doesn't behave like you think it does.
> I actually don't know how it works, because I didn't contrive it (I can only
> rely on what has been told to me by the people whom has done it). I'm only in
> charge of porting it to Linux.
> Anyway, I'm on the way to another solution (by using some property of CCSDS
> segments, and see what happens).
hmm, why not do simple framing ...
[length]<data>[length]<data> ....
best,
Herbert
> --
> Laurent Hugé.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Reading accurate size of recepts from serial port
2003-08-27 14:50 ` Herbert Pötzl
@ 2003-08-27 16:53 ` Laurent Hugé
2003-08-27 17:17 ` Richard B. Johnson
0 siblings, 1 reply; 8+ messages in thread
From: Laurent Hugé @ 2003-08-27 16:53 UTC (permalink / raw)
To: herbert; +Cc: Stuart MacDonald, 'Russell King', linux-kernel
Le Mercredi 27 Août 2003 16:50, Herbert Pötzl a écrit :
> hmm, why not do simple framing ...
> [length]<data>[length]<data> ....
That's impossible. CCSDS is the committee for space date systems and it
provides standards that I can't overrule (even if I can't really understand
why they've done it like that !).
--
Laurent Hugé.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Reading accurate size of recepts from serial port
2003-08-27 16:53 ` Laurent Hugé
@ 2003-08-27 17:17 ` Richard B. Johnson
0 siblings, 0 replies; 8+ messages in thread
From: Richard B. Johnson @ 2003-08-27 17:17 UTC (permalink / raw)
To: Laurent Hugé
Cc: herbert, Stuart MacDonald, 'Russell King', linux-kernel
On Wed, 27 Aug 2003, Laurent [iso-8859-1] Hugé wrote:
> Le Mercredi 27 Août 2003 16:50, Herbert Pötzl a écrit :
> > hmm, why not do simple framing ...
> > [length]<data>[length]<data> ....
> That's impossible. CCSDS is the committee for space date systems and it
> provides standards that I can't overrule (even if I can't really understand
> why they've done it like that !).
> --
> Laurent Hugé.
>
The transfer frame in your reference specified, contains all
the information necessary for the protocol, even if it's stupid
to use that protocol on a RS-232C link. Nevertheless, there is
a minimim size for the header (5 octets in length). There is
also the 3 octets used for sync, which I'm pretty sure will
not be put onto the RS-232C links. Anyway, you need to read
40 bytes (always), from that, you will learn the length
of the rest of the data. So you use poll()/read() until you
get that header information. Then you will know what the
total read-length should be.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (794.73 BogoMips).
Note 96.31% of all statistics are fiction.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-08-27 17:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-26 8:32 Reading accurate size of recepts from serial port Laurent Hugé
2003-08-26 8:47 ` Russell King
2003-08-26 13:39 ` Laurent Hugé
2003-08-26 14:22 ` Stuart MacDonald
2003-08-26 15:23 ` Laurent Hugé
2003-08-27 14:50 ` Herbert Pötzl
2003-08-27 16:53 ` Laurent Hugé
2003-08-27 17:17 ` Richard B. Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox