Focusrite Scarlett 2nd and 3rd Gen mixer driver

Talk about your MIDI interfaces, microphones, keyboards...

Moderators: MattKingUSA, khz

Post Reply
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by geoffrey »

Hi all, there are a lot of threads regarding the Scarlett Gen 2/3 mixer driver and the different models, and as it's all (finally!) starting to come together now I thought that I'd create a new thread with an update, progress, and next steps as what's happening now is applicable to all these models: 6i6/18i8/18i20 Gen 2 and Solo/2i2/4i4/8i6/18i8/18i20 Gen 3.

Gen 2 Progress

There was no progress on my end for a long time due to lack of time and hardware, but now I have development hardware again I'm back working on it, and if you have a 6i6/18i8/18i20 Gen 2 device I'd really like your help now with testing, regardless of whether it worked for you before or not or if you haven't tried it before. With enough success reports I hope that we can get to a point soon where the stable kernel has the mixer driver enabled by default and we don't need the "device_setup=1" option to enable it.

The current v5 longterm, stable, and mainline kernels (v5.4.121, v5.10.39, v5.12.6, v5.13-rc3) all support the Gen 2 devices only on USB 3 ports (xHCI host driver) and for the longest time I had no idea why (it took a while to even figure out that the problem was only happening on USB 2 ports with the EHCI host driver). I finally realised last week after many hours & days of head-scratching and hair-pulling that "snd" doesn't always mean "sound" and sometimes it means "send", and if you're trying to receive data, it's not a good idea to ask for a "usb_sndctrlpipe". So, the next release of those kernels should have a Gen 2 mixer driver that works for everyone! (fingers crossed, please test and advise!)

I've added two new features to the Gen 2 driver since then:

1. Restore all settings during startup. While I figured out how to load most of the settings from the hardware while writing the driver, I never figured out how to load the mixer volumes and the mux configuration, and if you wanted to edit your settings after reloading the driver (reboot or plug/unplug) you needed to have saved the configuration yourself beforehand even though the hardware remembered it. Many thanks to @sadko4u who figured out how to do this, as this makes the mixer driver far more usable now.

2. Add "Sync Status" control. I think(!) that this is the final Gen 2 mixer hardware feature that wasn't implemented in my kernel driver. This is a read-only control that displays either "Locked" or "Unlocked" indicating whether or not the interface is locked to a valid clock source.

If you can help test this, that would be great, and please report back here how it goes! You can find the code, RPMs, and debs here: https://github.com/geoffreybennett/scar ... /v5.12.5s3

Once I get some success reports on those new features I will send them to be included in the mainline kernel.

To test:

Besides using a kernel with the new version of the driver, you need enable the module by passing the "device_setup=1" option to it. If you've got more than one USB audio device, you need to make sure that option goes to the Scarlett interface; you can do that with a line like this in /etc/modprobe.d/scarlett.conf:

6i6 2nd Gen:

Code: Select all

options snd_usb_audio vid=0x1235 pid=0x8203 device_setup=1
18i8 2nd Gen:

Code: Select all

options snd_usb_audio vid=0x1235 pid=0x8204 device_setup=1
18i20 2nd Gen:

Code: Select all

options snd_usb_audio vid=0x1235 pid=0x8201 device_setup=1
After booting, check that the driver was loaded with

Code: Select all

dmesg|grep -A 5 -B 5 Scarlett
then you can run

Code: Select all

alsamixer -cUSB
to try out the controls. To understand what they do, please study the diagram near the top of the source code: https://github.com/torvalds/linux/blob/ ... ett_gen2.c (yes, we still need a GUI for this!).

After testing, please reply here with the output of "uname -a", "dmesg|grep -A 5 -B 5 Scarlett", the features you tested, and the results.

Gen 3 Progress

The last release I did at https://github.com/geoffreybennett/scar ... g/v5.8.8s1 has reasonable support for the 4i4 (as good as Gen 2 had before my recent updates), and I had success reports for the 8i6, 18i8, and 18i20 but especially the 18i20 had troubles I couldn't fix without the hardware.

@sadko4u took my driver and greatly improved the 18i20 support and also added Solo and 2i2 support; you can find his work at https://github.com/sadko4u/scarlett-gen ... rlett-gen3 and https://github.com/sadko4u/focusrite-scarlett-backports

