Focusrite Scarlett 18i20 2nd Gen mixer driver

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

Moderators: khz, MattKingUSA

User avatar
xkr47
Established Member
Posts: 11
Joined: Fri Jul 19, 2019 5:50 pm
Contact:

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Postby xkr47 » Sun Nov 03, 2019 6:33 pm

cjoke wrote:I think this thread need a little update acording to focusrite scarlett 2 gen, since kernel version 5.4-rc1 the mixerdriver has been available. https://github.com/torvalds/linux/commi ... 3298309b3e 3

just clone and compile and have fun :slight_smile:


Good times indeed for 2nd gen owners. Was there any specific firmware requirements? Does it work in Linux out of the box or do you need to "boot it once in windows" to get it to work or similar? Is it possible you update the firmware in linux? (not specifically pointing the questions to cjoke, anybody feel free to respond :) )

User avatar
cjoke
Established Member
Posts: 8
Joined: Thu Jul 25, 2019 8:03 pm
Location: Norway
Contact:

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Postby cjoke » Mon Nov 04, 2019 12:13 pm

xkr47 wrote:
cjoke wrote:I think this thread need a little update acording to focusrite scarlett 2 gen, since kernel version 5.4-rc1 the mixerdriver has been available. https://github.com/torvalds/linux/commi ... 3298309b3e 3

just clone and compile and have fun :slight_smile:


Good times indeed for 2nd gen owners. Was there any specific firmware requirements? Does it work in Linux out of the box or do you need to "boot it once in windows" to get it to work or similar? Is it possible you update the firmware in linux? (not specifically pointing the questions to cjoke, anybody feel free to respond :) )


Me and some other users had some problems and Geoffrey had some ideas about issues in firmware/serialnumbers before 30000. My firmware is around 12000, and I could not get it to work on my PC, but the same scarlett works on my laptop. So my guess it is something with how USB driver/controller speaks with the soundcard. Geoffrey sure can speak more in details on this issue, since Im noob :)
Love, people, music, beer and lot of other stuff.

User avatar
xkr47
Established Member
Posts: 11
Joined: Fri Jul 19, 2019 5:50 pm
Contact:

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Postby xkr47 » Wed Nov 06, 2019 6:32 am

Hi geoffrey,

