I’m reading real-time data over USB, but the data is buffered. How do I stop the buffering?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Linux
Use udev to change the latency_timer.
On ubuntu, create a rule in
/etc/udev/rules.dfor your device. Eg99-xsens.rulesCreate a rule in that file to match your device and set the latency_timer. For example, for my device this is:
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.