AudioGNU/LinuxTechnology

Digidesign Mbox 2: Linux driver provided!

This is my unofficial Digidesign Mbox 2 driver for linux.

Please consider donating $5 for further development of free software drivers for Digidesign hardware. Every little bit counts.

PayPal - Donate to ZamAudio

Mbox2

Linux_Logo

For those of you who want the raw driver source, here it is as a kernel module [63kB]. It can be compiled
for the current running kernel as follows:

Make sure you have the kernel headers downloaded and installed correctly.
Then do the following: (extract the tarball to ANY directory then “make” it, install it and modprobe the new driver as follows:)
tar jxf mbox2-kernel-20121213.tar.bz2
cd mbox2-kernel
make
sudo make install
sudo rmmod snd-usb-audio # ignore errors
sudo rmmod snd-usbmidi-lib # ignore errors
sudo modprobe snd-usb-audio

UPDATE!!!
Mbox2 patch now accepted into ALSA:
That’s right folks, if you install a kernel later than 3.8-rc2, your Mbox2 will work right out of the box with Linux!

UPDATE Sept 2013:
None of the above instructions are relevant anymore because the Mbox2 driver stuff is part of Linux kernel after 3.8! Just plug in your device, lights come on and it works. Any config issues with JACK, make sure you are using the ALSA backend and 2 ins and 2 outs, >256 buffer size and 3 periods.
🙂

IMPORTANT UPDATE July 2019:

I only just realised this, but you need to upgrade your Mbox 2 firmware to v1.43 using the official updates provided here(Avid) and mirrored on my site here(win64), here(osx_intel) and here(osx_ppc).  Without the update, I have experienced strange noisy inputs with the Mbox2 on GNU/Linux but when I applied the update the noise disappeared…

