View Issue Details

IDProjectCategoryView StatusLast Update
0002521ardourfeaturespublic2011-03-28 20:21
Reportermtaht Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version2.7.1 
Summary0002521: Tranzport Kernel Driver for linux
DescriptionAfter a very long gestation, the frontier design tranzport and alphatrack drivers are being included in the Linux kernel.

A tranzport driver that uses this interface is also (after a very long gestation) nearing completion, after numerous missteps. The current, libusb based driver has numerous problems, including unreliable input and display, and a scroll wheel that generates events far too fast for ardour to keep up.

This bug is a place to stick progress being made on these drivers.

The current patch is very much alpha quality, yet is vastly superior to the existing driver.

How to use:

For linux kernel versions > 2.6.19 and < 2.6.29, you will need to separately compile and install the frontier drivers from git. (this may involve installing kernel headers and other things required to build kernel modules)

git clone git://toutatis.isc.org/home/d/src/git/frontier.git

cd frontier.git/kernel_drivers; make; sudo make install;

lacking a udev rule to do it, you also need to do a sudo chmod a+rw /dev/tranzport* every time the tranzport is inserted or the machine rebooted. (I just stuck mine in /etc/rc.local)

extract the tranzport tarball into a clean ardour-2.7.1 directory. Build ardour.

(this code also has worked with 3.0 at various points)
Additional InformationCurrent status of this driver:

Linux only (and requires hardware driver)
Extremely low cpu usage
totally reliable keystrokes
many shuttle movements actually do useful things
Device never gets knocked offline by shuttle movement
Slave to screen settings
Realtime priority is no longer required
display made reliable through offline & backlight events
 
CURRENT ISSUES:

* Need a proper udev rule
* need write throttling timers implemented
* scrub no longer increments past .1 : me stupid
* Shuttle is precisely backwards (but increments) : FIXED
* Direction doesn't work right - only takes positive/negative/0 - would prefer that the ardour lib for rounding to various bars/beats take an offset - fixed by recursive call to set_snap_to
* need estimator for going backwards while tranzport is running
* Undo issue - can crash ardour with marker create/undo. More obvious in 3.0

* shuttle Movement by region types does not work
* display should be slaved to second clock in slave mode
* Movement with grid on is busted - mostly fixed
* Display still has minor glitches - doesn't display current position until move
* epoll switch w/callbacks rather than poll
* need config screen for non-slave-mode
* implement alphatrack
* realtime scheduling is no longer required (I think) R/T disabled for now.
* Most Movement works but can underflow.
* Movement by beats can fail, less always fails.
* No grid + CD frames - moves by samples works
* backlight redraws screen, battery does not - event not sent?
* libusb backwards compatability borked

Three non-specific-to-this-driver issues I've run into

* Marker moves of cd markers is broken in gui (normal markers are fine)
* Placement of tempo markers seems broken in gui
* add marker, then undo, or several add markers and then several undos, tends to crash ardour
TagsNo tags attached.

  Users sponsoring this issue
Sponsors List Total Sponsorship = US$ 42

2011-03-28 20:15: giso (US$ 42)
  Users sponsoring this issue (Total Sponsorship = US$ 42)

Activities

2009-01-21 17:10

 

tranzport.tgz (28,800 bytes)

2009-01-21 17:47

 

tranzport2.tgz (26,634 bytes)

mtaht

2009-01-21 17:51

developer   ~0005625

* scrub no longer increments past .1 : FIXED.

The only difference between scrub mode and shuttle mode is that shuttle resets the tranzport speed at 1.0 or -1.0 and scrub at .1 or -.1. I don't know if this is truly the right thing for a proper scrub mode. The old code went to .5.

mantis is not letting me delete old patches.

2009-01-22 14:55

 

3.0support.patch (2,732 bytes)   
Index: libs/surfaces/tranzport/SConscript
===================================================================
--- libs/surfaces/tranzport/SConscript	(revision 4431)
+++ libs/surfaces/tranzport/SConscript	(working copy)
@@ -24,7 +24,7 @@
 interface.cc
 buttons.cc
 io.cc
