From c615513d747cefcbfb4da76653d5910963e344eb Mon Sep 17 00:00:00 2001 From: Calvin Walton Date: Wed, 3 May 2023 11:03:35 -0400 Subject: [PATCH] ucm2: USB-Audio: Add support for more Focusrite Scarlet 2-input devices 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 Signed-off-by: Jaroslav Kysela --- .../USB-Audio/Focusrite/Scarlett-2i-HiFi.conf | 11 ++-- ucm2/USB-Audio/Focusrite/Scarlett-2i.conf | 63 +++++++++++++------ ucm2/USB-Audio/USB-Audio.conf | 10 ++- 3 files changed, 60 insertions(+), 24 deletions(-) diff --git a/ucm2/USB-Audio/Focusrite/Scarlett-2i-HiFi.conf b/ucm2/USB-Audio/Focusrite/Scarlett-2i-HiFi.conf index ab69bc7..d370c2e 100644 --- a/ucm2/USB-Audio/Focusrite/Scarlett-2i-HiFi.conf +++ b/ucm2/USB-Audio/Focusrite/Scarlett-2i-HiFi.conf @@ -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 diff --git a/ucm2/USB-Audio/Focusrite/Scarlett-2i.conf b/ucm2/USB-Audio/Focusrite/Scarlett-2i.conf index ff63971..7492e57 100644 --- a/ucm2/USB-Audio/Focusrite/Scarlett-2i.conf +++ b/ucm2/USB-Audio/Focusrite/Scarlett-2i.conf @@ -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" diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf index 377bd09..8bd96d1 100644 --- a/ucm2/USB-Audio/USB-Audio.conf +++ b/ucm2/USB-Audio/USB-Audio.conf @@ -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" -- 2.47.1