None of the Gen 3 changes are in a state suitable for submission to the kernel yet though. What's there needs to be rebased to the current development kernel version and squashed and pulled apart so that each patch is a logical change as per https://www.kernel.org/doc/html/v5.12/p ... ur-changes. I've started on this process already and snuck some of the work from the Gen 3 driver into the Gen 2 code mentioned above (because we need to test and make sure that none of the Gen 3 changes affect Gen 2 functionality of course).

I should have some more Scarlett Gen 3 hardware arriving next week and then I'll be able to be a lot more confident as I put the patches into a suitable form for submission when I can test and develop with hardware in front of me. In the meantime I'll see about getting at least the 4i4 parts from the v5.8.8s1 release rebased onto v5.12.5s3.

Whew! And thanks for your patience. I think we're almost there!
User avatar
sadko4u
Established Member
Posts: 983
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 359 times

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by sadko4u »

@geoffrey I'm currently thinking that combining gen2 and gen3 drivers together was not very good idea. From my side I was required to refactor the driver many times to match the new hardware but it still requires refactoring since the implementation of different gen3 devices isn't perfect.
So the main point of criticism from my side now is how the scarlett2_device_info structure is defined.
I would like to refactor the 'ports' field and transform then into plain lists where each entry defines the type of port and additional physical information (like index in mixer, MUX and different data structures of the software configuration area).
But this is a very dangerous change and we need to verify the proper work for all devices we have.

Additionally, I've started collecting money for purchasing the missing gen3 devices.
Today we've almost crowdfunded the necessary money for purchasing 18i8 device - $361.55 on my PayPal account.
I've already requested PayPal to check out the money and will add the rest money from my pocket to purchase the 18i8 device.

Still we need the 4i4 and 8i6 gen3 devices, so you're welcome to give the necessary financial support here:
https://www.paypal.com/paypalme/sadko4u
Please don't forget to comment that this donation comes for purchasing the gen3 Scarlett devices.
LSP (Linux Studio Plugins) Developer and Maintainer.
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by geoffrey »

Progress update for Gen 2:

I got notification yesterday that the "Fix device hang with ehci-pci" patch has been added to the 5.4-stable, 5.10-stable, and 5.12-stable trees, so that should appear in the next stable release of those kernel versions.

I have taken the two patches for "Restore all settings during startup" and created a new branch with just those on top of the already accepted stable patches. I hope that we can also get these in the next stable release. If you have a 6i6, 18i8, or 18i20 Gen 2 device, please help test https://github.com/geoffreybennett/scar ... v5.12.5st1 and report back to me.

I've rebased/rewritten/tweaked all my commits for Gen 2 so they're in a form suitable for submission upstream. I'll ask for more testing and feedback on those here once I've submitted the restore-settings patches.

Progress update for Gen 3:

I've rebased/rewritten/tweaked (many times!) my 4i4 Gen 3 commits so they're in a form suitable for submission upstream. Other models coming soon and I'll be back again to request help with testing.
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by geoffrey »

sadko4u wrote: Tue May 25, 2021 8:49 am @geoffrey I'm currently thinking that combining gen2 and gen3 drivers together was not very good idea.
I can't see this. I've not completed going through everything with Gen 3, but as far as I can tell Gen 2 is only a subset of Gen 3 so any Gen 3 driver should easily accommodate the Gen 2 devices. Certainly the Gen 2 6i6+ and Gen 3 4i4+ devices are more similar than the Gen 3 2i2 and Gen 3 4i4 devices.
sadko4u wrote: Tue May 25, 2021 8:49 am From my side I was required to refactor the driver many times to match the new hardware but it still requires refactoring since the implementation of different gen3 devices isn't perfect.
Indeed yes, but I see that as a normal/inevitable process of programming as you learn new things.
sadko4u wrote: Tue May 25, 2021 8:49 am So the main point of criticism from my side now is how the scarlett2_device_info structure is defined.
I would like to refactor the 'ports' field and transform then into plain lists where each entry defines the type of port and additional physical information (like index in mixer, MUX and different data structures of the software configuration area).
From what I've seen so far, I'm not sure that will be necessary. My opinion might change after I've gone through what needs to happen for the 18i20 Gen 3 though.
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by geoffrey »

I've almost got the complete collection for development and testing now...
fc.jpg
fc.jpg (52.36 KiB) Viewed 53064 times
More code coming soon.
User avatar
sadko4u
Established Member
Posts: 983
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 359 times

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by sadko4u »

