x42 / scarlett-mixer

Quickly hacked scarlett-mixer GUI for Linux/ALSA
GNU General Public License v2.0
125 stars 23 forks source link

Segfault using Scarlett 18i8 #16

Open david0 opened 4 years ago

david0 commented 4 years ago

Unfortunately I get a segfault on my system:

$./scarlett-mixer     
[1]    4596 segmentation fault (core dumped)  ./scarlett-mixer

aplay shows:

card 3: USB [Scarlett 18i8 USB], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Stacktrace:

gdb -q scarlett-mixer
Reading symbols from scarlett-mixer...
(gdb) r
Starting program: /home/ottodavid/scarlett-mixer/scarlett-mixer 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff79ec5a0 in snd_mixer_selem_get_enum_items () from /usr/lib/libasound.so.2
(gdb) bt
#0  0x00007ffff79ec5a0 in snd_mixer_selem_get_enum_items () at /usr/lib/libasound.so.2
#1  0x0000555555575ecd in toplevel (ui=0x5555555a9ad0, top=0x5555555a91f0) at ./src/scarlett_mixer.c:1011
#2  0x0000555555577f79 in instantiate
    (ui_toplevel=0x5555555a91f0, descriptor=0x555555585ce0 <gl_descriptor>, plugin_uri=0x55555557e0cd "URI TODO", bundle_path=0x0, write_function=0x0, controller=0x0, widget=0x5555555a9298, features=0x7fffffffde90)
    at ./src/scarlett_mixer.c:1449
#3  0x000055555557ba8e in gl_instantiate (descriptor=0x555555585ce0 <gl_descriptor>, plugin_uri=0x55555557e0cd "URI TODO", bundle_path=0x0, write_function=0x0, controller=0x0, widget=0x555555586dc0 <extui>, features=0x7fffffffde90)
    at robtk/ui_gl.c:1490
#4  0x0000555555559040 in main (argc=1, argv=0x7fffffffdfb8) at robtk/robtkapp.c:218
noscript commented 4 years ago

Same for 18i20

mauropasse commented 4 years ago

@david0 I have the same issue and backtrace as you. I have the Scarlett 18i8 USB 3rd gen, but this repo should support only 1st generation. Question, if I get a Windows machine and do the configs there, will they mantain those configs when I use it with linux?

noscript commented 4 years ago

Question, if I get a Windows machine and do the configs there, will they mantain those configs when I use it with linux?

At least for me it is preserved. This is how I currently use 18i20 in Linux.

P.S.: mine is 2nd gen.

hires commented 4 years ago

I can confirm my 18i20 2nd gen also segfaults.

x42 commented 4 years ago

First line of the README:

"Currently supported models, first generation of..."

david0 commented 4 years ago

Output of ./scarlett-mixer -vv --print-controls:

