Bug 195223 - Boss Katana - USB audio interface not working [snd-usb-audio]
Summary: Boss Katana - USB audio interface not working [snd-usb-audio]
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-02 14:51 UTC by beanow
Modified: 2021-04-23 19:26 UTC (History)
16 users (show)

See Also:
Kernel Version: 4.4.0 (Ubuntu generic)
Subsystem:
Regression: No
Bisected commit-id:


Attachments
alsa-info.sh output (82.60 KB, text/plain)
2017-04-02 14:51 UTC, beanow
Details
aplay --dump-hw-params and arecord --dump-hw-params (1.23 KB, text/plain)
2017-04-02 14:52 UTC, beanow
Details
speaker-test with plughw: and hw: addressing (1.01 KB, text/plain)
2017-04-02 14:53 UTC, beanow
Details
Verbose aplay attempt of /dev/zero (1.31 KB, text/plain)
2017-04-02 14:54 UTC, beanow
Details
lsusb -vvv of the device (6.26 KB, text/plain)
2017-04-02 14:57 UTC, beanow
Details
Attempting to use the device to Jack (1.47 KB, text/plain)
2017-04-02 14:58 UTC, beanow
Details
KATANA-100 block diagram (62.12 KB, image/png)
2017-04-02 15:09 UTC, beanow
Details
/proc/asound/KATANA/stream0 (447 bytes, text/plain)
2017-04-02 15:12 UTC, beanow
Details

Description beanow 2017-04-02 14:51:17 UTC
Created attachment 255705 [details]
alsa-info.sh output

While the USB audio interface does seem to be detected. Trying to speaker-test or aplay to the interface produces no sound and times out with I/O errors.

aplay: pcm_write:1940: write error: Input/output error


The HW parameters detected under Linux also do not match up with the product description in the manual, or how it shows up with the official drivers under Windows 10.

Parameters under Windows 10:
- 3 Duplex MIDI ports (KATANA, KATANA DAW CTRL, KATANA CTRL)
- 2 Duplex PCM devices, 2 channels 44.1khz 16/24 bits (PRIMARY, SECONDARY)

Parameters under Linux:
- 3 Duplex MIDI ports (KATANA 1, KATANA 2, KATANA 3)
- 1 Duplex PCM device, 4 channels 44.1khz 32 bits (KATANA)


It's ID is 0582:01d8 and the specific model I have is the Boss Katana 100W 1x12" combo amp. The Boss Katanas (Roland corp) are a fairly new device series (released Q4 2016). So please let me know how I could help resolve this issue and/or contribute to it's driver support in general.

I will attach verbose device details and the failing playback attempts.
Comment 1 beanow 2017-04-02 14:52:24 UTC
Created attachment 255707 [details]
aplay --dump-hw-params and arecord --dump-hw-params
Comment 2 beanow 2017-04-02 14:53:13 UTC
Created attachment 255709 [details]
speaker-test with plughw: and hw: addressing
Comment 3 beanow 2017-04-02 14:54:49 UTC
Created attachment 255711 [details]
Verbose aplay attempt of /dev/zero

Note that it takes 20s to time out with the error. While this should play back silence for 1s.
Comment 4 beanow 2017-04-02 14:57:09 UTC
Created attachment 255713 [details]
lsusb -vvv of the device

EP 13 OUT and EP 14 IN are the PCM endpoints.
Comment 5 beanow 2017-04-02 14:58:05 UTC
Created attachment 255715 [details]
Attempting to use the device to Jack
Comment 6 beanow 2017-04-02 15:09:05 UTC
Created attachment 255717 [details]
KATANA-100 block diagram

The owners manual can be found at https://www.boss.info/global/support/by_product/katana-100/owners_manuals/

This screenshot is a block diagram from the manual that helps conceptualize why 2x stereo duplex makes sense and 1x 4 channel duplex doesn't.
Comment 7 beanow 2017-04-02 15:12:05 UTC
Created attachment 255719 [details]
/proc/asound/KATANA/stream0
Comment 8 szszoke 2019-01-05 19:57:44 UTC
Since the v3 firmware was released, I tested again.

