开发者

How do I stop USB buffering?

I'm re开发者_运维技巧ading real-time data over USB, but the data is buffered. How do I stop the buffering?


Linux

Use udev to change the latency_timer.

On ubuntu, create a rule in /etc/udev/rules.d for your device. Eg 99-xsens.rules

Create a rule in that file to match your device and set the 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 there's no more incoming data to buffer. In this case my device went from waiting 16ms to waiting 2ms.

Use udevadm info -a -n /dev/ttyUSB0, for example, to find out what key-value pairs to match against in your rule. There are some tricky things to keep in mind, but finding resources to help with the ins and outs was easy once I knew to use udev rules.

Here's a good reference page on writing udev rules. It is old and the syntax of the udev tools has changed, but the concepts are still valid.

Windows

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