* hw:1 "HDA Intel HDMI"
* hw:2 "HDA Intel PCH"
* hw:3 "Scarlett 18i8 USB"
Autodetect: Using "hw:3"
Device `Scarlett 18i8 USB' has 1 contols: 
 0 'Clock Source Clock Source', ENUM
CMP 18
--- Device: Scarlett 18i8 USB
Matrix: in=0, out=0, off=0, stride=0
Matrix: input-select=0, select-stride=0
Inputs: ins=0 select-offset=0
Masters: n_mst=0 n_out-select=0
Switches: n_pad=0, n_hiz=0
hiz_map = {-1, -1, };
pad_map = {-1, -1, -1, -1, };
out_gain_map = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
out_gain_labels = {, , , , , , , , , , };
out_bus_map = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
---
--- Device: Scarlett 18i8 USB
Matrix: in=18, out=8, off=40, stride=9
Matrix: input-select=39, select-stride=9
Inputs: ins=18 select-offset=20
Masters: n_mst=4 n_out-select=8
Switches: n_pad=4, n_hiz=2
hiz_map = {15, 17, };
pad_map = {16, 18, 19, 20, };
out_gain_map = {1, 4, 7, 10, -1, -1, -1, -1, -1, -1, };
out_gain_labels = {Monitor, Headphone 1, Headphone 2, SPDIF, , , , , , , };
out_bus_map = {2, 3, 5, 6, 8, 9, 11, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
---
[1]    152104 segmentation fault (core dumped)  ./scarlett-mixer -vv --print-controls
david0 commented 4 years ago

I found the problem. With gen2 the mixer is disabled by default. You see that in dmesg:

Focusrite Scarlett Gen 2 Mixer Driver disabled; use options snd_usb_audio device_setup=1 to enable and report any issues to g@b4.vu

in my case (18i8 2nd gen) it needed the following (in /etc/modprobe.d/scarlett.conf):

options snd_usb_audio vid=0x1235 pid=0x8215 device_setup=1,1,1,1

./scarlett-mixer -vv --print-controls now shows:


Device `Scarlett 18i8 USB' has 237 contols: 
 0 'PCM 01', ENUM
 1 'PCM 02', ENUM
 2 'PCM 03', ENUM
 3 'PCM 04', ENUM
 4 'PCM 05', ENUM
 5 'PCM 06', ENUM
 6 'PCM 07', ENUM
 7 'PCM 08', ENUM
 8 'PCM 09', ENUM
 9 'PCM 10', ENUM
 10 'PCM 11', ENUM
 11 'PCM 12', ENUM
 12 'PCM 13', ENUM
 13 'PCM 14', ENUM
 14 'PCM 15', ENUM
 15 'PCM 16', ENUM
 16 'PCM 17', ENUM
 17 'PCM 18', ENUM
 18 'Line 01 (Monitor L)'
 19 'Line 02 (Monitor R)'
 20 'Line 03 (Headphones 1 L)'
 21 'Line 04 (Headphones 1 R)'
 22 'Line 05 (Headphones 2 L)'
 23 'Line 06 (Headphones 2 R)'
 24 'Line In 1 Level', ENUM
 25 'Line In 1 Pad', CPS
 26 'Line In 2 Level', ENUM
 27 'Line In 2 Pad', CPS
 28 'Line In 3 Pad', CPS
 29 'Line In 4 Pad', CPS
 30 'Mix A Input 01'
 31 'Mix A Input 02'
 32 'Mix A Input 03'
 33 'Mix A Input 04'
 34 'Mix A Input 05'
 35 'Mix A Input 06'
 36 'Mix A Input 07'
 37 'Mix A Input 08'
 38 'Mix A Input 09'
 39 'Mix A Input 10'
 40 'Mix A Input 11'
 41 'Mix A Input 12'
 42 'Mix A Input 13'
 43 'Mix A Input 14'
 44 'Mix A Input 15'
 45 'Mix A Input 16'
 46 'Mix A Input 17'
 47 'Mix A Input 18'
 48 'Mix B Input 01'
 49 'Mix B Input 02'
 50 'Mix B Input 03'
 51 'Mix B Input 04'
 52 'Mix B Input 05'
 53 'Mix B Input 06'
 54 'Mix B Input 07'
 55 'Mix B Input 08'
 56 'Mix B Input 09'
 57 'Mix B Input 10'
 58 'Mix B Input 11'
 59 'Mix B Input 12'
 60 'Mix B Input 13'
 61 'Mix B Input 14'
 62 'Mix B Input 15'
 63 'Mix B Input 16'
 64 'Mix B Input 17'
 65 'Mix B Input 18'
 66 'Mix C Input 01'
 67 'Mix C Input 02'
 68 'Mix C Input 03'
 69 'Mix C Input 04'
 70 'Mix C Input 05'
 71 'Mix C Input 06'
 72 'Mix C Input 07'
 73 'Mix C Input 08'
 74 'Mix C Input 09'
 75 'Mix C Input 10'
 76 'Mix C Input 11'
 77 'Mix C Input 12'
 78 'Mix C Input 13'
 79 'Mix C Input 14'
 80 'Mix C Input 15'
 81 'Mix C Input 16'
 82 'Mix C Input 17'
 83 'Mix C Input 18'
 84 'Mix D Input 01'
 85 'Mix D Input 02'
 86 'Mix D Input 03'
 87 'Mix D Input 04'
 88 'Mix D Input 05'
 89 'Mix D Input 06'
 90 'Mix D Input 07'
 91 'Mix D Input 08'
 92 'Mix D Input 09'
 93 'Mix D Input 10'
 94 'Mix D Input 11'
 95 'Mix D Input 12'
 96 'Mix D Input 13'
 97 'Mix D Input 14'
 98 'Mix D Input 15'
 99 'Mix D Input 16'
 100 'Mix D Input 17'
 101 'Mix D Input 18'
 102 'Mix E Input 01'
 103 'Mix E Input 02'
 104 'Mix E Input 03'
 105 'Mix E Input 04'
 106 'Mix E Input 05'
 107 'Mix E Input 06'
 108 'Mix E Input 07'
 109 'Mix E Input 08'
 110 'Mix E Input 09'
 111 'Mix E Input 10'
 112 'Mix E Input 11'
 113 'Mix E Input 12'
 114 'Mix E Input 13'
 115 'Mix E Input 14'
 116 'Mix E Input 15'
 117 'Mix E Input 16'
 118 'Mix E Input 17'
 119 'Mix E Input 18'
 120 'Mix F Input 01'
 121 'Mix F Input 02'
 122 'Mix F Input 03'
 123 'Mix F Input 04'
 124 'Mix F Input 05'
 125 'Mix F Input 06'
 126 'Mix F Input 07'
 127 'Mix F Input 08'
 128 'Mix F Input 09'
 129 'Mix F Input 10'
 130 'Mix F Input 11'
 131 'Mix F Input 12'
 132 'Mix F Input 13'
 133 'Mix F Input 14'
 134 'Mix F Input 15'
 135 'Mix F Input 16'
 136 'Mix F Input 17'
 137 'Mix F Input 18'
 138 'Mix G Input 01'
 139 'Mix G Input 02'
 140 'Mix G Input 03'
 141 'Mix G Input 04'
 142 'Mix G Input 05'
 143 'Mix G Input 06'
 144 'Mix G Input 07'
 145 'Mix G Input 08'
 146 'Mix G Input 09'
 147 'Mix G Input 10'
 148 'Mix G Input 11'
 149 'Mix G Input 12'
 150 'Mix G Input 13'
 151 'Mix G Input 14'
 152 'Mix G Input 15'
 153 'Mix G Input 16'
 154 'Mix G Input 17'
 155 'Mix G Input 18'
 156 'Mix H Input 01'
 157 'Mix H Input 02'
 158 'Mix H Input 03'
 159 'Mix H Input 04'
 160 'Mix H Input 05'
 161 'Mix H Input 06'
 162 'Mix H Input 07'
 163 'Mix H Input 08'
 164 'Mix H Input 09'
 165 'Mix H Input 10'
 166 'Mix H Input 11'
 167 'Mix H Input 12'
 168 'Mix H Input 13'
 169 'Mix H Input 14'
 170 'Mix H Input 15'
 171 'Mix H Input 16'
 172 'Mix H Input 17'
 173 'Mix H Input 18'
 174 'Mix I Input 01'
 175 'Mix I Input 02'
 176 'Mix I Input 03'
 177 'Mix I Input 04'
 178 'Mix I Input 05'
 179 'Mix I Input 06'
 180 'Mix I Input 07'
 181 'Mix I Input 08'
 182 'Mix I Input 09'
 183 'Mix I Input 10'
 184 'Mix I Input 11'
 185 'Mix I Input 12'
 186 'Mix I Input 13'
 187 'Mix I Input 14'
 188 'Mix I Input 15'
 189 'Mix I Input 16'
 190 'Mix I Input 17'
 191 'Mix I Input 18'
 192 'Mix J Input 01'
 193 'Mix J Input 02'
 194 'Mix J Input 03'
 195 'Mix J Input 04'
 196 'Mix J Input 05'
 197 'Mix J Input 06'
 198 'Mix J Input 07'
 199 'Mix J Input 08'
 200 'Mix J Input 09'
 201 'Mix J Input 10'
 202 'Mix J Input 11'
 203 'Mix J Input 12'
 204 'Mix J Input 13'
 205 'Mix J Input 14'
 206 'Mix J Input 15'
 207 'Mix J Input 16'
 208 'Mix J Input 17'
 209 'Mix J Input 18'
 210 'Mixer Input 01', ENUM
 211 'Mixer Input 02', ENUM
 212 'Mixer Input 03', ENUM
 213 'Mixer Input 04', ENUM
 214 'Mixer Input 05', ENUM
 215 'Mixer Input 06', ENUM
 216 'Mixer Input 07', ENUM
 217 'Mixer Input 08', ENUM
 218 'Mixer Input 09', ENUM
 219 'Mixer Input 10', ENUM
 220 'Mixer Input 11', ENUM
 221 'Mixer Input 12', ENUM
 222 'Mixer Input 13', ENUM
 223 'Mixer Input 14', ENUM
 224 'Mixer Input 15', ENUM
 225 'Mixer Input 16', ENUM
 226 'Mixer Input 17', ENUM
 227 'Mixer Input 18', ENUM
 228 'Analogue Output 01', ENUM
 229 'Analogue Output 02', ENUM
 230 'Analogue Output 03', ENUM
 231 'Analogue Output 04', ENUM
 232 'Analogue Output 05', ENUM
 233 'Analogue Output 06', ENUM
 234 'Clock Source Clock Source', ENUM
 235 'S/PDIF Output 1', ENUM
 236 'S/PDIF Output 2', ENUM