248 thoughts on “Digidesign Mbox 2: Linux driver provided!

  1. Nice work!
    I hope that your patch will be in alsa source code soon. 🙂
    I’m sure a lot of protools users would appreciate to use their mbox with linux.

  2. You sir, are a legend.

    Gave this patch a shot today, just with my Fedora install on my laptop, as I currently don’t really have much set up in the way of a studio (but I plan to get back into it soon!). For some reason I couldn’t get it working as the default sound device in Fedora, but in Ardour, in terms of recording and playback, it’s working flawlessly. Didn’t save my test recording but let it be said that the MBox 2, at least with analog, now works just as well on Linux as it does on Windows/Mac…

  3. My patch only works for 24-bit @ 48000Hz at the moment (don’t put jack in 44100Hz mode because it won’t play properly) That’s why it hasn’t been added to ALSA source code, because it’s an incomplete driver. I don’t really have time to finish it right now though, I’m busy writing other stuff. Enjoy!

  4. Anonymous: Why do you need 44k1 so badly?

    If you run it at 48k, and playback a 44k1 audio file, most likely you are using libsamplerate SRC to convert it on the fly (if you use aqualung you can actually choose which samplerate converter to use, use best sinc). libsamplerate is a *very* good sample rate converter, from memory it supports 144dB SNR with 96% bandwidth on the highest setting. So you’re not really losing much information by playing audio at 48k and resampling on the fly.
    As for recording, it’s better to record at a higher sample rate, and bounce down to 44k1 just for the purpose of making a cd.

    (But yeah, if you just want to playback cd audio, ideally you want the card to match the sampling rate of your audio files.)

  5. I do not have an mbox, so it is of no consequence to me. If your driver was included in Alsa, a lot of linux users would gain from your work. It should net be hard to add 44k1 to your current patch

  6. Hi Damien,

    I’m trying to compile as you explain.
    When you says “Be sure to select USB Audio driver in the kernel config”, it means “built in” or “Module” ? When I the menuconfig, I’m not sure to select the good audio USB driver… Could you precise the path in menuconfig ?
    I’m a new Linux user, so excuse me for those questions (and for my english).

    Greetings from France

  7. I’d had errors!!!!!!! after the build alsa-kernel (make)

    sound/pci/hda/hda_codec.c: En la función ‘snd_hda_mixer_amp_switch_put_beep’:
    sound/pci/hda/hda_codec.c:1743: error: declaración implícita de la función ‘snd_hda_enable_beep_device’
    make[3]: *** [sound/pci/hda/hda_codec.o] Error 1
    make[2]: *** [sound/pci/hda] Error 2
    make[1]: *** [sound/pci] Error 2
    make: *** [sound] Error 2

    Could you help me please?????!!!!

    regards from Spain

  8. Hi Tom, you are trying to build an entire experimental kernel… I don’t support the HDA PCI module… probably try disabling all the PCI ALSA sound card modules, you don’t need them for the MBOX2.

    Regards,
    damo

  9. I just posted some updated instructions to get the experimental kernel. Now you can checkout the EXACT revision of the experimental kernel which I used to build the module. So you shouldn’t have problems compiling it. If you get an error with a different module than “usbaudio.c” you probably have to disable it in the kernel config.

  10. Hey Damien

    Thanks for all the help yesterday. I ran into an issue. The kernel built fine, but the dpkg part threw an error. Here’s the transcript:

    $sudo dpkg -i ./linux-image-2.6.31.1mbox2_mbox2_amd64.deb
    Selecting previously deselected package linux-image-2.6.31.1mbox2.
    (Reading database … 187490 files and directories currently installed.)
    Unpacking linux-image-2.6.31.1mbox2 (from …/linux-image-2.6.31.1mbox2_mbox2_amd64.deb) …
    Done.
    Setting up linux-image-2.6.31.1mbox2 (mbox2) …
    Running depmod.
    Finding valid ramdisk creators.
    Using mkinitramfs-kpkg to build the ramdisk.
    Running postinst hook script update-grub.
    Generating grub.cfg …
    Found linux image: /boot/vmlinuz-2.6.31.1mbox2
    Found initrd image: /boot/initrd.img-2.6.31.1mbox2
    Found linux image: /boot/vmlinuz-2.6.31-14-generic
    Found initrd image: /boot/initrd.img-2.6.31-14-generic
    Found Windows 7 (loader) on /dev/sda2
    Found Microsoft Windows XP Professional on /dev/sda3
    done
    Examining /etc/kernel/postinst.d.
    run-parts: executing /etc/kernel/postinst.d/dkms
    run-parts: executing /etc/kernel/postinst.d/nvidia-common
    run-parts: /etc/kernel/postinst.d/nvidia-common exited with return code 20
    Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-2.6.31.1mbox2.postinst line 1186.
    dpkg: error processing linux-image-2.6.31.1mbox2 (–install):
    subprocess installed post-installation script returned error exit status 2
    Errors were encountered while processing:
    linux-image-2.6.31.1mbox2

    What does that mean? Did it install correctly?

  11. Hello again

    I could have build by make, after disabled quite the modules PCI of the alsa, in the makemenuconfig.

    Later I have done a make install and have obtained the following files in the directory boot:

    -vmlinuz-2.6.32-rc6
    -System.map-2.6.32-rc6
    -config-2.6.32-rc6

    But do not be inittrd.img-2.6.32-rc6!

    I have tried to start the new kernel with the inittrd of the previous kernel to try, and obtain:

    could not load /lib/modules/2.6.32-rc6/modules-dep

    Can you help me?

    Regards!

    Tom!

  12. Tom:


    sudo apt-get install kernel-package fakeroot && fakeroot make-kpkg --initrd --arch=i386 --revision=mbox2 kernel_image && cd .. && sudo dpkg -i linux-image-2.6.32-rc6-mbox2.deb

  13. git checkout -b beforembox2 43f666591520b11f19c59834ea9b80ead736e54d
    fatal: reference is not a tree: 43f666591520b11f19c59834ea9b80ead736e54d

  14. Same here: “fatal: reference is not a tree”. So if someone can help… I would definitively prefer to use ardour than protools and linux than windows.
    I’m using Archlinux x86_64. And if I succeed in compiling and using this driver i’ll try to make a pkgbuild for arch and put it on aur.
    OI! from France.
    François

  15. Okay guys, sorry for that. I don’t have time to play with git anymore, so I just packaged it as a tarball. Follow the new instructions at the top of this page.

  16. i have an mbox 2 mini .I cant make it work in ubuntu.can you please explain me what I should do?

  17. There does not exist a linux driver for Mbox 2 mini yet. I am not currently writing one either. You’re out of luck for the moment.

  18. Great job. Though i was planing to buy the mbox2 mini to get this work with linux on my laptop. I wish you could find the time to develop everything fully and be done with it. Let those mbox owners have another reason and no excuse to switch to linux. Trust me there are alot. If you did the work for 44.1hz and support more digidesign hardware like mbox 2 mini, I’m sure you would be thanked for your hard work by the linux digidesign community. Not to mention donations to help you in future works.

    Ramon

  19. Hello damo, hello gnu/linux-mbox2mini wannabees.
    Demo, thank you for the tarball. Now the Mbox2mini appears in alsamixer when I plug it in (when I boot with it plugged in it is considered as my default audio device). Alsamixer tells me: “This sound device does not have any controls” witch is perhaps normal. But when I start jack and then ardour the green light stays off and I’ve got no sound in input nor in output.
    So is it normal that the light stays off and is it normal that i’ve got no control via alsamixer?
    Please forgive the english skills.
    Kisses from France.
    François.

  20. Francois: You might need to select different options in qjackctl, such as input channels=2 and output channels=2 to get it to activate… use alsa-seq as the midi driver.

  21. Damo,
    If you would like help, I have an Mbox that I would like to get working on Linux. I’ve just grabbed your code, and will try to understand how it works.

  22. Damo,
    I’m gonna try to do like Chris but for the Mbox2mini. I’m not sure if this is the place to centralize discussions about Mbox-x drivers for linux but YOU started it so… 🙂
    Anyway thx again for the patch.

  23. Thank you so much for making this driver, it’s a much needed addition to linux! I can’t seem to get it to work properly though. I think the installation process went fine, the Mbox 2 now appears in the sound preferences. However when I try to connect it to ardour via Jack I just can’t get any sounds in or out. Do I need to change any settings in the Jack control application? I changed the sampling rate to 48kHz.

  24. Ok I have now spent day and night trying to get this to work. I’m making good headway, I’ve got sound coming in from both channels and going out. However the sound coming in is drenched in white noise, does anybody now how to fix this issue?

    Thanks

  25. This is really great news for Digidesign Mbox 2 users. We have been locked out from Linux support for a long time. I am curious about a few things about the implementation, and am considering writing an Mbox (classic) quirk/hack.

    In your implementation, you send the3 “enablemagic” bytes. How did you arrive at the values enablemagic[0]=0x80, enablemagic[1]=0xbb, enablemagic[2]=0x00?

    In my efforts to get Mbox up and running, I am able to get the USB light to light up and was able to capture the packets for enabling recording. However, when I send them to the unit, I get a broken pipe message if I use the enablemagic frmo the mbox 2. I suspect there is a different enablemagic for this product, but cannot figure out how to figure it out, so to speak. Thanks.

  26. Nathan: Capture the usb traffic and it should show up as bytes sent to the unit during bootup / configuration of the unit.

  27. Right. So I have a captured packet from XP initialization of Mbox under ProTools that looks like this:
    a1 81 00 00 00 05 01 00

    I try to reproduce this packet using
    snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
    0x81, 0xa1, 0x000, 0x0000, &enablemagic, 0x0001, 1000);

    It seems that no matter what values for enablemagic’s 3 bytes I provide, my system always sends this packet from my altered Linux driver:
    a1 81 00 00 00 00 01 00

    Based on the above, what values would you think should be supplied for enablemagic? (Or would you need more info)

    Also, it seems like every other time that snd_usb_ctl_msg is used in your code,
    the variable in the position of “&enablemagic” here is a return/response pointer (“&bootresponse”), whereas here it appears to be values to send to the Mbox unit. Am I misunderstanding here.

    Again, thanks so much for your help with the Mbox 2. I suspect that I might have to – yet again – abandon hope for the classic Mbox. I am really starting to think that the unit has no (or few) brains and is totally software driven, but I am not ready to throw in the towel just yet.

  28. if you need to send to the unit without a response, just send the values… if you need to check for a response, you need to pass it a pointer to an array to hold the return values.
    I think you are missing a vital decoding step in the setup packet format: hope this helps:


    /* From USB Snoop,
    *
    * SetupPacket = RT RQ VHVL INDX SIZE
    * RT = 0xRT Request Type
    * RQ = 0xRQ Request
    * VHVL = 0xVLVH Value in reverse byte order
    * INDX = 0xDXIN Index in reverse byte order
    * SIZE = 0xZESI Size in reverse byte order
    *
    * Magic boot code setup packet: c0 85 01 00 00 00 12 00
    * RQ RT VLVH DXIN ZESI
    * becomes 0x85, 0xc0, 0x0001, 0x0000, &RETURNDATA, 0x0012, TIMEOUT
    * for snd_usb_ctl_msg()
    */

  29. According to your setup packet of a1 81 00 00 00 05 01 00, the correct format for sending it should be:

    0x81, 0xa1, 0x0000, 0x0500, &RETURNDATA, 0x0001, TIMEOUT

  30. Hi all,
    I’m running default kernel “Linux Millecco 2.6.31-9-rt #152-Ubuntu SMP PREEMPT RT Thu Oct 15 05:01:14 UTC 2009 i686 GNU/Linux”, it’s possible to run this driver as a module?
    Thanks in advance.
    Millecco

  31. It is a module, its the “snd-usb-audio” module, but modified source files…. you need the headers for your kernel, and uncompress the files into /drivers/sound/usb, compile and you have a module! 😀

  32. Thanks for the driver – got it up and running in ubuntu the otgher week and ran my mate’s mbox2 for some jam sessions. Great work.
    Paul…from melbourne

  33. Hi there, is this patch working with a newer kernel? For example 2.6.32.17 as used by Lucid Lynx? 🙂

    I tried following the guide yesterday, all the compiling seemed to work fine and I actually could change my device to mbox2, but it didn’t work and now the settings seem to be blocked…

    thanks for any advice!

  34. I’ve tried to make it work on 2.6.35.x with “MBox2 Mini” and it does) The only problem was to move Damien’s code into a new, slightly modified environment (new files structure for usb-audio driver in kernel)

Leave a Reply

Your email address will not be published. Required fields are marked *