MacOS input buffer size over 1020 bytes

Hello

Currently, we are developing an application that collects measurement data from devices via USB port but we have some problems regarding input buffer size that might reduce the reading speed.

The data size is quite big (~1.5 million bytes). For every read action, the app will check the available size in the input buffer by command: ioctl(serialPort.hHandle, FIONREAD, readBuffSize)

Then that size will be passed as the desired size for the read command. Between read actions, there will be a short sleep (1 - 3 ms).

Please confirm some points below:

  • Regardless of the size of the measure data, the available size will only be up to 1020 bytes, is it expected?
  • Is the above size OS defined or driver defined? Could we increase it?
  • As we checked, there were some missing bytes between the measure data and the actual read data. Is there any chance that the data in the input buffer be overwritten while the read thread is in sleep?
  • Any recommended technique that can increase reading speed while still maintaining the integrity of the data?

Tested OS: Sonoma 14.5

Adding information for context:

  • Device uses CDC driver for communication.
  • The device is connected to Mac directly via a USB port.
  • The device is High-speed type.
  • The purpose of Sleep in the reading thread is to reduce CPU load during communication.
MacOS input buffer size over 1020 bytes
 
 
Q