CMP -2
--- Device: Scarlett 18i8 USB
Matrix: in=18, out=10, off=30, stride=10
Matrix: input-select=210, select-stride=1
Inputs: ins=18 select-offset=0
Masters: n_mst=0 n_out-select=8
Switches: n_pad=4, n_hiz=2
hiz_map = {24, 26, };
pad_map = {25, 27, 28, 29, };
out_gain_map = {18, 19, 20, 21, 22, 23, -1, -1, -1, -1, };
out_gain_labels = {Monitor L, Monitor R, Headphones 1 L, Headphones 1 R, Headphones 2 L, Headphones, S/PDIF, S/PDIF, , , };
out_bus_map = {228, 229, 230, 231, 232, 233, 235, 236, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
---
--- Device: Scarlett 18i8 USB
Matrix: in=18, out=8, off=40, stride=9
Matrix: input-select=39, select-stride=9
Inputs: ins=18 select-offset=20
Masters: n_mst=4 n_out-select=8
Switches: n_pad=4, n_hiz=2
hiz_map = {15, 17, };
pad_map = {16, 18, 19, 20, };
out_gain_map = {1, 4, 7, 10, -1, -1, -1, -1, -1, -1, };
out_gain_labels = {Monitor, Headphone 1, Headphone 2, SPDIF, , , , , , , };
out_bus_map = {2, 3, 5, 6, 8, 9, 11, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
---
Using autodetected mapping.
caught signal - shutting down.

The GUI looks as follows: image

The labels for the rightmost three outputs should be Headphone 2 R, S/PDIF, S/PDIF I think

x42 commented 4 years ago

OK, so there's a bit of a layout problem with the output assigns, but it now works in general?

Comparing this to https://github.com/x42/scarlett-mixer#screenshot the 8 L/R assigns should be grouped below the 4 output knobs (Monitor, Headphones 1,2).

david0 commented 4 years ago

Yes it works in general. Besides the layout, it would be nice if the "Source" column would be filled with something useful by default (all set to Off after starting). Also I think it would be better to use combo boxes. Its a little bit annoying to use these spin boxes with 40+ entries not knowing what comes next.

JCruk commented 4 years ago

Where can I get the driver? I didn't have a scarlett.conf in /etc/modprobe.d/, so I created one, but still get the same segfault core dump

Autodetect: Using "hw:3"
Device `Scarlett 18i20 USB' has 260 contols: 
 0 'Master HW'
 1 'PCM 01', ENUM
 2 'PCM 02', ENUM
 3 'PCM 03', ENUM
 4 'PCM 04', ENUM
 5 'PCM 05', ENUM
 6 'PCM 06', ENUM
 7 'PCM 07', ENUM
 8 'PCM 08', ENUM
 9 'PCM 09', ENUM
 10 'PCM 10', ENUM
 11 'PCM 11', ENUM
 12 'PCM 12', ENUM
 13 'PCM 13', ENUM
 14 'PCM 14', ENUM
 15 'PCM 15', ENUM
 16 'PCM 16', ENUM
 17 'PCM 17', ENUM
 18 'PCM 18', ENUM
 19 'Line 01 (Monitor L)'
 20 'Line 02 (Monitor R)'
 21 'Line 03'
 22 'Line 04'
 23 'Line 05'
 24 'Line 06'
 25 'Line 07 (Headphones 1 L)'
 26 'Line 08 (Headphones 1 R)'
 27 'Line 09 (Headphones 2 L)'
 28 'Line 10 (Headphones 2 R)'
 29 'Line Out 01 Volume Control', ENUM
 30 'Line Out 02 Volume Control', ENUM
 31 'Line Out 03 Volume Control', ENUM
 32 'Line Out 04 Volume Control', ENUM
 33 'Line Out 05 Volume Control', ENUM
 34 'Line Out 06 Volume Control', ENUM
 35 'Line Out 07 Volume Control', ENUM
 36 'Line Out 08 Volume Control', ENUM
 37 'Line Out 09 Volume Control', ENUM
 38 'Line Out 10 Volume Control', ENUM
 39 'Mix A Input 01'
 40 'Mix A Input 02'
 41 'Mix A Input 03'
 42 'Mix A Input 04'
 43 'Mix A Input 05'
 44 'Mix A Input 06'
 45 'Mix A Input 07'
 46 'Mix A Input 08'
 47 'Mix A Input 09'
 48 'Mix A Input 10'
 49 'Mix A Input 11'
 50 'Mix A Input 12'
 51 'Mix A Input 13'
 52 'Mix A Input 14'
 53 'Mix A Input 15'
 54 'Mix A Input 16'
 55 'Mix A Input 17'
 56 'Mix A Input 18'
 57 'Mix B Input 01'
 58 'Mix B Input 02'
 59 'Mix B Input 03'
 60 'Mix B Input 04'
 61 'Mix B Input 05'
 62 'Mix B Input 06'
 63 'Mix B Input 07'
 64 'Mix B Input 08'
 65 'Mix B Input 09'
 66 'Mix B Input 10'
 67 'Mix B Input 11'
 68 'Mix B Input 12'
 69 'Mix B Input 13'
 70 'Mix B Input 14'
 71 'Mix B Input 15'
 72 'Mix B Input 16'
 73 'Mix B Input 17'
 74 'Mix B Input 18'
 75 'Mix C Input 01'
 76 'Mix C Input 02'
 77 'Mix C Input 03'
 78 'Mix C Input 04'
 79 'Mix C Input 05'
 80 'Mix C Input 06'
 81 'Mix C Input 07'
 82 'Mix C Input 08'
 83 'Mix C Input 09'
 84 'Mix C Input 10'
 85 'Mix C Input 11'
 86 'Mix C Input 12'
 87 'Mix C Input 13'
 88 'Mix C Input 14'
 89 'Mix C Input 15'
 90 'Mix C Input 16'
 91 'Mix C Input 17'
 92 'Mix C Input 18'
 93 'Mix D Input 01'
 94 'Mix D Input 02'
 95 'Mix D Input 03'
 96 'Mix D Input 04'
 97 'Mix D Input 05'
 98 'Mix D Input 06'
 99 'Mix D Input 07'
 100 'Mix D Input 08'
 101 'Mix D Input 09'
 102 'Mix D Input 10'
 103 'Mix D Input 11'
 104 'Mix D Input 12'
 105 'Mix D Input 13'
 106 'Mix D Input 14'
 107 'Mix D Input 15'
 108 'Mix D Input 16'
 109 'Mix D Input 17'
 110 'Mix D Input 18'
 111 'Mix E Input 01'
 112 'Mix E Input 02'
 113 'Mix E Input 03'
 114 'Mix E Input 04'
 115 'Mix E Input 05'
 116 'Mix E Input 06'
 117 'Mix E Input 07'
 118 'Mix E Input 08'
 119 'Mix E Input 09'
 120 'Mix E Input 10'
 121 'Mix E Input 11'
 122 'Mix E Input 12'
 123 'Mix E Input 13'
 124 'Mix E Input 14'
 125 'Mix E Input 15'
 126 'Mix E Input 16'
 127 'Mix E Input 17'
 128 'Mix E Input 18'
 129 'Mix F Input 01'
 130 'Mix F Input 02'
 131 'Mix F Input 03'
 132 'Mix F Input 04'
 133 'Mix F Input 05'
 134 'Mix F Input 06'
 135 'Mix F Input 07'
 136 'Mix F Input 08'
 137 'Mix F Input 09'
 138 'Mix F Input 10'
 139 'Mix F Input 11'
 140 'Mix F Input 12'
 141 'Mix F Input 13'
 142 'Mix F Input 14'
 143 'Mix F Input 15'
 144 'Mix F Input 16'
 145 'Mix F Input 17'
 146 'Mix F Input 18'
 147 'Mix G Input 01'
 148 'Mix G Input 02'
 149 'Mix G Input 03'
 150 'Mix G Input 04'
 151 'Mix G Input 05'
 152 'Mix G Input 06'
 153 'Mix G Input 07'
 154 'Mix G Input 08'
 155 'Mix G Input 09'
 156 'Mix G Input 10'
 157 'Mix G Input 11'
 158 'Mix G Input 12'
 159 'Mix G Input 13'
 160 'Mix G Input 14'
 161 'Mix G Input 15'
 162 'Mix G Input 16'
 163 'Mix G Input 17'
 164 'Mix G Input 18'
 165 'Mix H Input 01'
 166 'Mix H Input 02'
 167 'Mix H Input 03'
 168 'Mix H Input 04'
 169 'Mix H Input 05'
 170 'Mix H Input 06'
 171 'Mix H Input 07'
 172 'Mix H Input 08'
 173 'Mix H Input 09'
 174 'Mix H Input 10'
 175 'Mix H Input 11'
 176 'Mix H Input 12'
 177 'Mix H Input 13'
 178 'Mix H Input 14'
 179 'Mix H Input 15'
 180 'Mix H Input 16'
 181 'Mix H Input 17'
 182 'Mix H Input 18'
 183 'Mix I Input 01'
 184 'Mix I Input 02'
 185 'Mix I Input 03'
 186 'Mix I Input 04'
 187 'Mix I Input 05'
 188 'Mix I Input 06'
 189 'Mix I Input 07'
 190 'Mix I Input 08'
 191 'Mix I Input 09'
 192 'Mix I Input 10'
 193 'Mix I Input 11'
 194 'Mix I Input 12'
 195 'Mix I Input 13'
 196 'Mix I Input 14'
 197 'Mix I Input 15'
 198 'Mix I Input 16'
 199 'Mix I Input 17'
 200 'Mix I Input 18'
 201 'Mix J Input 01'
 202 'Mix J Input 02'
 203 'Mix J Input 03'
 204 'Mix J Input 04'
 205 'Mix J Input 05'
 206 'Mix J Input 06'
 207 'Mix J Input 07'
 208 'Mix J Input 08'
 209 'Mix J Input 09'
 210 'Mix J Input 10'
 211 'Mix J Input 11'
 212 'Mix J Input 12'
 213 'Mix J Input 13'
 214 'Mix J Input 14'
 215 'Mix J Input 15'
 216 'Mix J Input 16'
 217 'Mix J Input 17'
 218 'Mix J Input 18'
 219 'Mixer Input 01', ENUM
 220 'Mixer Input 02', ENUM
 221 'Mixer Input 03', ENUM
 222 'Mixer Input 04', ENUM
 223 'Mixer Input 05', ENUM
 224 'Mixer Input 06', ENUM
 225 'Mixer Input 07', ENUM
 226 'Mixer Input 08', ENUM
 227 'Mixer Input 09', ENUM
 228 'Mixer Input 10', ENUM
 229 'Mixer Input 11', ENUM
 230 'Mixer Input 12', ENUM
 231 'Mixer Input 13', ENUM
 232 'Mixer Input 14', ENUM
 233 'Mixer Input 15', ENUM
 234 'Mixer Input 16', ENUM
 235 'Mixer Input 17', ENUM
 236 'Mixer Input 18', ENUM
 237 'ADAT Output 1', ENUM
 238 'ADAT Output 2', ENUM
 239 'ADAT Output 3', ENUM
 240 'ADAT Output 4', ENUM
 241 'ADAT Output 5', ENUM
 242 'ADAT Output 6', ENUM
 243 'ADAT Output 7', ENUM
 244 'ADAT Output 8', ENUM
 245 'Analogue Output 01', ENUM
 246 'Analogue Output 02', ENUM
 247 'Analogue Output 03', ENUM
 248 'Analogue Output 04', ENUM
 249 'Analogue Output 05', ENUM
 250 'Analogue Output 06', ENUM
 251 'Analogue Output 07', ENUM
 252 'Analogue Output 08', ENUM
 253 'Analogue Output 09', ENUM
 254 'Analogue Output 10', ENUM
 255 'Clock Source Clock Source', ENUM
 256 'Dim', PBS
 257 'Mute', PBS
 258 'S/PDIF Output 1', ENUM
 259 'S/PDIF Output 2', ENUM
CMP 18
--- Device: Scarlett 18i20 USB
Matrix: in=0, out=0, off=0, stride=0
Matrix: input-select=0, select-stride=0
Inputs: ins=0 select-offset=0
Masters: n_mst=0 n_out-select=0
Switches: n_pad=0, n_hiz=0
hiz_map = {-1, -1, };
pad_map = {-1, -1, -1, -1, };
out_gain_map = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
out_gain_labels = {, , , , , , , , , , };
out_bus_map = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
---
--- Device: Scarlett 18i20 USB
Matrix: in=18, out=8, off=50, stride=9
Matrix: input-select=49, select-stride=9
Inputs: ins=18 select-offset=31
Masters: n_mst=10 n_out-select=20
Switches: n_pad=0, n_hiz=0
hiz_map = {-1, -1, };
pad_map = {-1, -1, -1, -1, };
out_gain_map = {1, 7, 10, 13, 16, 19, 22, 25, 28, 2, };
out_gain_labels = {Monitor, Line 3/4, Line 5/6, Line 7/8, Line 9/10, SPDIF, ADAT 1/2, ADAT 3/4, ADAT 5/6, ADAT 7/8, };
out_bus_map = {5, 6, 8, 9, 11, 12, 14, 15, 17, 18, 20, 21, 23, 24, 26, 27, 29, 30, 3, 4, };
---
scarlett-mixer: ./src/scarlett_mixer.c:603: get_enum: Assertion `snd_mixer_selem_is_enumerated (c->elem)' failed.
Aborted (core dumped)
david0 commented 3 years ago

The driver is the one that is build-in into the the kernel. Since you see all these outputs it seems to be a different problem than I had, maybe because you have the 18i20 and I have 18i8.

battlemaul commented 3 years ago

When you edit /etc/modprobe.d/scarlett.conf you have to insert the right device id (i my case it's 8204)

lsusb | grep Focusrite Bus 003 Device 003: ID 1235:8204 Focusrite-Novation Scarlett 18i8 2nd Gen

sudo nano /etc/modprobe.d/scarlett.conf and insert : options snd_usb_audio vid=0x1235 pid=0x8204 device_setup=1,1,1,1

JCruk commented 2 years ago

I've tried many different configurations for a 2nd gen 18i20

sudo nano /etc/modprobe.d/scarlett.conf and insert : options snd_usb_audio vid=0x1235 pid=0x8204 device_setup=1,1,1,1

to

sudo nano /etc/modprobe.d/scarlett.conf and insert : options snd_usb_audio vid=0x1235 pid=0x8204 device_setup=1,1,1,1,1,1,1,1,1

but I always end up with a dump: scarlett-mixer: ./src/scarlett_mixer.c:603: get_enum: Assertionsnd_mixer_selem_is_enumerated (c->elem)' failed.`

aclark4life commented 2 years ago

@JCruk Can't tell from your comment if you confirmed the scarlett is enabled before running the mixer e.g.

dmesg | grep -i -A 5 -B 5 scarlett

Via https://askubuntu.com/questions/1393120/how-to-enable-focusrite-scarlett-4i4-gen3-mixer-on-ubuntu-studio-20-04-3.

And if not enabled, make sure kernel >= 5.14 else you'll need to compile kernel module from https://github.com/Focusrite-Scarlett-on-Linux

Assuming everything above for gen3 applies to gen2 too ... :shrug:

JCruk commented 2 years ago

Thanks! @aclark4life

Here's my output:

dmesg | grep -i -A 5 -B 5 scarlett
[    3.028849] sd 4:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    3.032867] usb 1-2: not running at top speed; connect to a high speed hub
[    3.035015] ata6.00: configured for UDMA/133
[    3.040890] usb 7-1: New USB device found, idVendor=1235, idProduct=8201, bcdDevice= 6.75
[    3.040895] usb 7-1: New USB device strings: Mfr=1, Product=3, SerialNumber=2
[    3.040898] usb 7-1: Product: Scarlett 18i20 USB
[    3.040900] usb 7-1: Manufacturer: Focusrite
[    3.040902] usb 7-1: SerialNumber: 03015800
[    3.042533] usb 3-6: New USB device found, idVendor=05e3, idProduct=0608, bcdDevice=85.36
[    3.042537] usb 3-6: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[    3.042539] usb 3-6: Product: USB2.0 Hub

[    5.776736] bpfilter: Loaded bpfilter_umh pid 1248
[    5.776845] Started bpfilter
[    6.005639] VBoxNetFlt: Successfully started.
[    6.007247] VBoxNetAdp: Successfully started.
[    6.264072] loop19: detected capacity change from 0 to 8
[    8.293772] usb 7-1: Focusrite Scarlett Gen 2/3 Mixer Driver enabled pid=0x8201
[    8.451605] usb 1-3.4: 1:3 : unsupported format bits 0x100000000
[    8.539818] usbcore: registered new interface driver snd-usb-audio
[    8.680614] igb 0000:04:00.0 enp4s0: igb: enp4s0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
[    8.788301] IPv6: ADDRCONF(NETDEV_CHANGE): enp4s0: link becomes ready
[    8.820939] FS-Cache: Loaded

I have the module installed, I think:

My config is: options snd_usb_audio vid=0x1235 pid=0x8201 device_setup=1

$ ./scarlett-mixer -vv --print-controls
* hw:0 "HDA NVidia"
* hw:1 "Scarlett 18i20 USB"
Autodetect: Using "hw:1"
Device `Scarlett 18i20 USB' has 271 contols: 
 0 'Master HW'
 1 'PCM 01', ENUM
 2 'PCM 02', ENUM
 3 'PCM 03', ENUM
 4 'PCM 04', ENUM
 5 'PCM 05', ENUM
 6 'PCM 06', ENUM
 7 'PCM 07', ENUM
 8 'PCM 08', ENUM
 9 'PCM 09', ENUM
 10 'PCM 10', ENUM
 11 'PCM 11', ENUM
 12 'PCM 12', ENUM
 13 'PCM 13', ENUM
 14 'PCM 14', ENUM
 15 'PCM 15', ENUM
 16 'PCM 16', ENUM
 17 'PCM 17', ENUM
 18 'PCM 18', ENUM
 19 'Line 01 (Monitor L)'
 20 'Line 01 Mute', PBS
 21 'Line 02 (Monitor R)'
 22 'Line 02 Mute', PBS
 23 'Line 03'
 24 'Line 03 Mute', PBS
 25 'Line 04'
 26 'Line 04 Mute', PBS
 27 'Line 05'
 28 'Line 05 Mute', PBS
 29 'Line 06'
 30 'Line 06 Mute', PBS
 31 'Line 07 (Headphones 1 L)'
 32 'Line 07 Mute', PBS
 33 'Line 08 (Headphones 1 R)'
 34 'Line 08 Mute', PBS
 35 'Line 09 (Headphones 2 L)'
 36 'Line 09 Mute', PBS
 37 'Line 10 (Headphones 2 R)'
 38 'Line 10 Mute', PBS
 39 'Line Out 01 Volume Control', ENUM
 40 'Line Out 02 Volume Control', ENUM
 41 'Line Out 03 Volume Control', ENUM
 42 'Line Out 04 Volume Control', ENUM
 43 'Line Out 05 Volume Control', ENUM
 44 'Line Out 06 Volume Control', ENUM
 45 'Line Out 07 Volume Control', ENUM
 46 'Line Out 08 Volume Control', ENUM
 47 'Line Out 09 Volume Control', ENUM
 48 'Line Out 10 Volume Control', ENUM
 49 'Mix A Input 01'
 50 'Mix A Input 02'
 51 'Mix A Input 03'
 52 'Mix A Input 04'
 53 'Mix A Input 05'
 54 'Mix A Input 06'
 55 'Mix A Input 07'
 56 'Mix A Input 08'
 57 'Mix A Input 09'
 58 'Mix A Input 10'
 59 'Mix A Input 11'
 60 'Mix A Input 12'
 61 'Mix A Input 13'
 62 'Mix A Input 14'
 63 'Mix A Input 15'
 64 'Mix A Input 16'
 65 'Mix A Input 17'
 66 'Mix A Input 18'
 67 'Mix B Input 01'
 68 'Mix B Input 02'
 69 'Mix B Input 03'
 70 'Mix B Input 04'
 71 'Mix B Input 05'
 72 'Mix B Input 06'
 73 'Mix B Input 07'
 74 'Mix B Input 08'
 75 'Mix B Input 09'
 76 'Mix B Input 10'
 77 'Mix B Input 11'
 78 'Mix B Input 12'
 79 'Mix B Input 13'
 80 'Mix B Input 14'
 81 'Mix B Input 15'
 82 'Mix B Input 16'
 83 'Mix B Input 17'
 84 'Mix B Input 18'
 85 'Mix C Input 01'
 86 'Mix C Input 02'
 87 'Mix C Input 03'
 88 'Mix C Input 04'
 89 'Mix C Input 05'
 90 'Mix C Input 06'
 91 'Mix C Input 07'
 92 'Mix C Input 08'
 93 'Mix C Input 09'
 94 'Mix C Input 10'
 95 'Mix C Input 11'
 96 'Mix C Input 12'
 97 'Mix C Input 13'
 98 'Mix C Input 14'
 99 'Mix C Input 15'
 100 'Mix C Input 16'
 101 'Mix C Input 17'
 102 'Mix C Input 18'
 103 'Mix D Input 01'
 104 'Mix D Input 02'
 105 'Mix D Input 03'
 106 'Mix D Input 04'
 107 'Mix D Input 05'
 108 'Mix D Input 06'
 109 'Mix D Input 07'
 110 'Mix D Input 08'
 111 'Mix D Input 09'
 112 'Mix D Input 10'
 113 'Mix D Input 11'
 114 'Mix D Input 12'
 115 'Mix D Input 13'
 116 'Mix D Input 14'
 117 'Mix D Input 15'
 118 'Mix D Input 16'
 119 'Mix D Input 17'
 120 'Mix D Input 18'
 121 'Mix E Input 01'
 122 'Mix E Input 02'
 123 'Mix E Input 03'
 124 'Mix E Input 04'
 125 'Mix E Input 05'
 126 'Mix E Input 06'
 127 'Mix E Input 07'
 128 'Mix E Input 08'
 129 'Mix E Input 09'
 130 'Mix E Input 10'
 131 'Mix E Input 11'
 132 'Mix E Input 12'
 133 'Mix E Input 13'
 134 'Mix E Input 14'
 135 'Mix E Input 15'
 136 'Mix E Input 16'
 137 'Mix E Input 17'
 138 'Mix E Input 18'
 139 'Mix F Input 01'
 140 'Mix F Input 02'
 141 'Mix F Input 03'
 142 'Mix F Input 04'
 143 'Mix F Input 05'
 144 'Mix F Input 06'
 145 'Mix F Input 07'
 146 'Mix F Input 08'
 147 'Mix F Input 09'
 148 'Mix F Input 10'
 149 'Mix F Input 11'
 150 'Mix F Input 12'
 151 'Mix F Input 13'
 152 'Mix F Input 14'
 153 'Mix F Input 15'
 154 'Mix F Input 16'
 155 'Mix F Input 17'
 156 'Mix F Input 18'
 157 'Mix G Input 01'
 158 'Mix G Input 02'
 159 'Mix G Input 03'
 160 'Mix G Input 04'
 161 'Mix G Input 05'
 162 'Mix G Input 06'
 163 'Mix G Input 07'
 164 'Mix G Input 08'
 165 'Mix G Input 09'
 166 'Mix G Input 10'
 167 'Mix G Input 11'
 168 'Mix G Input 12'
 169 'Mix G Input 13'
 170 'Mix G Input 14'
 171 'Mix G Input 15'
 172 'Mix G Input 16'
 173 'Mix G Input 17'
 174 'Mix G Input 18'
 175 'Mix H Input 01'
 176 'Mix H Input 02'
 177 'Mix H Input 03'
 178 'Mix H Input 04'
 179 'Mix H Input 05'
 180 'Mix H Input 06'
 181 'Mix H Input 07'
 182 'Mix H Input 08'
 183 'Mix H Input 09'
 184 'Mix H Input 10'
 185 'Mix H Input 11'
 186 'Mix H Input 12'
 187 'Mix H Input 13'
 188 'Mix H Input 14'
 189 'Mix H Input 15'
 190 'Mix H Input 16'
 191 'Mix H Input 17'
 192 'Mix H Input 18'
 193 'Mix I Input 01'
 194 'Mix I Input 02'
 195 'Mix I Input 03'
 196 'Mix I Input 04'
 197 'Mix I Input 05'
 198 'Mix I Input 06'
 199 'Mix I Input 07'
 200 'Mix I Input 08'
 201 'Mix I Input 09'
 202 'Mix I Input 10'
 203 'Mix I Input 11'
 204 'Mix I Input 12'
 205 'Mix I Input 13'
 206 'Mix I Input 14'
 207 'Mix I Input 15'
 208 'Mix I Input 16'
 209 'Mix I Input 17'
 210 'Mix I Input 18'
 211 'Mix J Input 01'
 212 'Mix J Input 02'
 213 'Mix J Input 03'
 214 'Mix J Input 04'
 215 'Mix J Input 05'
 216 'Mix J Input 06'
 217 'Mix J Input 07'
 218 'Mix J Input 08'
 219 'Mix J Input 09'
 220 'Mix J Input 10'
 221 'Mix J Input 11'
 222 'Mix J Input 12'
 223 'Mix J Input 13'
 224 'Mix J Input 14'
 225 'Mix J Input 15'
 226 'Mix J Input 16'
 227 'Mix J Input 17'
 228 'Mix J Input 18'
 229 'Mixer Input 01', ENUM
 230 'Mixer Input 02', ENUM
 231 'Mixer Input 03', ENUM
 232 'Mixer Input 04', ENUM
 233 'Mixer Input 05', ENUM
 234 'Mixer Input 06', ENUM
 235 'Mixer Input 07', ENUM
 236 'Mixer Input 08', ENUM
 237 'Mixer Input 09', ENUM
 238 'Mixer Input 10', ENUM
 239 'Mixer Input 11', ENUM
 240 'Mixer Input 12', ENUM
 241 'Mixer Input 13', ENUM
 242 'Mixer Input 14', ENUM
 243 'Mixer Input 15', ENUM
 244 'Mixer Input 16', ENUM
 245 'Mixer Input 17', ENUM
 246 'Mixer Input 18', ENUM
 247 'ADAT Output 1', ENUM
 248 'ADAT Output 2', ENUM
 249 'ADAT Output 3', ENUM
 250 'ADAT Output 4', ENUM
 251 'ADAT Output 5', ENUM
 252 'ADAT Output 6', ENUM
 253 'ADAT Output 7', ENUM
 254 'ADAT Output 8', ENUM
 255 'Analogue Output 01', ENUM
 256 'Analogue Output 02', ENUM
 257 'Analogue Output 03', ENUM
 258 'Analogue Output 04', ENUM
 259 'Analogue Output 05', ENUM
 260 'Analogue Output 06', ENUM
 261 'Analogue Output 07', ENUM
 262 'Analogue Output 08', ENUM
 263 'Analogue Output 09', ENUM
 264 'Analogue Output 10', ENUM
 265 'Clock Source Clock Source', ENUM
 266 'Dim', PBS
 267 'Mute', PBS
 268 'S/PDIF Output 1', ENUM
 269 'S/PDIF Output 2', ENUM
 270 'Sync Status', ENUM
CMP 18
--- Device: Scarlett 18i20 USB
Matrix: in=0, out=0, off=0, stride=0
Matrix: input-select=0, select-stride=0
Inputs: ins=0 select-offset=0
Masters: n_mst=0 n_out-select=0
Switches: n_pad=0, n_hiz=0
hiz_map = {-1, -1, };
pad_map = {-1, -1, -1, -1, };
out_gain_map = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
out_gain_labels = {, , , , , , , , , , };
out_bus_map = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
Device: Scarlett 18i20 USB
Matrix: in=18, out=8, off=50, stride=9
Matrix: input-select=49, select-stride=9
Inputs: ins=18 select-offset=31
Masters: n_mst=10 n_out-select=20
Switches: n_pad=0, n_hiz=0
hiz_map = {-1, -1, };
pad_map = {-1, -1, -1, -1, };
out_gain_map = {1, 7, 10, 13, 16, 19, 22, 25, 28, 2, };
out_gain_labels = {Monitor, Line 3/4, Line 5/6, Line 7/8, Line 9/10, SPDIF, ADAT 1/2, ADAT 3/4, ADAT 5/6, ADAT 7/8, };
out_bus_map = {5, 6, 8, 9, 11, 12, 14, 15, 17, 18, 20, 21, 23, 24, 26, 27, 29, 30, 3, 4, };
---
scarlett-mixer: ./src/scarlett_mixer.c:603: get_enum: Assertion `snd_mixer_selem_is_enumerated (c->elem)' failed.
Aborted (core dumped)
Justin-Hoffman commented 1 year ago

I have an 18i20 gen 3 ( vid=0x1235 pid=0x8215 ) that seems to have similar issues to the 18i8 gen2.

Initially I was segfaulting when loading mixer controls because, as with the gen2, I needed to first enable the mixer driver via modprobe options.

I'm now segfaulting when setting up high-z UI elements (I think the Pango warning is irrelevant, I'm on Fedora 37 workstation):

`$ ./scarlett-mixer

(process:6537): Pango-WARNING **: 10:39:35.343: Invalid UTF-8 string passed to pango_layout_set_text()

(process:6537): Pango-WARNING **: 10:39:35.346: Invalid UTF-8 string passed to pango_layout_set_text() Segmentation fault (core dumped) `

The backtrace was:

`#0 0x0000000000421139 in get_enum (c=0x6c65ddb00) at ./src/scarlett_mixer.c:737

1 0x00000000004254d7 in toplevel (ui=0x4596e0, top=0x458e30) at ./src/scarlett_mixer.c:1383

2 0x0000000000426615 in instantiate (ui_toplevel=0x458e30, descriptor=0x42d900 , plugin_uri=0x42c0ed "URI TODO", bundle_path=0x0, write_function=0x0, controller=0x0, widget=0x458ed8, features=0x7fffffffd9d0) at ./src/scarlett_mixer.c:1708

3 0x000000000042a25c in gl_instantiate (descriptor=0x42d900 , plugin_uri=0x42c0ed "URI TODO", bundle_path=0x0, write_function=0x0, controller=0x0, widget=0x436030 , features=0x7fffffffd9d0) at robtk/ui_gl.c:1490

4 0x0000000000404fe6 in main (argc=1, argv=0x7fffffffdb58) at robtk/robtkapp.c:218

`

Line 737 is an assert:

assert (snd_mixer_selem_is_enumerated (c->elem));

I can't dereference c:

(gdb) p *c Cannot access memory at address 0x6c65ddb00

That address is the result of a call to hiz(ui, i) at the call line of the outer function, line 1383:

robtk_cbtn_set_active (ui->btn_hiz[i], get_enum (hiz (ui, i)) == 1);

I have little experience with robtk and/or the mixer driver and I'm not sure where the fault is here but I'll see if I can drill down further later this week.

Justin-Hoffman commented 1 year ago

The issue is that the controls mapping for earlier generations isn't compatible with the later generation devices (18i20 gen2 appears to have 260 controls per above, the 3rd gen has 436) and any alsa API calls requesting controls by index when using an incorrect mapping return unexpected control types. Reading many other issues here on github I realize that this probably the root problem for a half dozen of them (control mapping from older generation hardware used with newer hardware).

The issue I encounter when writing a patch to fix this is that we identify the configuration by comparing the card name returned from ALSA: const char* card_name = snd_ctl_card_info_get_name (card_info); ..then a few lines later... for (unsigned i = 0; i < NUM_DEVICES; i++) { if (!strcmp (card_name, devices[i].name)) ui->device = &devices[i]; }

The card name reported by ALSA seems to be the same for any 18i20 across all three generations, but the control configuration is incompatible amongst these generations. If we put together the mapping for gen2/gen3 devices, we would need to use a different or additional method to identify the card in a way that discriminates between hardware across generations.

@x42 - Would you accept a patch that adds a mechanism to further differentiate between generations of hardware that report the same name from the ALSA api? I believe I could work this out by reading /sys/class/sound/card[device_number]/device/modalias to pick out the vendor and device IDs, but I would need to dig these up for each supported device.