]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
ucm2: USB-Audio: Add support for more Focusrite Scarlet 2-input devices
authorCalvin Walton <calvin.walton@kepstin.ca>
Wed, 3 May 2023 15:03:35 +0000 (11:03 -0400)
committerJaroslav Kysela <perex@perex.cz>
Thu, 29 Jun 2023 15:58:10 +0000 (17:58 +0200)
Adds USB ids for several more 2i2 and 2i4 devices, along with the Solo
devices. Solo is basically identical to the 2i2 devices of the same
generation; the difference is that the first input can only be used for
a mic, and the second input can only be used for line/instrument. (On
the 2i devices, both inputs are the same - they both have mic preamps,
and both support line/instrument input.)

The conditions in the main configuration have been rewritten to assign
properties by device model and generation to simplify things and allow
setting comments on the playback/capture devices to better indicate
their functionality on different models.

Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/309
Signed-off-by: Calvin Walton <calvin.walton@kepstin.ca>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/USB-Audio/Focusrite/Scarlett-2i-HiFi.conf
ucm2/USB-Audio/Focusrite/Scarlett-2i.conf
ucm2/USB-Audio/USB-Audio.conf

index ab69bc79a378c17fbd8a8e978f167dbbf94dc66c..d370c2e81fb12e7a8267b5b0486103fab63525dd 100644 (file)
@@ -28,7 +28,8 @@ Macro [
 ]
 
 SectionDevice."Line1" {
-       Comment "Line 1-2"
+       Comment "${var:Playback1Name}"
+
        Value {
                PlaybackPriority 200
        }
@@ -44,14 +45,14 @@ SectionDevice."Line1" {
        }
 }
 
-If.scarlett_2i4 {
+If.2i4 {
        Condition {
                Type String
                String1 "${var:PlaybackChannels}"
                String2 "4"
        }
        True.SectionDevice."Line2" {
-               Comment "Line 3-4"
+               Comment "${var:Playback2Name}"
 
                Value {
                        PlaybackPriority 100
@@ -70,7 +71,7 @@ If.scarlett_2i4 {
 }
 
 SectionDevice."Mic1" {
-       Comment "Input 1"
+       Comment "${var:Capture1Name}"
 
        Value {
                CapturePriority 200
@@ -86,7 +87,7 @@ SectionDevice."Mic1" {
 }
 
 SectionDevice."Mic2" {
-       Comment "Input 2"
+       Comment "${var:Capture2Name}"
 
        Value {
                CapturePriority 100
index ff63971bbb965d393f99870db70f68edec71c780..7492e574af54e851db9528b3e58d6c84f1db1978 100644 (file)
@@ -1,34 +1,61 @@
-Define.PlaybackChannels 4
-Define.DirectPlaybackChannels 4
-Define.DirectCaptureChannels 2
-Define.Generation 2
+Define {
+       PlaybackChannels 2
+       DirectPlaybackChannels 2
+       DirectCaptureChannels 2
+       Model "2i2"
+       Playback1Name "Headphones / Line 1-2"
+       Playback2Name "Line 3-4"
+       Capture1Name "Input 1 Mic/Inst/Line"
+       Capture2Name "Input 2 Mic/Inst/Line"
+       Generation "1st"
+}
 
-If.scarlett_2i2 {
+If.solo {
        Condition {
-               Type String
-               Haystack "${CardComponents}"
-               Needle "USB1235:8202"
+               Type RegexMatch
+               String "${CardComponents}"
+               Regex "USB1235:8(01c|2(05|11))"
        }
        True.Define {
-               PlaybackChannels 2
-               DirectPlaybackChannels 2
+               Model "Solo"
+               Capture1Name "Input 1 Mic"
+               Capture2Name "Input 2 Inst/Line"
        }
 }
 
-If.scarlett_2i2_gen3 {
+If.2i4 {
        Condition {
-               Type String
-               Haystack "${CardComponents}"
-               Needle "USB1235:8210"
+               Type RegexMatch
+               String "${CardComponents}"
+               Regex "USB1235:8(00a|200)"
        }
        True.Define {
-               PlaybackChannels 2
-               DirectPlaybackChannels 2
-               Generation 3
+               PlaybackChannels 4
+               DirectPlaybackChannels 4
+               Model "2i4"
+               Playback1Name "Line 1-2"
+       }
+}
+
+If.gen2 {
+       Condition {
+               Type RegexMatch
+               String "${CardComponents}"
+               Regex "USB1235:820[025]"
+       }
+       True.Define.Generation "2nd"
+}
+
+If.gen3 {
+       Condition {
+               Type RegexMatch
+               String "${CardComponents}"
+               Regex "USB1235:821[01]"
        }
+       True.Define.Generation "3rd"
 }
 
-Comment "Focusrite Scarlett 2i${var:PlaybackChannels} Gen ${var:Generation}"
+Comment "Focusrite Scarlett ${var:Model} ${var:Generation} Gen"
 
 SectionUseCase."HiFi" {
        Comment "Default"
index 377bd09da81ff454e3bf4a2fa00000a931f820ad..8bd96d10e5fbeb384831d7fae73903f0ec4391e5 100644 (file)
@@ -195,7 +195,15 @@ If.focusrite-scarlett-2i {
        Condition {
                Type RegexMatch
                String "${CardComponents}"
-               Regex "USB1235:82(0[02]|10)"
+               # 8006 2i2 1st Gen
+               # 800a 2i4 1st Gen
+               # 801c Solo 1st Gen
+               # 8200 2i4 2nd Gen
+               # 8202 2i2 2nd Gen
+               # 8205 Solo 2nd Gen
+               # 8210 2i2 3rd Gen
+               # 8211 Solo 3rd Gen
+               Regex "USB1235:8(0(0[6a]|1c)|2(0[025]|1[01]))"
        }
        True.Define {
                ProfileName "Focusrite/Scarlett-2i"