Patch for Hercules kernel mod broken by Linux 2.6.31

XML preset files and script files (.js) for MIDI and other controllers.

Moderators: garth, User Customization Moderators

Re: Patch for Hercules kernel mod broken by Linux 2.6.31

Postby philnice » Mon Apr 23, 2012 11:55 pm

To get help with that, you should try to contact some devs through irc. Probably it has to do with the distro you're currently on. I had no trouble with the driver on avlinux on a latest modified kernel.
Edit: And another note. Do you really have to use it on arch exclusively? because if you don't you can try avlinux as well.
I dual boot pclos and avlinux. I use the latter for audio - video applications.
It gives me the best possible results for my old hardware. And believe me before that, i wouldn't think i could actually have 4 decks playing at the same time without pops, skips etc.
Just think of it also.
"Mixxx - Where the X(tra) rules...."
philnice
 
Posts: 40
Joined: Fri Aug 20, 2010 4:43 pm

Re: Patch for Hercules kernel mod broken by Linux 2.6.31

Postby Pegasus » Sun Jun 24, 2012 8:12 pm

Hello, Hercules users!

We are pleased to report that in preliminary testing, Hercules controllers speak HID natively, which means you should be able to use them with Mixxx v1.11.0 and up _without_ a driver! (On all OSs, not just Linux.)

v1.11.0 is currently in beta so stop what you're doing here and head on over to the "1.11 beta sneak peek" post. Please report in that thread which Hercules controller you have and whether it shows up in Mixxx or not under Controllers after giving yourself write permissions on HID devices.

Hopefully the nightmare ends here!
"D.J. Pegasus"
Mixxx Developer - Controller Specialist
Mixxx Windows package maintainer
User avatar
Pegasus
Mixxx Developer
 
Posts: 1649
Joined: Thu Jan 29, 2009 7:48 pm
Location: Spangdahlem, RP, Germany

Re: Patch for Hercules kernel mod broken by Linux 2.6.31

Postby philnice » Mon Jun 25, 2012 3:22 pm

Oh that's the best news i heard today Pegasus.... Can't wait to see that thread marked as closed! Thanks. :D
"Mixxx - Where the X(tra) rules...."
philnice
 
Posts: 40
Joined: Fri Aug 20, 2010 4:43 pm

MP3e2 (and probably Steel)

Postby neale » Tue Jun 26, 2012 2:56 pm

The MP3e2 does not identify itself as an HID device. It will not work with Mixxx 1.11 without the kernel module, which we all know by now fails to build on newer Linux kernels (to say nothing of other operating systems).

I've been reading through the Guillemot driver. It looks like the MP3e2 and Steel share the same board logic. I only own an MP3e2 so I can't verify this, sorry. Further, the driver code looks at a quick glance to be nearly identical for every Hercules. My guess is that the MP3e2 actually is an HID device, but fails to identify as one.

If this is true, then it should be possible to special-case the USB identifier for the MP3e2 somewhere, and it will magically appear as a Mixxx controller without needing a driver on any OS.

I have never written USB code before, though, so verifying this is going to take some time, unless someone who knows how this stuff works steps forward :)
User avatar
neale
 
Posts: 20
Joined: Sun Jun 24, 2012 9:50 pm

Re: MP3e2 (and probably Steel)

Postby neale » Tue Jun 26, 2012 3:55 pm

More progress. I hacked a utility called usbhid-dump to ignore that the device doesn't say it's HID. It then failed on this check:

Code: Select all
                /* Skip non-interrupt and non-in endpoints */
                if ((ep->bmAttributes & LIBUSB_TRANSFER_TYPE_MASK) !=
                    LIBUSB_TRANSFER_TYPE_INTERRUPT ||
                    (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) !=
                    LIBUSB_ENDPOINT_IN)
                    continue;


Looks like it's not an HID controller after all, since it doesn't even support interrupt mode. Interrupt mode is probably how your USB keyboard tells the OS that you pressed a key, so the OS doesn't have to constantly ask "anything pressed yet?".

I think most Hercules controllers support two modes of operation: HID and Bulk (Vendor-Specific). The fancier ones, like the RMX, have extra logic inside to do HID. The cheaper ones, like the e2, only do Bulk mode. The Guillemot driver operates in bulk mode only (hence the file bulk.c). This was probably a management decision to save money on hardware and not need a rewritten driver.

To get the e2 working with Mixxx on later kernels is going to require either the driver be forward-ported--it probably just needs a structure updated in device.c:snd_hdj_chip_create()--or a userspace daemon to translate between the e2 and Alsa MIDI events.

I have a Stanton SCS.3d arriving next week, so I'm unlikely to do either. I'll tinker around with it while I'm waiting, though.
User avatar
neale
 
Posts: 20
Joined: Sun Jun 24, 2012 9:50 pm

Re: Patch for Hercules kernel mod broken by Linux 2.6.31

