linux serial buffer question

Nov 30, 2004 3 Replies

Is there an easy way to increase my receive serial buffer in linux? It looks like it's currently set at 4096 bytes. I'm using pyserial + python and would like to read larger chunks than this at one time.



Thanks for any help,



-es


You'd have to rebuild the kernel after modifying the sources to the tty line discipline module.

Right. The last time I looked it's set to one page. On IA32 that's 4K.

Why not wrap the read() method in three lines of python to keep calling read() until you get the desired amount of data? Just subclass the serial port object, override the read() method with a loop that calls the super's read.

Grant Edwards grante Yow! I'd like some JUNK at FOOD... and then I want to visi.com be ALONE --

I don't know, 3 lines sounds like an awful lot *grin*.

Ok, I'll work with what I've got. Thanks!

Grant Edwards wrote:

[...]

There is one case where my suggestion isn't a substitute for larger buffers. If the data is being sent when your application ready for it (it isn't calling read()), you would need larger buffers to prevent data loss or flow-control kicking in.

Grant Edwards grante Yow! This is a NO-FRILLS at flight -- hold th' CANADIAN visi.com BACON!!

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required