How to stop USB buffering?

I read data in real time via USB, but the data is buffered. How to stop buffering?

+4
source share
1 answer

Linux

Use udev to change latency_timer.

In ubuntu, create a rule for /etc/udev/rules.d for your device. For example, 99-xsens.rules

Create a rule in this file according to your device and set latency_timer. For example, for my device, this is:

 KERNEL=="ttyUSB[0-9]*", SUBSYSTEMS=="usb-serial", DRIVERS=="ftdi_sio", ATTR{device/latency_timer}="2" 

This causes the device to wait a shorter time before deciding that no more incoming data is entering the buffer. In this case, my device went from waiting 16 ms to waiting 2 ms.

Use udevadm info -a -n /dev/ttyUSB0 , for example, to find out which key-value pairs should match in your rule. There are a few complex things to keep in mind, but finding resources to help with inserts was easy as soon as I knew that udev rules needed to be used.

Here is a good udev rules entry man page. It is old, and the syntax of udev tools has changed, but the concepts are still valid.

Window

On Windows, you use Device Manager->Ports->COM Port->Port Settings->Advanced->Latency Timer .

+4
source

Source: https://habr.com/ru/post/1315956/


All Articles