Reduce request latency on an FTDI UBS-to-RS-232 adapter

8,705

OK, so here's the answer ( haven't tested it yet but looks good):

# cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
16
# echo 1 > /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
# cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
1

The only annoying thing is that it looks like I may have to manually set it every time a unplug then plug back in the device, or at least on every reboot.

Share:
8,705

Related videos on Youtube

Robert S. Barnes
Author by

Robert S. Barnes

I'm a self taught programmer whose taken a break to go back to school and study Software Engineering. Currently, my main area's of interest are network programming and application level protocols, object oriented design and methodologies like Agile and TDD.

Updated on September 18, 2022

Comments

  • Robert S. Barnes
    Robert S. Barnes almost 2 years

    I'm using an ElmScan5 scantool which uses an FTDI USB-2-RS-232 serial-to-USB chip under Wine 1.6.2 on Ubuntu 14.04 (Trusty Tahr).

    The latency is very high and I found a recommendation on how to reduce it on Windows, but I'm not sure how to do something similar on Linux.

    In Windows under COM ports there is an option to reduce the latency timer:

    Call Device Manager, find your USB port. (1) Call Properties; (2) Call advanced (3) Change Latency Timer from 16 to 2 or 1 ms.

    In order to get the software working under Wine I had to add the following to the Wine registry file:

    [Hardware\\Devicemap\\Serialcomm] 1015709345
    "Serial0"="COM1"
    

    So I don't know if this is a Linux or a Wine issue.

  • Lorenzo Pistone
    Lorenzo Pistone almost 7 years
    reading kernel sources (4.11) it appears that you can set the same thing from the shell (setserial /dev/ttyUSB0 low_latency), which uses the TIOCSSERIAL ioctl.
  • Vit
    Vit about 6 years
    "echo 1 >...tty..." is always denied even for sudo while "setserial /dev/ttyUSB0 low_latency" works good
  • Admin
    Admin over 3 years
    Please edit your answer and provide more details.
  • ricardomenzer
    ricardomenzer over 2 years
    This may be a little old but can help some in the future. You cannot just append sudo to the beginning of the command. You have to type sudo sh -c 'echo 1 > /sys/bus/usb-serial/devices/ttyUSB0/latency_timer'. The former just runs echo as su, while the redirection is made by the shell, which runs as your user.