FTDI latency on Linux (w/ patch)

Bug #822129 reported by Angus Gratton on 2011-08-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ttyMIDI
Undecided
Unassigned

Bug Description

By default, it seems like the FTDI drivers on Linux can introduce perceptible amounts of latency. Running the example sketch on an Duemilanove, I found I could hear the 3 notes of the chord arpeggiated (briefly) each time the 3 note_on messages were sent.

I think this is because the FTDI accumulates individual bytes from the serial link, in order to send them in a single USB packet. It has an adjustable timer for this "Nagling".

The patch I've attached sets the ASYNC_LOW_LATENCY flag, which the FTDI driver interprets as a request to drop the timer to 1ms (ie send all accumulated bytes after 1ms.)

It seems you can also set the timer via the sysfs interface. I didn't realise that until after I wrote the patch! It still seems like it might be helpful if ttymidi does it automatically, though.

I haven't put #ifdef __linux__ around the linux-specific bits, because AFAIK ttymidi is Linux-only. This does add an additional dependency on the Linux userspace headers, though.

Hope the patch is useful. Ttymidi seems like a great package, by the way (we are planning to use it to run a "make your own MIDI controller" workshop at the Electrofringe electronic arts festival in Newcastle, Australia!)

Cheers

- Angus.

Angus Gratton (angusgr) wrote :
Thiago Teixeira (tvst) wrote :

Hi Angus, thanks for the bug report and for the patch! I love patches :)

At a glance your code looks good. I will give it a quick test and update trunk as soon as possible.

Cheers,

- T

Changed in ttymidi:
status: New → Triaged

Howdy Angus! I tested your patch and everything seems to work fine! I also updated the trunk! Thanks!

.j

Changed in ttymidi:
status: Triaged → Fix Released
Thiago Teixeira (tvst) wrote :

Thanks Jari! I will update the site in a bit.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers