Previous Entry Share Next Entry
xiphmont

Fixing the Linux eMagic emi6|2m / a62m driver + eMagic firmware updates!

For a few years now, I've been using these spiffy little USB audio boxes made by eMagic many years back, specifically the emi2|6 and emi6|2m. There have been plenty of higher-performance devices made since (mostly in terms of lower noise), but the eMagic boxes still hold their own ten years later. They've always been dead reliable and they had Linux drivers from the earliest days thanks to Tapio Laxstrom. These days they pop up on eBay now and then for about $50.

They're no-frills; nothing but bare unbalanced line level inputs and outputs and digital ports. I don't need or want mic preamps and physical sliders, etc, like are bolted to every other prosumer USB audio device out there. I don't want a middling-quality all-in-one solution to my portable recording needs. These little boxen do one thing well and interface nicely to Real Equipment for doing specialized tasks like field recording or serious signal analysis. Oh, and you can gang them together! They can all be run off the sampling clock from one of the units, and I've used four together to do 12-out/20-in theatre work. To date, the eMagics are pretty much the only product that has ever offered this feature combination.

In 2004-ish, Apple bought eMagic and discontinued all of eMagic's hardware devices after momentarily renaming the product lines to the a26 and a62m. There have been no new eMagic driver updates for Windows since XP, and no new Mac OSX drivers (That I'm aware of) since 10.2 PPC. In fact, Linux is the last modern system the 6|2m boxes still work with.

...or at least it was until 2.6.26. In 2.6.27, yet another wholesale 'code cleanup', which Linux kernel developers regularly employ to make sure no hardware more than three years old continues working, broke the eMagic firmware loaders. It had been modified to compile with the 'refreshed' kernel API, but apparently no one tested that the modified version actually worked. Well, it didn't. As of 2.6.32.2 it still doesn't.

Let's cut to the chase.

Here is a patch that should apply cleanly to 2.6.27 through 2.6.32.x; it restores the eMagic 6|2m firmware loader to the exact functional state enjoyed in the 2.6 kernels before being broken in 2.6.27:

http://web.mit.edu/xiphmont/Public/emi/emi62.patch

The patch is large because one error in the code cleanup had among other things also accidentally replaced the 6|2m's firmware with the (not interchangable) firmware from the 2|6, which is big. This patch has been submitted upstream but hasn't made it any to of the staging kernels yet to my knowledge.

But that's not all! Look what else we've got!

The Linux kernel always included an early and slightly buggy firmware version for both devices. I've extracted the most recent firmware from the last known eMagic update and made a second patch that updates the Linux kernel from using version 1.0 of the eMagic firmware to using firmware version 2.2 (as marked in the installer) from MacOS 10.2.3. This patch is standalone. Install only one or the other, not both:

http://web.mit.edu/xiphmont/Public/emi/emi-firmware-update.patch

The updated firmware fixes at least one especially annoying niggle the 6|2m always had where neither analog nor digital sampling are active when recording starts, and you have to flip the physical switch on the front of the device to wake it up each time.

If you know of a more recent update for the eMagics, do let me know (and send me a copy so I can get the firmware out!)


This patch has been submitted upstream but hasn't made it any to of the staging kernels yet to my knowledge.

Monty, I'm interested in getting these bugs fixed in Debian kernel packages but they need to be fixed upstream too so we don't have to carry the patches forever.

Your patch fixes three different bugs, one of which had been fixed independently. So you'll need to re-submit with that bug fix taken out. It's probably best if you send:

  1. Patch to fix the ANCHOR_LOAD_INTERNAL/ANCHOR_LOAD_EXTERNAL confusion, to maintainer and public list (ALSA or LKML)
  2. Patch to remove the wrong firmware (in git format, this will be tiny), to maintainer and public list (ALSA or LKML)
  3. Copy of the correct firmware (binary ihex generated with ihex2fw) to David Woodhouse

If this is all too much trouble then send me the bits and I'll see what I can do.

Did eMagic ever release the firmware with a sensible licence? Firmware embedded in or extracted from GPL drivers is a problem: no-one can fulfil the source distribution requirements.


Interesting; my all-in-one patch applied clean to the latest kernel I could get. Although I didn't try any of the maintainers' personal trees.

1,2 and 3 have all been submitted upstream as individual patches already (to Clemens Ladisch and David Woodhouse).

I do not know what various terms eMagic ever released drivers under. You'd have to somehow reestablish contact with Tapio Laxstrom to learn more, but I've not heard from him in years. I have no idea how he managed to wrangle the early firmware out of eMagic under distributable terms. As far as I know, no one outside of eMagic ever had source.

I've stashed the English copy of the license that had been included with the software update dmg file at http://web.mit.edu/xiphmont/Public/emi/License
I do believe it says something along the lines of 'do you feel lucky, punk?' (It is also clearly fairly generic boilerplate; it makes several statements that couldn't possibly apply to anything in the source update, like the reference to MPEG)


Edited at 2010-01-11 02:23 am (UTC)

Interesting; my all-in-one patch applied clean to the latest kernel I could get. Although I didn't try any of the maintainers' personal trees.

It is expected that you base on the maintainer's public repository.

1,2 and 3 have all been submitted upstream as individual patches already (to Clemens Ladisch and David Woodhouse).

Oh, I didn't see that. What response did you get?

I've stashed the English copy of the license that had been included with the software update dmg file at http://web.mit.edu/xiphmont/Public/emi/License
I do believe it says something along the lines of 'do you feel lucky, punk?'

Yeah, it certainly doesn't permit anyone else to distribute the software. :-(


1,2 and 3 have all been submitted upstream as individual patches already (to Clemens Ladisch and David Woodhouse).
I don't remember seeing individual patches. Could you resend them, or publish them somewhere?

There is no maintainer for the loaders; my first patch was picked up by Andrew Morton.

--CL

Patches?

(Anonymous)

2010-07-21 07:29 am (UTC)

Sorry for dropping patches. I do have a vague recollection of this, but don't ever remember seeing a patch which I could just apply cleanly. It shouldn't be a patch to the kernel; it should be a patch to the linux-firmware.git repository. The files should be removed entirely from the kernel source (since they're not under GPL).

--
dwmw2

Hello!

Nice to see someone else likes these as well. I have the 2 6 version and enjoy it a lot. I ran into some problems with it when using Ubuntu Studio and would like to give this a try.

Is the second patch ok try, or are these just for the 6 2 version?
Thanks in advance.

-Santtu

There are loader fixes to both the emi6|2 and 2|6 in the second patch. The second patch also includes new firmware for the 6|2. I'm unaware of any firmware for the 2|6 that's newer than what is already shipped with the Linux kernel.

Thanks for your reply. My 2 6 started to distort a little when I switched to rt-kernel. I'll have to return to the basic kernel if your fix does not make a diggerence. Thanks for your effort anyway. It would be a shame if everyone would abandon these great devices.

patched kernel is not enough...

bsinou

2011-12-03 09:26 pm (UTC)

Hello Monty.

I'm sorry to bring back this post. But it seems like you're my last chance to be able to have sound while I'm coding again.
Anyway, I'm on Scientific Linux 6.1 (2.6.32-131.21.1) and the good old emagic a62m is seen but produce no sound in analog stereo duplex mode.
I've patched the kernel and installed it (by the way, first code change have been integrated, I only had to change the "ANCHOR_LOAD_INTERNAL" part & the firmware so I removed the first few lines of your patch).
I've rpm installed kernel & kernel-firmware but after reboot, the sound is still down. Is there something else to do in addition to the patch ? Do you have any tip or link to share, please ?
Thanks by advance.

Bruno

Re: patched kernel is not enough...

xiphmont

2012-01-13 10:33 am (UTC)

Is the device actually coming up properly? Eg, do you see it go through its startup routine with the green lights and does it accept audio (but just not play)? The device might be starting up muted by default!

If it does not show the usual green lights on startup (or on newer devices, shows a single red light) then the patch somehow didn't take, or there's a new bug...

Re: patched kernel is not enough...

(Anonymous)

2012-05-24 01:55 pm (UTC)

Dear xiphmont,

thanks for the patches. I already has a close look at the 2.6.32/34 kernels which had the change for the while loop in them.

- } while (i > 0);
+ } while (rec);