I did a review of the driver code. Here are my findings so far:

  1. It seems to me that the scarlett2_device_info.ports array is indexed by the SCARLETT2_PORT_TYPE_* enums; if so there seems to be a bug in the 6i6 metadata; there is no entry for SCARLETT2_PORT_TYPE_ADAT, and in it's place is the next entry e.g. SCARLETT2_PORT_TYPE_MIX. Similarly using SCARLETT2_PORT_TYPE_MIX as index will give the values for SCARLETT2_PORT_TYPE_PCM. And finally using SCARLETT2_PORT_TYPE_PCM will give all-zero values. Below findings for potential bugs with 6i6 with above assumptions:

    1. This seems to affect scarlett2_usb_set_mix(), line 803 which thus gets the number "6" for num_mixer_in when the table suggests it should be 18. I cannot say which number is correct i.e. whether the data has also been updated in the wrong place to get it to work..
    2. scarlett2_usb_set_mux() probably affected
    3. scarlett2_mixer_ctl_put() uses num_mixer_in from wrong port type
    4. scarlett2_add_mixer_ctls() num_inputs and num_outputs from wrong port type
    5. scarlett2_init_routing() output_count = 0 and input_count = 0, so the inner for loops will not do anything

    I think the least error-prone way mitigation would be to initialize the ports array with C99 designators:

    Code: Select all

       .ports = {
          [SCARLETT2_PORT_TYPE_NONE] = {
             .id = 0x000,
             .num = { 1, 0, 8, 8, 8 },
             .src_descr = "Off",
             .src_num_offset = 0,
          },
          [SCARLETT2_PORT_TYPE_ANALOGUE] = {
             .id = 0x080,
             .num = { 4, 4, 4, 4, 4 },
             .src_descr = "Analogue %d",
             .src_num_offset = 1,
             .dst_descr = "Analogue Output %02d Playback"
          },
          ...

  2. Line 404 says:

    Code: Select all

             /* S/PDIF outputs aren't available at 192KHz
              * but are included in the USB mux I/O
              * assignment message anyway

    but the manual of at least 18i8 lists S/PDIF outputs as available all the way up to 192kHz.. Is this a) comment in the code an error, b) a linux limitation or c) an error in the manual?

geoffrey
Established Member
Posts: 68
Joined: Mon Jul 30, 2018 2:08 am

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Postby geoffrey » Wed Nov 06, 2019 1:34 pm

Hi xkr47,
xkr47 wrote:
cjoke wrote:I think this thread need a little update acording to focusrite scarlett 2 gen, since kernel version 5.4-rc1 the mixerdriver has been available. https://github.com/torvalds/linux/commi ... 3298309b3e 3

just clone and compile and have fun :slight_smile:
Good times indeed for 2nd gen owners. Was there any specific firmware requirements?
I did my development with an 18i20 firmware 1083 and an 18i8 firmware 1076. I haven't heard of other versions either working or not working.

xkr47 wrote:Does it work in Linux out of the box or do you need to "boot it once in windows" to get it to work or similar?
sysrqer reported that the 6i6 worked out of the box: viewtopic.php?f=6&t=19975&p=108076&hilit=6i6#p108153

xkr47 wrote:Is it possible you update the firmware in linux? (not specifically pointing the questions to cjoke, anybody feel free to respond :) )
Updating the firmware natively in Linux isn't possible.

Regards,
Geoffrey.

geoffrey
Established Member
Posts: 68
Joined: Mon Jul 30, 2018 2:08 am

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Postby geoffrey » Wed Nov 06, 2019 2:04 pm

Hi xkr47,

Thanks very much for your review! I really appreciate you taking the time to go through the code.

xkr47 wrote:It seems to me that the scarlett2_device_info.ports array is indexed by the SCARLETT2_PORT_TYPE_* enums; if so there seems to be a bug in the 6i6 metadata; there is no entry for SCARLETT2_PORT_TYPE_ADAT, and in it's place is the next entry e.g. SCARLETT2_PORT_TYPE_MIX.
You are correct; well spotted! Please see https://github.com/geoffreybennett/scar ... t-gen2-5.4 for my proposed fix (I liked your suggestion to use designators).

xkr47 wrote:Line 404 says:

Code: Select all

         /* S/PDIF outputs aren't available at 192KHz
          * but are included in the USB mux I/O
          * assignment message anyway

but the manual of at least 18i8 lists S/PDIF outputs as available all the way up to 192kHz.. Is this a) comment in the code an error, b) a linux limitation or c) an error in the manual?[/list]
Most likely the comment is incorrect. The 18i20 manual says "the S/PDIF outputs are unavailable at 176.4/192 kHz sample rates" and I just presumed the same applied to the 18i8 without checking the manual or testing it. It'd be good to test this; make sure that 18i20 S/PDIF output doesn't work at 192KHz and the 18i8 S/PDIF output does work at 192KHz then fix the comment.

Thanks again,
Geoffrey.

User avatar
xkr47
Established Member
Posts: 11
Joined: Fri Jul 19, 2019 5:50 pm
Contact:

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Postby xkr47 » Wed Nov 06, 2019 5:35 pm

geoffrey wrote:Thanks very much for your review! I really appreciate you taking the time to go through the code.

Hey now, I wish you had a patreon or similar so we all could appreciate your work here with some money so you could buy some 3rd gen hw :wink:

Also, I managed to order one of the last 2nd gen 18i8s in my country so I started looking at the code again in more detail to better understand the beast while waiting for the box to arrive :)
I want to say I would not have ordered it without your awesome work. Maybe I would have settled for a 2i2 or something instead. Dunno..

geoffrey wrote:You are correct; well spotted! Please see https://github.com/geoffreybennett/scar ... t-gen2-5.4 for my proposed fix (I liked your suggestion to use designators).

Yeah looks great! Funny that the 6i6 still worked despite the misalignment.. I guess 6i6 users might still get some (positive?) surprises with this fix :)

geoffrey wrote:Most likely the comment is incorrect. The 18i20 manual says "the S/PDIF outputs are unavailable at 176.4/192 kHz sample rates" and I just presumed the same applied to the 18i8 without checking the manual or testing it. It'd be good to test this; make sure that 18i20 S/PDIF output doesn't work at 192KHz and the 18i8 S/PDIF output does work at 192KHz then fix the comment.

I guess it would be possible to test the scarletts against themselves by looping a cable from out to in since both models are supposed to at least support 192kHz on input?

Where does info for the ascii art in the source code come from? I mean there's a similar one in the 1st gen driver, but is there actually some schematics available somewhere or have you figured it out by trial and error?

Thanks,
xkr47

tvaz
Posts: 1
Joined: Sun Nov 10, 2019 5:55 pm

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Postby tvaz » Sun Nov 10, 2019 6:12 pm

Hi, I've just came to this thread after a few days trying to put a 18i20 2nd Gen to work in my Debian system.

First, a huge thanks to geoffrey and others involved for their amazing work. My device is working as it should, finally.

I didn't try it enough, but I couldn't wait further to come here to say thanks and share what I exactly did so far:

- Installed the .deb kernel image and headers from https://github.com/geoffreybennett/scar ... v5.4rc6s10
- created the 'scarlett.conf' file under /etc/modprob.d/ with the content: 'options snd_usb_audio device_setup=1'
- reloaded the module
- installed qasmixer, as I couldn't navigate well on default alsamixer command.
- I had to set the clock source to 'internal'. I was S/PDIF by default

And then things just started working.

I'll be reporting any issues that I may find in the following days.

Thanks again.

geoffrey
Established Member
Posts: 68
Joined: Mon Jul 30, 2018 2:08 am

Re: Focusrite Scarlett 18i20 2nd Gen mixer driver

Postby geoffrey » Mon Nov 11, 2019 8:03 am

Hi xkr47,

xkr47 wrote:
geoffrey wrote:Thanks very much for your review! I really appreciate you taking the time to go through the code.
Hey now, I wish you had a patreon or similar so we all could appreciate your work here with some money so you could buy some 3rd gen hw :wink:
Well, in exciting news, please see: viewtopic.php?f=6&t=20669 — I now have a 3rd gen 4i4 and am working on the driver. If people would like to donate so I can get an 3rd gen 8i6/18i8/18i20 and extend the driver to support more models, please contact me by private message or email g@b4.vu.

xkr47 wrote:Also, I managed to order one of the last 2nd gen 18i8s in my country so I started looking at the code again in more detail to better understand the beast while waiting for the box to arrive :)
I want to say I would not have ordered it without your awesome work. Maybe I would have settled for a 2i2 or something instead. Dunno..
I do like my 18i8. It's awesome having 8 analogue inputs so you can plug in all your mics, guitars, synths, and drum machines at once :-).

xkr47 wrote:
geoffrey wrote:You are correct; well spotted! Please see https://github.com/geoffreybennett/scar ... t-gen2-5.4 for my proposed fix (I liked your suggestion to use designators).
Yeah looks great! Funny that the 6i6 still worked despite the misalignment.. I guess 6i6 users might still get some (positive?) surprises with this fix :)
Yes indeed; with how it was, the routing setup wouldn't work very well at all.

xkr47 wrote:
geoffrey wrote:Most likely the comment is incorrect. The 18i20 manual says "the S/PDIF outputs are unavailable at 176.4/192 kHz sample rates" and I just presumed the same applied to the 18i8 without checking the manual or testing it. It'd be good to test this; make sure that 18i20 S/PDIF output doesn't work at 192KHz and the 18i8 S/PDIF output does work at 192KHz then fix the comment.
I guess it would be possible to test the scarletts against themselves by looping a cable from out to in since both models are supposed to at least support 192kHz on input?
Yes, that could be done.

xkr47 wrote:Where does info for the ascii art in the source code come from? I mean there's a similar one in the 1st gen driver, but is there actually some schematics available somewhere or have you figured it out by trial and error?
I've not seen any schematics available. I just noticed some things missing for the 2nd Gen & added them in to the diagram from the 1st gen driver.

Regards,
Geoffrey.


Return to “Computer Related Hardware”

Who is online

Users browsing this forum: No registered users and 2 guests