Boss KATANA 100 Firmware version: 3.01,
Linux Kernel version: 4.18 low latency.

The same issue still persists.
Comment 9 Peter Bernth 2019-06-11 00:55:42 UTC
Might be a shot in the dark, but people (including myself) have gotten several Boss/Roland devices working after patching and compiling the kernel ourself.

It seems that many of the products from Boss/Roland use the exact same type of “IN/END points handling”. I don’t have the katana myself and aren’t able to test it. But I would start looking into it and read this thread. It’s full of useful information.

https://linuxmusicians.com/viewtopic.php?f=6&t=17180&p=107252#p107252
Comment 10 szszoke 2019-06-12 20:34:22 UTC
Thanks for the pointer! I was able to make my Katana work under Ubuntu 18.10 running the 4.18.0 kernel by adding this to sound/usb/pcm.c:355

>       case USB_ID(0x0582, 0x01d8):
>               return 0;

With these changes, I was able to record and play back through my amp with Jack. Thanks for the tip!
Comment 11 Peter Bernth 2019-06-13 07:07:34 UTC
(In reply to szszoke from comment #10)
> Thanks for the pointer! I was able to make my Katana work under Ubuntu 18.10
> running the 4.18.0 kernel by adding this to sound/usb/pcm.c:355
> 
> >       case USB_ID(0x0582, 0x01d8):
> >               return 0;
> 
> With these changes, I was able to record and play back through my amp with
> Jack. Thanks for the tip!

You’re welcome. I suspected it was the same problem. We need more focus on this. Back at kernel 3.10 Roland/Boss devices was working perfectly fine out of the box. I know several people had tried reporting these errors, but apparently pro audio is not a high priority. I recommend compiling as module because it is much much faster than compiling full kernel every time you update. I use rolling release distros and update kernel often.
Comment 12 szszoke 2019-06-13 07:36:59 UTC
I ended up doing exactly that.
Comment 13 Takashi Iwai 2019-06-13 09:26:25 UTC
Could either of you just submit the fix patch?  I'd happily apply the fix.
Comment 14 szszoke 2019-06-13 09:39:36 UTC
I can, but there are some things to consider:
1. This workaround works for multiple devices, but we need to hard-code the the USB identifiers.
2. According to the person who discovered this fix, it's a dirty hack that just hides the real problem

I will reach out to the original author and maybe he can explain this better.
Comment 15 beanow 2019-08-04 16:24:46 UTC
Any new information on what could get this from a hack to a suitable patch?
Comment 16 szszoke 2019-08-10 19:33:12 UTC
I wrote in on the forum thread but I got no response so far.
Comment 17 szszoke 2019-10-07 16:01:14 UTC
I was thinking and hack or not, other devices are using this technique already, so I don't see why couldn't we use it for the Katana.

Takashi Iwai, if your offer still stands, I would like to help with submitting a fix.
Comment 18 szszoke 2019-10-11 17:31:04 UTC
I submitted a small patch with the fix.
Comment 19 Raul Dipeas 2019-11-25 03:15:30 UTC
(In reply to szszoke from comment #18)
> I submitted a small patch with the fix.

I have an issue with M-Audio C400, it's not recognized by JACK on Ubuntu(all versions) after this patch was submitted.

It's appear with no controls on ALSA mixer.
Comment 20 szszoke 2019-11-25 07:05:54 UTC
Can you post the output of lsusb? This patch should only affect devices that have this USB vendor and product ID: 0582:01d8.
Comment 21 Raul Dipeas 2019-11-25 07:08:33 UTC
(In reply to szszoke from comment #20)
> Can you post the output of lsusb? This patch should only affect devices that
> have this USB vendor and product ID: 0582:01d8.

This is my device:

Bus 001 Device 002: ID 0763:2030 Midiman
Comment 22 szszoke 2019-11-25 07:16:02 UTC
Your device should not be affected by the patch that was submitted to make the KATANA amps work, but you can try and undo this change: https://github.com/torvalds/linux/commit/7571b6a17fcc5e4f6903f065a82d0e38011346ed

This is the only change that was submitted.

Let me know if you need help with compiling the kernel.
Comment 23 Raul Dipeas 2019-11-25 07:24:51 UTC
(In reply to szszoke from comment #22)
> Your device should not be affected by the patch that was submitted to make
> the KATANA amps work, but you can try and undo this change:
> https://github.com/torvalds/linux/commit/
> 7571b6a17fcc5e4f6903f065a82d0e38011346ed
> 
> This is the only change that was submitted.
> 
> Let me know if you need help with compiling the kernel.

I really don't know if this patch affected me, but after the release of the kernel with this patch, i'm getting this error, maybe something else has causing this.

I'm using XanMod kernel, version 5.3.8, in any version above, i'm getting this error.

I'm trying with Liquorix too, last version working is 5.3.0-10-1.

Even with last Ubuntu mainline kernel, 5.4.0, it happen.

Can you help-me anyway?
Comment 24 Raul Dipeas 2019-11-25 10:20:27 UTC
I recompiled the kernel without this patch for KATANA but still get the issue.

I had tried with XanMod 5.3.8.
Comment 25 traderboy 2019-12-27 22:45:13 UTC
Would it be possible to have the fix also applied for other Boss devices?
Mine is a GT-001 and on USB it reports ID 0582:01e5 Roland Corp.
So currently I keep on compiling the fix for snd-usb-audio myself to make it work.
Thank you in advance.
Comment 26 szszoke 2019-12-27 22:47:22 UTC
Yes, in fact I'm working on a patch that would make the SY-300 synth pedal work with this exact method.
Comment 27 traderboy 2019-12-27 22:49:50 UTC
Thanks again for your efforts and I am looking forward to it.
Comment 28 Mike Oliphant 2019-12-28 22:52:02 UTC
I just wanted to add that the Boss GT-1 (which is different from the GT-001) has this problem as well.

Boss GT-1 USB ID: 0582:01d6

Without the fix, recording and playback are not possible. With the fix, recording and playback work, although I'm getting frequent sample dropouts. Still, working with dropouts is better than not working at all.
Comment 29 Mike Oliphant 2020-01-23 17:36:02 UTC
I now have what I believe is a better fix, at least for the GT-1. I have implicit feedback working, rather than just being disabled (which is what the previous Katana patch does). I now get perfectly solid capture/playback with no dropouts.

I plan to submit a patch, but I suspect this fix will work for other Boss devices (Katana, GT-001, etc.), so I'd like to cover them if it does.

If you have a Boss device with this issue and are set up to recompile your kernel, drop me an email.
Comment 30 Chris McDonough 2020-05-14 22:26:03 UTC
(In reply to Mike Oliphant from comment #29)
> If you have a Boss device with this issue and are set up to recompile your
> kernel, drop me an email.

Hi Mike, I have an RC-202 and I'm set up to recompile, if you want to post the patches somewhere.
Comment 31 Mike Oliphant 2020-05-15 15:39:55 UTC
Hi Chris - I did a write-up on the process here:

http://blog.nostatic.org/2020/01/getting-boss-gt-1-effects-processor-to.html
Comment 32 Martin Passing 2020-05-31 18:12:57 UTC
got the USB interface of my Boss AD-10 working with the following patch:

-----
--- sound/usb/pcm.c  2020-05-28 22:24:35.623969551 +0200
+++ sound/usb/pcm.c.patched  2020-05-28 22:25:49.092449899 +0200
@@ -369,7 +369,8 @@
 
                alts = &iface->altsetting[1];
                goto add_sync_ep;
-
+    case USB_ID(0x0582, 0x0203): /* BOSS AD10 */
+        return 0;
        }
        if (attr == USB_ENDPOINT_SYNC_ASYNC &&
            altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
-----
Comment 33 code 2020-06-30 06:10:59 UTC
Running kernel 5.7 on Debian Unstable and still cannot seem to get the USB interface working on the Katana. Output works fine, but input doesn't. In Audacity, for example, hitting record doesn't do anything. The bar doesn't move. However, if I set my output to the Katana and play a random bit of noise out of it, it will miraculously start recording. Regardless of whether or not it starts recording, however, Fx FloorBoard can't seem to recognise the device at all.

It works fine under Windows, but every single distribution of Linux I've tried has had the same issue: Debian Unstable (5.6 and 5.7), Ubuntu 18.04 (5.3), Fedora 32 (5.6), and Ubuntu 20.04 (5.4).

I used udev to grant full permissions on the USB device for my user without luck. I also disabled USB autosuspend in case that was affecting it, but it also didn't do anything.

Anyone know of anything that might fix it?
Comment 34 code 2020-06-30 06:52:35 UTC
Oh, I should mention I've tried a Katana 50 MkI and a Katana 100 MkII. Both experience the same issues. I've also tried a new cable.
Comment 35 Mike Oliphant 2020-06-30 14:57:02 UTC
These Boss devices are designed to use the USB path as a continuous input/output channel, with the input fed back to the output after potential processing - basically the way ASIO drivers work in Windows. They seem to require the output to be connected and active for the input to work.
Comment 36 code 2020-06-30 23:09:03 UTC
(In reply to Mike Oliphant from comment #35)
> These Boss devices are designed to use the USB path as a continuous
> input/output channel, with the input fed back to the output after potential
> processing - basically the way ASIO drivers work in Windows. They seem to
> require the output to be connected and active for the input to work.

Ah, I see. Is there any way to set it as a "pseudo output"? Setting it as a system-wide output gives me the jumps when I get a notification, for example, because it's put through all the amp's effects. And, trust me, heavily distorted, delay-ridden ping sounds from Telegram are are absolutely terrifying.
Comment 37 Mike Oliphant 2020-12-22 20:28:06 UTC
This should now be fixed in the kernel, at least for the BOSS BR-80, GT-100, GT-001, and Katana (and the GT-1, as soon as a recent patch makes its way in).

I suspect it will work for other devices as well - the relevant USB IDs would just need to be added here:

https://github.com/torvalds/linux/blob/master/sound/usb/implicit.c
Comment 38 code 2020-12-22 22:34:47 UTC
(In reply to Mike Oliphant from comment #37)
> This should now be fixed in the kernel, at least for the BOSS BR-80, GT-100,
> GT-001, and Katana (and the GT-1, as soon as a recent patch makes its way
> in).
> 
> I suspect it will work for other devices as well - the relevant USB IDs
> would just need to be added here:
> 
> https://github.com/torvalds/linux/blob/master/sound/usb/implicit.c

Christmas has come early this year!!!! Which kernel version has this/will this land in?
Comment 39 Mike Oliphant 2020-12-22 22:50:56 UTC
It just recently hit the mainline kernel tree. Not sure when it will make it out to various distros.
Comment 40 Takashi Iwai 2021-01-08 14:21:16 UTC
As the patches went into 5.11-rc1, let's close this bug.
Comment 41 Christian Lohmaier 2021-01-13 00:02:50 UTC
To those being able to verify with the latest kernel/patches:

Are you able to use 48kHz with jack with the fixes?

(with kernel 5.9, no matter what I request with jack, the device is set to 44.1kHz) (works in that mode, I can capture audio/send audio to it - but I need 48kHz)
Comment 42 Lucas Endres 2021-04-03 23:52:46 UTC
(In reply to Christian Lohmaier from comment #41)
> To those being able to verify with the latest kernel/patches:
> 
> Are you able to use 48kHz with jack with the fixes?
> 
> (with kernel 5.9, no matter what I request with jack, the device is set to
> 44.1kHz) (works in that mode, I can capture audio/send audio to it - but I
> need 48kHz)

I could be wrong, but I think it's probably a limitation of the device itself.  If you're talking about the Katana, the first post seems to agree with what you've found:

> Parameters under Windows 10:
> - 3 Duplex MIDI ports (KATANA, KATANA DAW CTRL, KATANA CTRL)
> - 2 Duplex PCM devices, 2 channels 44.1khz 16/24 bits (PRIMARY, SECONDARY)
> 
> Parameters under Linux:
> - 3 Duplex MIDI ports (KATANA 1, KATANA 2, KATANA 3)
> - 1 Duplex PCM device, 4 channels 44.1khz 32 bits (KATANA)

A workaround might be to tell jack to use the alsa device with "plughw:" preceding the name (or card number), instead of just the "hw:" that's probably preceding the name/card number normally.  That may allow jack to start in 48 kHz, but it won't actually mean your capture would grab more information than the 44.1 kHz samples.  But, it should provide a translation to your desired sample rate of 48 kHz and allow saving in that format.

I hope that helps!
Comment 43 Christian Lohmaier 2021-04-21 13:36:41 UTC
(In reply to Lucas Endres from comment #42)
> (In reply to Christian Lohmaier from comment #41)
> > 
> > Are you able to use 48kHz with jack with the fixes?
> […]
> I could be wrong, but I think it's probably a limitation of the device
> itself.

Nope, can use 44.1kHz, 48kHz and 96kHz without issues on both Windows as well as macOS with the Katana

> A workaround might be to tell jack to use the alsa device with "plughw:"
> preceding the name (or card number),

Didn't manage to get that to work with jack itself. Missing the magic sauce to create a ctrl device for jack. plughw works to add software resampling step with plain alsa - but I couldn't manage to get it to work with jack.
The hardware definitely supports it natively and there should be no need for a software resample step.
Comment 44 Lucas Endres 2021-04-21 16:01:43 UTC
(In reply to Christian Lohmaier from comment #43)
> Nope, can use 44.1kHz, 48kHz and 96kHz without issues on both Windows as
> well as macOS with the Katana

Okay, that's good to know!  Mike Oliphant has been active recently tweaking this, having noticed noise using it as a playback device.  I wonder if it would add your extra sample rates: https://patchwork.kernel.org/project/alsa-devel/patch/20210414083255.9527-1-tiwai@suse.de/

> > A workaround might be to tell jack to use the alsa device with "plughw:"
> > preceding the name (or card number),
> 
> Didn't manage to get that to work with jack itself. Missing the magic sauce
> to create a ctrl device for jack. plughw works to add software resampling
> step with plain alsa - but I couldn't manage to get it to work with jack.
> The hardware definitely supports it natively and there should be no need for
> a software resample step.

Now that I know the BOSS Katana is capable of the other sample rates, this is probably moot: In qjackctl, when I go to Setup>Settings->Advanced, there are the the "Output Device" and "Input Device" visible.  It is there, that plughw:KATANA would go.

I hope that helps at least somewhat.
Comment 45 Christian Lohmaier 2021-04-23 11:40:40 UTC
tried the plughw method again, but no cigar, no matter whether I set it on the settings tab or individually for input/output on the advanced settings, alsa complains:

creating alsa driver ... plughw:KATANA|plughw:KATANA|256|3|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 256 frames (5.3 ms), buffer = 3 periods
ALSA: final selected sample format for capture: 32bit float little-endian
You appear to be using the ALSA software "plug" layer, probably
a result of using the "default" ALSA device. This is less
efficient than it could be. Consider using a hardware device
instead rather than using the plug layer. Usually the name of the
hardwa
ALSA: cannot set period size to 256 frames for capture
ALSA: cannot configure capture channel
Jack: JackDriver::Close

no matter what period size always the same error.

Also tried the patch on 5.11.6, but that unfortunately didn't change anything, still the samplerate gets locked to 44100Hz

Appreciate the help and pointers though.
Comment 46 Lucas Endres 2021-04-23 19:26:29 UTC
(In reply to Christian Lohmaier from comment #45)
> tried the plughw method again, but no cigar, no matter whether I set it on
> the settings tab or individually for input/output on the advanced settings,
> alsa complains:
> 
> creating alsa driver ...
> plughw:KATANA|plughw:KATANA|256|3|48000|0|0|nomon|swmeter|-|32bit
> configuring for 48000Hz, period = 256 frames (5.3 ms), buffer = 3 periods
> ALSA: final selected sample format for capture: 32bit float little-endian
> You appear to be using the ALSA software "plug" layer, probably
> a result of using the "default" ALSA device. This is less
> efficient than it could be. Consider using a hardware device
> instead rather than using the plug layer. Usually the name of the
> hardwa
> ALSA: cannot set period size to 256 frames for capture
> ALSA: cannot configure capture channel
> Jack: JackDriver::Close
> 
> no matter what period size always the same error.
> 
> Also tried the patch on 5.11.6, but that unfortunately didn't change
> anything, still the samplerate gets locked to 44100Hz
> 
> Appreciate the help and pointers though.

That's interesting.  I just tested it on my EDIROL UA-4FX and it jack started properly for me, even though I still had the warning you did.

13:16:44.160 JACK is starting...
13:16:44.160 /usr/bin/jackd -P80 -dalsa -r96000 -p512 -n3 -D -Cplughw:UA4FX -Pplughw:UA4FX
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
13:16:44.169 JACK was started with PID=92169.
no message buffer overruns
no message buffer overruns
no message buffer overruns
jackdmp 1.9.16
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2020 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 80
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio2
creating alsa driver ... plughw:UA4FX|plughw:UA4FX|512|3|96000|0|0|nomon|swmeter|-|32bit
configuring for 96000Hz, period = 512 frames (5.3 ms), buffer = 3 periods
ALSA: final selected sample format for capture: 32bit float little-endian
You appear to be using the ALSA software "plug" layer, probably
a result of using the "default" ALSA device. This is less
efficient than it could be. Consider using a hardware device
instead rather than using the plug layer. Usually the name of the
hardwa
ALSA: use 3 periods for capture
ALSA: final selected sample format for playback: 32bit float little-endian
You appear to be using the ALSA software "plug" layer, probably
a result of using the "default" ALSA device. This is less
efficient than it could be. Consider using a hardware device
instead rather than using the plug layer. Usually the name of the
hardwa
ALSA: use 3 periods for playback
13:16:46.238 JACK connection change.
13:16:46.238 Server configuration saved
13:16:46.239 Statistics reset.
13:16:46.245 Client activated.
13:16:46.245 Patchbay deactivated.
13:16:46.249 JACK connection graph change.

Maybe your problems are with JACK itself, as I've had trouble with certain versions on my EDIROL devices before, so I've been using debian's jackd2 package.

However, this is just a workaround.  Since you know the KATANA's actual sample rate should work beyond 44100, I would try the latest development patch by Takashi Iwai.  Things are moving fast, and it might be a better fit than what I linked you to earlier, although it could have exactly the same result.  Here's the alsa-devel thread pertaining to it:
https://mailman.alsa-project.org/pipermail/alsa-devel/2021-April/183960.html

Also, in my short experience, that alsa-devel mailing list has been great for getting direct help from people who know much more than I.

Takashi's current patch uses the USB endpoint information read from the device to, hopefully properly, set up any Roland/EDIROL/BOSS device!  Although Mike Oliphant has tested the KATANA to be working with it, it wouldn't hurt have more feedback from you, especially if your experience leads to better solutions.  It is slated to be in kernel 5.13, but is currently a patch to apply to the linux-next branch.  I got that branch from a snapshot at:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/
But, I actually still manually patched implicit.c due to the mix of tabs in the kernel, and spaces in the patch which makes it easier to translate to email (or at least my gmail).

I hope this becomes more than the wild goose chase you've been on so far,

  Lucas

Note You need to log in before you can comment on or make changes to this bug.