martinling / libserialport

Unofficial personal repository for libserialport - see git://sigrok.org/libserialport for official repo
http://sigrok.org/wiki/Libserialport
GNU Lesser General Public License v3.0
65 stars 34 forks source link

Question: Receive buffer sizes #38

Closed thestumbler closed 3 years ago

thestumbler commented 4 years ago

Coming from the embedded world, I'm used to worrying about UART FIFO depth. In the PC world, I'm less clear how received data is buffered. While a few of my uses cases of libserialport still have physical UARTs, many are USB-serial.

How deep is the receive buffer internally? I realize this is going to be different between OS, computer hardware, and of course USB-serial vs. real UARTs.

martinling commented 3 years ago

Unfortunately there's usually no way to tell. Same goes for the transmit buffer. From the point of view of a program (or libserialport) accessing the serial port via the OS, the buffering is basically an invisible internal detail of the hardware and the driver for it.

Some drivers do make some of their buffer settings accessible & configurable in specialised ways - on Windows these are accessible in an "advanced settings" dialog for the port - see this example for the FTDI driver.

But there's no standard API for this, and it's completely driver specific.

Basically, you just can't reliably get the same direct insight into the UART buffering that you have on an embedded system.