Postby neale » Wed Jun 27, 2012 5:55 am

It's turning out to be simpler than I expected, once I read enough about USB to understand how to use the libusb-1.0.

The MP3e2 and Steel are the only Hercules controllers that don't provide an HID interface, according to the kernel driver. They use bulk transfer instead. So I wrote a C program to do bulk transfer reads and dump them out. The output looks really similar to what Mixxx 1.11 prints with the --controllerDebug option for monitoring HID packets. So similar that it seems like a shame to map this in to MIDI events.

I think a couple dozen lines of code could bring the MP3e2 and Steel in to Mixxx, making them look like normal HID devices. I'll keep working on my program to see how to turn lights on and off.

You can follow my progress and try the program yourself at http://woozle.org/~neale/g.cgi/hdjd
User avatar
neale
 
Posts: 20
Joined: Sun Jun 24, 2012 9:50 pm

Re: Patch for Hercules kernel mod broken by Linux 2.6.31

Postby neale » Thu Jun 28, 2012 5:00 am

The way to read and write messages to all Hercules devices is exactly the same as it's done in current scripts with midi.sendShortMsg. The numbers are the same as what is currently in the scripts. Just use USB bulk transfers to and from the first Interface Descriptor with bNumEndpoints = 2. This works for at least the MP3 e2, and the Mk2 (thanks KWhat4 for helping me test).

So, for instance, the way to make the Deck A "CUE" LED flash is by sending "90 3e 7f", which, it turns out, appears in the MP3e2 script. I've added this to my proof-of-concept "driver" at http://woozle.org/~neale/g.cgi/hdjd, which also turns the LED on a button when you press it and off when you release it. It looks like all the Hercules devices use this same 3-byte packet for both incoming (buttons, faders, and knobs) and outgoing (LEDs) messages. And it seems like they can all handle USB bulk transfers.

If the last two paragraphs didn't make it obvious, it should be possible to use any Hercules DJ console without any drivers and minimal changes to existing scripts.

The next step is integrating code into Mixxx, and then submit a patch and hope it's accepted. This is where I am going to slow way down. If anybody experienced with the Mixxx codebase would like to lend a hand, please let me know! The best way to contact me is in IRC: my nick is "neale".
User avatar
neale
 
Posts: 20
Joined: Sun Jun 24, 2012 9:50 pm

Re: Patch for Hercules kernel mod broken by Linux 2.6.31

Postby faxtrode » Thu Jun 28, 2012 11:50 am

Hi, neale! I read your post about hid-bulk command translator. Can you explain me how to make work my hercules mp3 e2 with mixxx 1.11 using your driver? I downloaded your code "reading bulk transferes", compiled it with "make" and ran as daemon in console,but when i run mixxx nothing happens with my conntroller it doesn't work with mixxx
faxtrode
 
Posts: 15
Joined: Sat Apr 21, 2012 1:43 pm

Re: Patch for Hercules kernel mod broken by Linux 2.6.31

Postby neale » Thu Jun 28, 2012 3:09 pm

faxtrode wrote:Can you explain me how to make work my hercules mp3 e2 with mixxx 1.11 using your driver?


Sorry, I should have been more clear about what my "driver" does. It only is a demonstration of how to interface with the Hercules devices without a kernel module. I still need to add code to Mixxx to speak to the controller. If I can find someone to help me do this, there's a chance the driver could make it into Mixxx 1.11. If not, it probably won't be until the 1.12 release, or it may not be accepted and I'll have to spend more time making a translation daemon.

For right now, owners of the MP3e2 or Steel need to use an older kernel with the driver and all its patches.
User avatar
neale
 
Posts: 20
Joined: Sun Jun 24, 2012 9:50 pm

Re: Patch for Hercules kernel mod broken by Linux 2.6.31

Postby faxtrode » Thu Jun 28, 2012 6:28 pm

I compiled the kernel 3.0 from the sources, but when i try to use hdjmod package(Archlinux x64), i get kernel panic whatever kernel version 3.X I use. But I have another laptop where I have Archlinux x86(3.2.X) installed and MP3 E2 works on this kernel with hdjmod package. I compiled and run your driver in the console and when my controller connected to the laptop i get codes in the console when i push any button on it. Have you written anything about your idea to Mixxx development team? May be your idea will be useful for them to resolve our problem. I compiled the last version of Mixxx from BZR using AUR repository on my Archlinux x64. I also read that it is nessesary to add 2 lines in /etc/udev/rules.d/98-hdj.rules to allow to user to write data in HID devices. There is the list of Hercules controllers with commands. There are the lines about Hercules Steel and etc controllers but exept MP3 E2. I don`t know but its content may useful to define the controller.
faxtrode
 
Posts: 15
Joined: Sat Apr 21, 2012 1:43 pm

PreviousNext

Return to Controller presets/mappings

Who is online

Users browsing this forum: No registered users and 1 guest