Oh wow. Geoffrey, that's so cute. How much did you spend at all?
LSP (Linux Studio Plugins) Developer and Maintainer.
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by geoffrey »

Progress update:

I completed my collection of all (9) Scarlett Gen 2/3 devices of interest so development and testing has been going much better!

I've gone through all my code, integrated in Vladimir's Solo, 2i2, phantom power, direct monitor, and talkback changes, refactored the code endless times and have 45 patches just about ready for public testing.

I got almost every feature from the 6i6 Gen 2 through to the 18i20 Gen 3 working and tested at some point and I'm hopeful that my last few rounds of refactoring didn't break anything. Major things not tested at all yet are ADAT I/O and sample rates >48kHz (I can't hear anything above 14kHz :wink:).

Another update coming soon...
User avatar
sysrqer
Established Member
Posts: 2516
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 319 times
Been thanked: 147 times
Contact:

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by sysrqer »

You are a hero Geoffrey!
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Release the code!

Post by geoffrey »

If you can compile your own kernel, have any of the following devices:
  • 6i6/18i8/18i20 Gen 2
  • Solo/2i2/4i4/8i6/18i8/18i20 Gen 3
and would like to help with testing, please check out https://github.com/geoffreybennett/scar ... rlett-gen3 and start providing feedback.

I made a list of the capabilities for each model here; it's a useful reference to the hardware and the mixer driver:
https://gist.github.com/geoffreybennett ... 13cc719645

If you'd like a pre-built kernel, I'll upload those in the next few days.
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Release the code!

Post by geoffrey »

geoffrey wrote: Tue Jun 15, 2021 3:28 pm If you'd like a pre-built kernel, I'll upload those in the next few days.
RPM and deb packages are now available from: https://github.com/geoffreybennett/scar ... /v5.12.9s1

If you'd like to try the module with your distro kernel, HinTak has a git repo with some instructions here: https://github.com/Focusrite-Scarlett-o ... rlett-gen3

Good luck, have fun, and let me know how you go!

Thanks,
Geoffrey.
Ben Tyson
Established Member
Posts: 11
Joined: Sat Mar 21, 2020 1:13 pm

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by Ben Tyson »

Is this a good place for feedback?

I have a 3rd Gen 8i6, running on Ubuntu Studio 20.04. I've just compiled the liquorix kernel with the new driver, seems to be working fine from a quick test. I just loaded up a conveniently located Reaper project that I knew was relatively CPU-heavy, seems to be running at least as well as previously, maybe with fewer x-runs than I saw last time I opened it. Can't really say much other than "yes, functioning," so far I'm afraid, but will be doing more stuff later.
Is there anything specific I could test/log output from/etc that would be particularly useful?
JamesPeters
Established Member
Posts: 188
Joined: Fri Jun 29, 2018 6:35 pm
Has thanked: 8 times
Been thanked: 15 times

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by JamesPeters »

Ben Tyson wrote: Fri Jun 18, 2021 3:06 pmIs there anything specific I could test/log output from/etc that would be particularly useful?
I think a good general test for how stable it works would be: can you use a blocksize of 32 samples with 4 periods (using ALSA) without xruns, assuming you're using a samplerate of 44.1 KHz. (With Manjaro and its "stock" kernel 5.12.9-1, I'm able to use that setting with a 2i2 3rd gen and I don't get xruns in Reaper unless a particular plugin spikes upon loading, but it's rare.)

If you're having issues getting your latency that low without xruns, be aware that you should set your CPU's governor to "performance" and disable USB autosuspend. The latter will ensure your audio device can maintain its low-latency connection due to not periodically powering down, and the former will prevent the CPU from struggling to handle a change in load from one moment to the next as you work in the DAW. I use TLP to change these settings (and its GUI frontend TLPUI).

Some other useful tests, for functionality:

-Can you access and perform all functions of the device from ALSAmixer and/or QASmixer such as turning on/off the "air" switches, pad switches, phantom power, using volume/gain faders (if any). Also do those functions remain in the same state after you restart the computer (persistence).

-Does all i/o work, and is it all identified correctly in ALSAmixer and/or QASmixer.

I'd help with testing but I'm only using the 2i2 which has no functionality to be controlled by a driver (nothing beyond the physical switches on the outside of the unit). It has no sliders/switches in ALSAmixer and QASmixer.
wolftune
Established Member
Posts: 1350
Joined: Fri Feb 24, 2012 7:40 pm
Location: Portland, OR
Been thanked: 2 times
Contact:

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by wolftune »