However when trying this on my previous ubuntu 10.04 LTS (kernel 2.6.32) as well as on the new ubuntustudio 12.04 LTS (kernel 3.2.0) I have seen that both versions, i.e. the one lacking the while loop change and the newest (probably) including it have failed to load the firmware properly.

[ 1168.866263] emi62 - firmware loader 5-1.1:1.0: emi62_probe start
[ 1168.886819] usb 5-1.1: emi62_set_reset - 1
[ 1168.988136] usb 5-1.1: emi62_set_reset - 0
[ 1170.559142] usb 5-1.1: emi62_set_reset - 1
[ 1170.660138] usb 5-1.1: emi62_set_reset - 0
[ 1171.776140] usb 5-1.1: emi62_set_reset - 1
[ 1172.078144] emi62: emi62_load_firmware - error loading firmware: error = -110
[ 1172.078202] emi62 - firmware loader: probe of 5-1.1:1.0 failed with error -5

As you can see from the dmesg output above (following the emi62_set_reset - 1/0) the kernel actually uploads the firmware to the device. It fails when it comes to the second patch you suggested, i.e. the eventual cause for this module to be broken since 2.6.32 may be the ANCHOR_LOAD_EXTERNAL.

- ANCHOR_LOAD_EXTERNAL);
+ ANCHOR_LOAD_INTERNAL);

I will give it another try on the actual installed platform.
I am currently on live system.

Kind regards,
Stefan

Re: patched kernel is not enough...

xiphmont

2012-05-24 02:10 pm (UTC)

Actually...

Recent userspace changes have further broken things, as udev is now responsible for fetching firmware from the filesystem, but it can't resist first trying to probe the device--- which naturally is stuck in probe().

Also, as part of the above, the firmware shipped by the kernel is no longer used by the system; the actual firmware that's uploaded is usually in the linux-firmware package now, and the format has changed.

I have patches for all the above, but I've been trying to finish a project that's behind schedule before trying to convince upstream to take them...

vmware ugly workaround for kernel 3.2.0 & Ubuntu 12.04

orionvianna

2012-07-31 03:28 am (UTC)

Hello,

I found a way to load the emi6|2m firmware on Ubuntu 12.04 Precise Pangolin with kernel 3.2.0 without patching

*Setup Windows XP 32bit virtual machine with VMWARE player.
*Install the emi62 drivers in the virtual machine & make sure it works.
*click go to menu "virtual machine > removable devices > Emagic A62 m > disconnect" or right click disconnect on the corresponding icon on the bottom right corner of the virtual machine window.
*suspend virtual machine and the sound card should be already working in linux.

Its not pretty but it works.

I forgot where I found the windows driver but the zip file was named A26_A62m_1.5.0.201.zip

I don't use pulse audio and use asoundconf-gtk or asoundconf to change default sound cards.
The following site has instructions on how to get asoundconf to work on ubuntu 12.04
http://wiki.marklesh.com/How-to/Asoundconf

To disable pulse audio I placed autospawn = no in ~/.pulse/client.conf (the file might need to be created)
For more information on how to disable pulse audio and setup a volume applet
http://howto.blbosti.com/2010/04/ubuntu-make-alsa-default-instead-of-pulseaudio/comment-page-1/#comments

Alsa-tray seems like a nice volume tray alternative but I have not used it.
http://projects.flogisoft.com/alsa-tray/

-Orion

You are viewing xiphmont