[alsa-devel] Line6 Helix - usb compliant but not working correct - followup

Jens Verwiebe info at jensverwiebe.de
Thu Dec 14 20:00:06 CET 2017


Hi, me again

In between i got the line6 helix working fine with a hack, which is to 
set an arbitray rate i have readout from another interface on the same 
bus. This works reliable so far, no more clicks, no xruns over several 
hours. There must be som magic to get the true usbrate from this device, 
but i did no fond a way yet, so my hack is more something unique for my 
working situation.

I also tried to get the implicite feeback from the capture interface to 
the pb interface to get a proper sync_ep, but still the rate is plain stiff.

Another problem is the mixer, which should be a plain passthrough. Cause 
ctrl interface is somewhat broken pure alsa does not work, but jack can 
create the device just fine.

I attach below the lsusb dump from the helix + my hack and the resulting 
working proc for further investigation.

Any ideas and voodoo is welcome.

Cheers ... Jens



Am 29.11.2017 um 16:24 schrieb Jens Verwiebe:
> Hi,, yeah thx for looking into it.
>
> TBH i tried all kinda stuff already and also am able to compare all 
> logs with a Focusrite Scarlett 6i6, which shows
>
> almost exactly same outputs but works just fine. This makes me clueless.
>
> I also investigated if this could be a firmware bug, but then it would 
> not work on osx either, no ?
>
> Something new i found: if i capture from helix and play this file with 
> scarlett all is fine. So it seems to be something
> with out-of-sync playback only.
>
>
> Am 29.11.2017 um 15:51 schrieb Jorge:
>>
>>
>> On 29/11/17 13:26, Jens Verwiebe wrote:
>>> Hi folks
>>>
>>> I recently got a Line6 Helix LT which can work usb compliant for 
>>> example on
>>
>> Interesting. I would like to try the Helix in Linux too. I have seen 
>> similar issues when fiddling with
>> set_sample_rate. Some comments/ideas below.
>>
>>>
>>> OSX or IOS. No driver is needed but the samplerate is fixed to 48000 
>>> ( which is okay for the first ).
>>>
>>> Now i expected this device to work ootb in alsa, which turned out to 
>>> be half the truth.
>>>
>>> Connecting the device threw " usb 7-2: 
>>> parse_audio_format_rates_v2(): unable to retrieve number of sample 
>>> rates (clock 16)"
>>>
>>> so i investigated a bit and found this workaround:
>>>
>>> --- 
>>> "/media/Workdata3/Development/kernel_lowlat_4.4-97/linux-4.4.97/sound/usb/clock 
>>> (Kopie).c"    2017-11-08 10:06:31.000000000 +0100
>>> +++ 
>>> /media/Workdata3/Development/kernel_lowlat_4.4-97/linux-4.4.97/sound/usb/clock.c 
>>> 2017-11-14 23:06:51.750924051 +0100
>>> @@ -361,6 +361,13 @@ static int set_sample_rate_v2(struct snd
>>>      struct uac_clock_source_descriptor *cs_desc;
>>>
>>>      clock = snd_usb_clock_find_source(chip, fmt->clock, true);
>>> +        /*
>>> +         * Line6 HELIX does not respond to sample rate
>>> +         * set requests. The only valid rate is 48000.
>>> +         */
>>> +        if (chip->usb_id == USB_ID(0x0e41, 0x4244) && rate == 48000)
>>> +            return 0;
>>> +
>>>      if (clock < 0)
>>>          return clock;
>>>
>>> --- 
>>> "/media/Workdata3/Development/kernel_lowlat_4.4-97/linux-4.4.97/sound/usb/format 
>>> (Kopie).c"    2017-11-08 10:06:31.000000000 +0100
>>> +++ 
>>> /media/Workdata3/Development/kernel_lowlat_4.4-97/linux-4.4.97/sound/usb/format.c 
>>> 2017-11-14 23:12:24.329766243 +0100
>>> @@ -293,6 +293,20 @@ static int parse_audio_format_rates_v2(s
>>>      int nr_triplets, data_size, ret = 0;
>>>      int clock = snd_usb_clock_find_source(chip, fp->clock, false);
>>>
>>> +    /*
>>> +    * Line6 HELIX does not respond to sample rate
>>> +    * query requests. The only valid rate is 48000.
>>> +    */
>>> +    if (chip->usb_id == USB_ID(0x0e41, 0x4244)) {
>>> +        fp->nr_rates = 1;
>>> +            fp->rate_min = 48000;
>>> +            fp->rate_max = 48000;
>>> +            fp->rates = SNDRV_PCM_RATE_48000;
>>> +            fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
>>> +            fp->rate_table[0] = 48000;
>>> +            return 0;
>>> +        }
>>> +
>>>      if (clock < 0) {
>>>          dev_err(&dev->dev,
>>>              "%s(): unable to find clock source (clock %d)\n",
>>>
>>>
>>> This trick made the device appear in aplay -l and /proc/asound just 
>>> as expected.
>>>
>>> [ 7988.495085] usb 7-2: new high-speed USB device number 4 using 
>>> xhci_hcd
>>> [ 7988.663622] usb 7-2: New USB device found, idVendor=0e41, 
>>> idProduct=4244
>>> [ 7988.663625] usb 7-2: New USB device strings: Mfr=1, Product=2, 
>>> SerialNumber=3
>>> [ 7988.663627] usb 7-2: Product: HELIX
>>> [ 7988.663629] usb 7-2: Manufacturer: LINE 6
>>> [ 7988.663630] usb 7-2: SerialNumber:    2744535
>>>
>>> But i ended up with sometimes occuring soft clicks in playback which 
>>> imply i have timing problems.
>>>
>>> Another symptom is aplay does not output any sound while not 
>>> throwing any error while in jack i can create the driver just fine.
>>
>> Have you tried debugging the pointer position with that device? Do 
>> you get sensible buffer sizes
>> with `-v` in aplay for 48KHz, 24 bits, etc?
> I get just this but silence ( while plughhw:1,0 == scarlett looks same 
> and plays sound ):
>
> aplay -D plughw:6,0 -vv test.wav
> Wiedergabe: WAVE 'test.wav' : Signed 16 bit Little Endian, Rate: 44100 
> Hz, stereo
> Plug PCM: Rate conversion PCM (48000, sformat=S16_LE)
> Converter: libspeex (builtin)
> Protocol version: 10002
> Its setup is:
>   stream       : PLAYBACK
>   access       : RW_INTERLEAVED
>   format       : S16_LE
>   subformat    : STD
>   channels     : 2
>   rate         : 44100
>   exact rate   : 44100 (44100/1)
>   msbits       : 16
>   buffer_size  : 22050
>   period_size  : 5512
>   period_time  : 125000
>   tstamp_mode  : NONE
>   period_step  : 1
>   avail_min    : 5512
>   period_event : 0
>   start_threshold  : 22050
>   stop_threshold   : 22050
>   silence_threshold: 0
>   silence_size : 0
>   boundary     : 6206523236469964800
> Slave: Route conversion PCM (sformat=S32_LE)
>   Transformation table:
>     0 <- 0
>     1 <- 1
>     2 <- none
>     3 <- none
>     4 <- none
>     5 <- none
>     6 <- none
>     7 <- none
> Its setup is:
>   stream       : PLAYBACK
>   access       : MMAP_INTERLEAVED
>   format       : S16_LE
>   subformat    : STD
>   channels     : 2
>   rate         : 48000
>   exact rate   : 48000 (48000/1)
>   msbits       : 16
>   buffer_size  : 24001
>   period_size  : 6000
>   period_time  : 125000
>   tstamp_mode  : NONE
>   period_step  : 1
>   avail_min    : 6000
>   period_event : 0
>   start_threshold  : 24000
>   stop_threshold   : 24001
>   silence_threshold: 0
>   silence_size : 0
>   boundary     : 6755680916032454656
> Slave: Hardware PCM card 6 'HELIX' device 0 subdevice 0
> Its setup is:
>   stream       : PLAYBACK
>   access       : MMAP_INTERLEAVED
>   format       : S32_LE
>   subformat    : STD
>   channels     : 8
>   rate         : 48000
>   exact rate   : 48000 (48000/1)
>   msbits       : 32
>   buffer_size  : 24001
>   period_size  : 6000
>   period_time  : 125000
>   tstamp_mode  : NONE
>   period_step  : 1
>   avail_min    : 6000
>   period_event : 0
>   start_threshold  : 24000
>   stop_threshold   : 24001
>   silence_threshold: 0
>   silence_size : 0
>   boundary     : 6755680916032454656
>   appl_ptr     : 0
>   hw_ptr       : 0
>
>
>>
>> I once ended up with really small buffers when I changed the usb 
>> audioformats for a fixed rate device
>> so there was not sound whatsoever even though all the devices were 
>> present. I am not sure whether
>> fp->rates should get SNDRV_PCM_RATE_CONTINUOUS either way and then 
>> min/max = 48KHz delimiting it.
>
> Tried this already, makes no difference.
>>
>> Jorge.
>>
>>>
>>> I would apreciate any hint what i could try out here.
>>>
>>>
>>> Greetings from Hamburg ... Jens
>>>
>>
>>
>
> My wisdom is at the end here ... Jens ;-)
>

-- 

Jens Verwiebe
Allerskehre 44 - 22309 Hamburg

Tel.: +49 40 68 78 50
mobile: +49 172 400 49 07
mailto: info at jensverwiebe.de
web: http://www.jensverwiebe.de

-------------- next part --------------
Bus 007 Device 003: ID 0e41:4244 Line6, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x0e41 Line6, Inc.
  idProduct          0x4244 
  bcdDevice            2.00
  iManufacturer           1 LINE 6
  iProduct                2 HELIX   
  iSerial                 3    2744535
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          275
    bNumInterfaces          5
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         1
      bInterfaceCount         3
      bFunctionClass          1 Audio
      bFunctionSubClass       0 
      bFunctionProtocol      32 
      iFunction               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              4 Msg Pipe
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol     32 
      iInterface              6 HELIX Audio
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               2.00
        bCategory              10
        wTotalLength           46
        bmControl            0x00
      AudioControl Interface Descriptor:
        bLength                 8
        bDescriptorType        36
        bDescriptorSubtype     10 (CLOCK_SOURCE)
        bClockID               16
        bmAttributes         0x01 Internal fixed Clock 
        bmControls           0x00
        bAssocTerminal          0
        iClockSource            0 
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID            32
        wTerminalType      0x0201 Microphone
        bAssocTerminal         64
        bCSourceID             16
        bNrChannels             8
        bmChannelConfig   0x00000000
        bmControls    0x0000
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            64
        wTerminalType      0x0301 Speaker
        bAssocTerminal         32
        bSourceID              32
        bCSourceID             16
        bmControls         0x0000
        iTerminal               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          32
        bmControls           0x00
        bFormatType             1
        bmFormats         0x00000001
          PCM
        bNrChannels             8
        bmChannelConfig   0x00000000
        iChannelNames           0 
      AudioStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bSubslotSize            4
        bBitResolution         24
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x00e0  1x 224 bytes
        bInterval               1
        AudioControl Endpoint Descriptor:
          bLength                 8
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bmControls           0x00
          bLockDelayUnits         0 Undefined
          wLockDelay              0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          64
        bmControls           0x00
        bFormatType             1
        bmFormats         0x00000001
          PCM
        bNrChannels             8
        bmChannelConfig   0x00000000
        iChannelNames           0 
      AudioStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bSubslotSize            4
        bBitResolution         24
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes           37
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Implicit feedback Data
        wMaxPacketSize     0x00e0  1x 224 bytes
        bInterval               1
        AudioControl Endpoint Descriptor:
          bLength                 8
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bmControls           0x00
          bLockDelayUnits         0 Undefined
          wLockDelay              0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 MIDI Streaming
      bInterfaceProtocol      0 
      iInterface              7 HELIX MIDI
      MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           61
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 2
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 3
        bNrInputPins            1
        baSourceID( 0)          2
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 4
        bNrInputPins            1
        baSourceID( 0)          1
        BaSourcePin( 0)         1
        iJack                   0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       3
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0001
  Self Powered
-------------- next part --------------
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 92e6918..d25986a 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -373,7 +373,6 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
     	if (chip->usb_id == USB_ID(0x0e41, 0x4244) && rate == 48000)
         	return 0;
 
-
 	if (clock < 0)
 		return clock;
 
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index c90607e..026095a 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -888,6 +888,8 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
 
 	if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL)
 		ep->freqn = get_usb_full_speed_rate(rate);
+	else if (USB_ID(0x0e41, 0x4244))
+		ep->freqn = get_usb_high_speed_rate(rate + 5); // ugly helix hack, readout from focusrite scarlett on same usbbus
 	else
 		ep->freqn = get_usb_high_speed_rate(rate);
 
diff --git a/sound/usb/format.c b/sound/usb/format.c
index 1c0107d..886089f 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -305,7 +305,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
 	if (chip->usb_id == USB_ID(0x0e41, 0x4244)) {
 		fp->nr_rates = 1;
         	fp->rate_min = 48000;
-        	fp->rate_max = 48000;
+	       	fp->rate_max = 48000;
         	fp->rates = SNDRV_PCM_RATE_48000;
         	fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
         	fp->rate_table[0] = 48000;

-------------- next part --------------
/proc/asound/HELIX/stream0:

LINE 6 HELIX at usb-0000:07:00.0-2, high speed : USB Audio

Playback:
  Status: Running
    Interface = 2
    Altset = 1
    Packet Size = 224
    Momentary freq = 48005 Hz (0x6.0029)
  Interface 2
    Altset 1
    Format: S32_LE
    Channels: 8
    Endpoint: 3 OUT (ASYNC)
    Rates: 48000
    Data packet interval: 125 us

Capture:
  Status: Running
    Interface = 3
    Altset = 1
    Packet Size = 224
    Momentary freq = 48005 Hz (0x6.0029)
  Interface 3
    Altset 1
    Format: S32_LE
    Channels: 8
    Endpoint: 3 IN (ASYNC)
    Rates: 48000
    Data packet interval: 125 us



More information about the Alsa-devel mailing list