Some feedback on testing (with 3rd gen 18i8 and the .deb kernel release files on KDE Neon):

Line 01 Mute (and 02 through 08 also) is confusing label because enabling them is muted, and **muting** the mutes is how to turn the output on. Would be much better to label them "enable" or "active" instead of "mute". It would also help to call them "Line 01 out" and not just "Line 01" because that would make it that much more obvious that this is a playback setting.

I cannot "mute" (turn off) the "Line # Mute" settings *unless* I turn the control to SW instead of HW. But with the SW settings, only the headphone knobs work, the large Monitor knob does nothing. This means there's no way to have the Monitor knob *active* and *also* hear anything from outputs 01-04. In other words, no way to actually use that knob at all.

It would be really ideal if the LR pairs of outputs (1-2, 3-4, 5-6, 7-8) were recognized as a stereo set that would move together. Since alsamixer can still separate them when recognized that way, this would be an improvement all around. Maybe the output mute controls would be good that way too, not sure if that's as feasible or practical either implementation or interface.

PAD control is missing for Line in 3 and 4.

While most controls are reflected in both AlsaMixer and QasMixer if they are changed in either one, Phantom Power Persistence doesn't change in the other when changed in one. Perhaps that means it isn't actually working? I haven't figured out how to verify that yet.

I did find another case where AlsaMixer and QasMixer don't update each other: the Line output "mute" settings (the ones I said above should be renamed "enabled"). They both do succeed at the changes, but changing one does not reflect the change in the other mixer.

There are two other system-wide looking things called "Dim" and "Mute" for Playback. What are those? I can't tell what they do.

Last important detail: I'm unable to use less than 128 for buffer setting, it has lots of xruns with 64 or 32 (though this worked with gen1 and gen2 devices I've used in the past). I did turn off USB_AUTOSUSPEND in tlpui and hit "save" (I don't know if that's enough, but it wasn't needed before with the other devices), and I am using performance for cpufreq governor.

Also, jack_bufsize doesn't work at all no matter how I set it. Incidentally, "switch master" in Cadence *does* work.
Aaron Wolf
Music teacher, scholar
http://wolftune.com
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by geoffrey »

Ben Tyson wrote: Fri Jun 18, 2021 3:06 pm Is this a good place for feedback?

I have a 3rd Gen 8i6, running on Ubuntu Studio 20.04. I've just compiled the liquorix kernel with the new driver, seems to be working fine from a quick test. I just loaded up a conveniently located Reaper project that I knew was relatively CPU-heavy, seems to be running at least as well as previously, maybe with fewer x-runs than I saw last time I opened it. Can't really say much other than "yes, functioning," so far I'm afraid, but will be doing more stuff later.
Is there anything specific I could test/log output from/etc that would be particularly useful?
Hi @Ben Tyson, thanks for testing!

Yes, this is a good place for feedback. Besides "yes, functioning" (which by itself is actually great; earlier versions of the driver didn't pass this test!), you can test the new features available as @JamesPeters describes above.

The mixer driver does not (should not(!)) affect the audio functionality; it should only add new features available through the mixer interface. If you are getting fewer x-runs, I can't take credit for that :).

Regards,
Geoffrey.
geoffrey
Established Member
Posts: 250
Joined: Mon Jul 30, 2018 2:08 am
Has thanked: 33 times
Been thanked: 163 times

Re: Focusrite Scarlett 2nd and 3rd Gen mixer driver

Post by geoffrey »

JamesPeters wrote: Fri Jun 18, 2021 6:15 pm I'd help with testing but I'm only using the 2i2 which has no functionality to be controlled by a driver (nothing beyond the physical switches on the outside of the unit). It has no sliders/switches in ALSAmixer and QASmixer.
Hi @JamesPeters,

You can help with testing! For the 2i2 there are these new controls available through alsamixer:
  • MSD Mode
  • Direct Monitor
  • Line 1/2 Air, Level, Phantom Power
  • Phantom Power Persistence
Granted, you can change Direct Monitor, Air, Level, and Phantom Power from the physical switches, but you can also do it from the mixer and the two should keep in sync.

Phantom Power Persistence is the one useful thing that you can enable from the mixer interface that you can't enable from the front panel. Once enabled, the device will remember the state of the phantom power switch when it is powered off.

Regards,
Geoffrey.
Post Reply