-io_usb.cc
+io_kernel.cc
 panner.cc
 lights.cc
 screen.cc
@@ -37,6 +37,7 @@
 show.cc
 init.cc
 wheel.cc
+config.cc
 """)
 
 #figure out when to do
Index: SConstruct
===================================================================
--- SConstruct	(revision 4431)
+++ SConstruct	(working copy)
@@ -56,7 +56,8 @@
     BoolOption('LV2', 'Compile with support for LV2 (if slv2 is available)', 1),
     BoolOption('GPROFILE', 'Compile with support for gprofile (Developers only)', 0),
     BoolOption('FREEDESKTOP', 'Install MIME type, icons and .desktop file as per the freedesktop.org spec (requires xdg-utils and shared-mime-info). "scons uninstall" removes associations in desktop database', 0),
-    BoolOption('TRANZPORT', 'Compile with support for Frontier Designs (if libusb is available)', 1),
+    BoolOption('TRANZPORT', 'Compile with support for Frontier Designs (if libusb or kernel driver is available)', 1),
+    BoolOption('ALPHATRACK', 'Compile with support for Frontier Designs Alphatrack)', 0),
     BoolOption('AUBIO', "Use Paul Brossier's aubio library for feature detection (if available)", 1)
 )
 
@@ -931,6 +932,9 @@
 else:
     have_libusb = False
 
+#in the case of linux we are 
+have_libusb = False
+
 # check for linux/input.h while we're at it for powermate
 if conf.CheckHeader('linux/input.h'):
     have_linux_input = True
@@ -1274,6 +1278,7 @@
 surface_subdirs = [ 'libs/surfaces/control_protocol',
                     'libs/surfaces/generic_midi',
                     'libs/surfaces/tranzport',
+#                   'libs/surfaces/alphatrack',
                     'libs/surfaces/mackie',
                     'libs/surfaces/powermate',
 		    'libs/surfaces/wiimote',
@@ -1281,11 +1286,12 @@
                     ]
 
 if env['SURFACES']:
-    if have_libusb:
+    if config[config_kernel] == 'linux' :
         env['TRANZPORT'] = 1
+        print 'Enabled building Linux Kernel based Tranzport driver'
     else:
         env['TRANZPORT'] = 0
-        print 'Disabled building Tranzport code because libusb could not be found'
+        print 'disable building Tranzport code'
 
     if have_linux_input:
         env['POWERMATE'] = 1
@@ -1293,6 +1299,8 @@
         env['POWERMATE'] = 0
         print 'Disabled building Powermate code because linux/input.h could not be found'
 
+#    env['ALPHATRACK'] = 1
+
     if os.access ('libs/surfaces/sony9pin', os.F_OK):
         surface_subdirs += [ 'libs/surfaces/sony9pin' ]
 else:
3.0support.patch (2,732 bytes)   

2009-01-22 14:56

 

3.0.fixedfiles (20,480 bytes)

mtaht

2009-01-22 14:58

developer   ~0005633

3.0support.patch and 3.0.fixedfiles apply on top of the tranzport2.tgz files to the current svn head. Movement by bars/beats is even more messed up than in 2.0.

It's even easier to to crash ardour 3.0 with a add marker/add marker/add marker - undo/undo sequence

mtaht

2009-01-22 15:22

developer   ~0005634

And if you compile ardour3 for debugging, add marker/add marker/add marker then undo, doesn't crash ardour3....

mtaht

2009-03-04 14:47

developer   ~0005788

I discovered that most of my undo problem was related to the fact that I did not have enough locked memory available. Nothing to do with the tranzport driver at all.

2009-03-04 15:32

 

Sconstruct.patch (1,891 bytes)   
Index: SConstruct
===================================================================
--- SConstruct	(revisiĆ³n: 4688)
+++ SConstruct	(copia de trabajo)
@@ -59,6 +59,7 @@
     BoolOption('GPROFILE', 'Compile with support for gprofile (Developers only)', 0),
     BoolOption('FREEDESKTOP', 'Install MIME type, icons and .desktop file as per the freedesktop.org spec (requires xdg-utils and shared-mime-info). "scons uninstall" removes associations in desktop database', 0),
     BoolOption('TRANZPORT', 'Compile with support for Frontier Designs (if libusb is available)', 1),
+    BoolOption('KERNELTRANZPORT', 'Compile with linux kernel support for Frontier Designs', 1),
     BoolOption('AUBIO', "Use Paul Brossier's aubio library for feature detection (if available)", 1),
     BoolOption('AUSTATE', "Build with support for AU settings & presets saving/loading", 0)
 )
@@ -1203,18 +1204,24 @@
 
 surface_subdirs = [ 'libs/surfaces/control_protocol',
                     'libs/surfaces/generic_midi',
-                    'libs/surfaces/tranzport',
                     'libs/surfaces/mackie',
                     'libs/surfaces/powermate',
 		    'libs/surfaces/wiimote'
                     ]
 
 if env['SURFACES']:
-    if have_libusb:
-        env['TRANZPORT'] = 1
+    if config[config_kernel] == 'linux' :
+	env['KERNELTRANZPORT'] = 1
+	surface_subdirs += [ 'libs/surfaces/frontier/tranzport' ]
+	print 'Building Linux Kernel based Tranzport code'
     else:
-        env['TRANZPORT'] = 0
-        print 'Disabled building Tranzport code because libusb could not be found'
+    	if have_libusb:
+		env['TRANZPORT'] = 1
+		surface_subdirs += [ 'libs/surfaces/tranzport' ]
+		print 'Building libusb Tranzport code'
+	else:
+		env['TRANZPORT'] = 0
+		print 'Disabled building Tranzport code because libusb could not be found'
 
     if have_linux_input:
         env['POWERMATE'] = 1
Sconstruct.patch (1,891 bytes)   

2009-03-04 15:33

 

hwtranzport.tgz (53,176 bytes)

mtaht

2009-03-04 15:38

developer   ~0005789

OK, now SConstruct.patch lets the old libusb driver co-exist with the kernel based driver, and get built (optionally) on linux boxes for those that are into S&M.

And the new hw driver (hwtranzport.tgz) extracts into the frontier directory.

Please test. This has been in daily use in my studio for months now. Although I have a long list of issues and features I would like to add, it meets some major criterions that lift it above the old driver by kilometers.

Doesn't - ever - crash ardour.
Doesn't - ever - freeze
Doesn't - require rt privs

I would really, really, really, like to be able to stop maintaining this out of tree.

mtaht

2009-03-07 07:08

developer   ~0005795

Inspired by the attention of paul, dave phillips and sampo, I spent the past two days assembling the various patches and tweaks I had made over the past year (from the backups of two dead laptops, and elsewhere), and patched them into the above "stable" driver. It includes many bug fixes and more than a few feature enhancements, and also has a few more problems, as yet.

Like everything else I've been maintaining out of tree, it's in git, and available as part of the also out of tree kernel drivers package for the tranzport, which is at:

git clone git://git.teklibre.com/home/d/src/git/frontier.git

I just patch SConstruct with SConstruct.patch and symlink libs/ardour/surfaces/frontier/tranzport to the git tranzport directory and build that way.

If anyone would like ssh (commit) access to this repository, please email me a desired login and ssh key.

The feature and bugs fixed and bugs added list is quite long at present. Full details are in my commit logs, a short list would be:

Feature: next_marker/prev_marker goes to all marker types
Feature: mini-meter mode is always on, it's useful for figuring out if the right input is connected to the right name when entangled by cables
Feature: Tapping multiple times on rewind or fast forward does the right thing.
Feature: Adding markers uses a "Tranz" name instead of unnamed. This makes it easier to distinguish between gui-added stuff and tranzport stuff.

BUG FIX: Overdriven inputs should flash more lights, sooner
BUG FIX: nframes64_t used throughout

OLD/NEW BUG: still don't detect under/overflow in all cases

NEW BUG: Loop mode does not set ranges yet.
NEW BUG: Punch mode does not set ranges yet.

Neither loop or punch were particularly useful in the stable driver. My plan now is much better, but not quite implemented.

OLD/NEW BUG: CPU sucking error in the screen cache routines
OLD BUG, worked around: Tempo flashing never worked right in the first place, disabled.

BUG: Sometimes I get the record light lit, but not recording. Not sure if this is in the "stable" code.

OLD/NEW BUG: I would like many of these operations to be reversable.
OLD/NEW BUG: Although I added the infrastructure for it, sanely moving
             around while the playback is happening is not done yet.

BUG: The code formatting suffers from my current lack of a paul compatible .emacs and could probably use a complete whitespace reformat.

Marked a bunch of code with FIXMEs to make clear what was needed. In most cases the requirements are minor, I was mostly just trying to get to the point where the class definition was stable again just now. There is one place where I would like to make a major change to the guts of libardour, I would like to be able to supply a direction count to things like

start = session->tempo_map().round_to_beat_subdivision (start, 8);

so I could supply something like -16 to move -16 eighth beats.

Right now my solution to that is recursive and interacts with the disk butler badly.

I still don't have any crash bugs in the driver at all, so far as I know. (I can cause the disk butler's request buffer to run out of slots however)

I have a few more commits to make tonight, I have high hopes for this.

mtaht

2009-03-07 07:58

developer   ~0005796

git clone git://git.teklibre.com/home/d/src/git/frontier actually. I think. Still struggling on scrub mode. Small fix to overdrive detection.
    
I am tickled pink to see that the overdrive detection works
GREAT on an overdriven drum track, the tempo light is right on,
which gives me hope I can finally get this to work right in software.
    
It otherwise has issues with signals near the margin.
    
Perhaps ardour caches more recent overdriven signals. Or I am
doing the log function wrong.

mtaht

2009-03-07 21:28

developer   ~0005797

Much progress today.

As of commit caf9f18b1a892946a15f9e7719f44cc52803c83d

Add marker is now a reversible command (undo works)
You can add loop and punch ranges from the tranzport using the key combinations
PUNCH/LOOP ADD (start) or SHIFT PUNCH/LOOP ADD (end) The xml appears correct but the gui does not always appear to update properly. Need a signal?

This is also an undoable command.

In loop mode , shift rewind goes to the beginning of the loop, shift ffwd to the end. Play resumes the loop wherever it left off.

mtaht

2009-03-08 05:19

developer   ~0005798

Added save. Can't believe that wasn't in there.

Made loop mode work a little better. I would like to switch loop on and off without interrupting a recording, doesn't work.

Presently all movement using the shuttle while the transport rolling, is disabled, pending a refactor of all that code to speed it up and make it simpler. Am too tired to finish that today.

when the transport is not moving shuttle movement by regions or fractions of a beat is also disabled (for the same reason as the above). Other movement is fine.

Aside from that, the new loop/punch mode, the screen display fixes, and the remainder of the tweaks made over the last couple days are really making this thing sweet.

mtaht

2009-03-08 08:48

developer   ~0005799

Fixed shuttle movement for fractions of a beat through a bar during transport and idle...

couldn't help but notice that a pedant would object to Beats/3 and say that Bars/3 was the right thing to be displaying. It confused me for a while... I may still be confused.

Have to go fix the other modes next.

mtaht

2009-03-09 01:59

developer   ~0005800

Dave phillips managed to get a bug with undo that I was more or less able to duplicate. I have a fix in the git tree now that calls access_action("Editor/undo") rather than BasicUI:undo and seems to work. It was a very rare bug tho.

Also fixed wraparound in many cases.

mtaht

2009-03-13 21:52

developer   ~0005820

I successfully used this driver for an entire session recently, including loop mode. I can still, if I try hard, trigger a problem where loop no longer responds properly, (if you release shift-loop-add in the wrong order) I have a fix pending.

mtaht

2009-03-21 15:27

developer   ~0005840

fixed up meter mode a little and overdrive lights

The only major bug I seem to have is that using loop mode has issues with the gui and sometimes gets stuck. The gui issue is that we end up with multiple loop or punch ranges displayed.

The stuck problem is related to key release, still have a fix pending.

I have a performance issue with fast movement that I think I can resolve by tracking a signal.

That's it.

I also folded an old version of the alphatrack driver into the git tree. It builds but is quite far from actually working.

giso

2009-06-21 13:50

reporter   ~0006149

Adding this rule to /etc/udev/rules.d/50-tranzport.rules helps fixing the rights of the device:

# Frontier Designs Tranzport
KERNEL=="tranzport[0-9]", GROUP="audio"

giso

2010-02-08 20:38

reporter   ~0007351

To compile latest git version with ardour 2.8.7 I had to change line 355 in file "show.cc" from

            snprintf (buf, sizeof (buf), "%6.1fdB", coefficient_to_dB (route_get_effective_gain (0)));

to

            snprintf (buf, sizeof (buf), "%6.1fdB", accurate_coefficient_to_dB (route_get_effective_gain (0)));

The function coefficient_to_dB seems to be available in two versions now. I did not yet test the compiled version.

paul

2010-02-11 15:42

administrator   ~0007366

I'm very confused. My source code tree already uses accurate_coefficient_to_dB(), its at line 393 of show.cc and has been that way since rev 5756. i think that you're missing an update somewhere.

giso

2010-02-11 19:29

reporter   ~0007367

Sorry for the confusion. Since the SConstruct from ardour 2.8.7 (rev 6628) did not recognize the KERNELTRANZPORT option (and the kernel based tranzport driver was not compiled at all), I followed the description in this issue, as I did successfully with early versions of ardour. This means that my notes do only refer to the sources by mtaht/dtaht, and not to the sources of ardour.

Obviously I am missing how to compile the kernel based tranzport driver with the original ardour sources. Scons by itself tried to build the old libusb-based tranzport driver.

Issue History

Date Modified Username Field Change
2009-01-21 17:10 mtaht New Issue
2009-01-21 17:10 mtaht File Added: tranzport.tgz
2009-01-21 17:10 mtaht cost => 0.00
2009-01-21 17:47 mtaht File Added: tranzport2.tgz
2009-01-21 17:51 mtaht Note Added: 0005625
2009-01-22 14:55 mtaht File Added: 3.0support.patch
2009-01-22 14:56 mtaht File Added: 3.0.fixedfiles
2009-01-22 14:58 mtaht Note Added: 0005633
2009-01-22 15:22 mtaht Note Added: 0005634
2009-03-04 14:47 mtaht Note Added: 0005788
2009-03-04 15:32 mtaht File Added: Sconstruct.patch
2009-03-04 15:33 mtaht File Added: hwtranzport.tgz
2009-03-04 15:38 mtaht Note Added: 0005789
2009-03-07 07:08 mtaht Note Added: 0005795
2009-03-07 07:58 mtaht Note Added: 0005796
2009-03-07 21:28 mtaht Note Added: 0005797
2009-03-08 05:19 mtaht Note Added: 0005798
2009-03-08 08:48 mtaht Note Added: 0005799
2009-03-09 01:59 mtaht Note Added: 0005800
2009-03-13 21:52 mtaht Note Added: 0005820
2009-03-21 15:27 mtaht Note Added: 0005840
2009-06-21 13:50 giso Note Added: 0006149
2010-02-08 20:38 giso Note Added: 0007351
2010-02-11 15:42 paul Note Added: 0007366
2010-02-11 19:29 giso Note Added: 0007367
2011-03-28 20:15 giso Sponsorship Added giso: US$ 30
2011-03-28 20:15 giso Sponsorship Total 0 => 30
2011-03-28 20:19 giso Sponsorship Updated giso: US$ 12
2011-03-28 20:19 giso Sponsorship Total 30 => 12
2011-03-28 20:21 giso Sponsorship Updated giso: US$ 42
2011-03-28 20:21 giso Sponsorship Total 12 => 42