Help requested: new HSS1394 MIDI back-end
Hello everyone.
I am a developer for Mixxx, GPL cross-platform digital DJ software: http://www.mixxx.org. My focus is the controller subsystem. I am ready to finally add Linux support for HSS1394 DJ controllers such as Stanton's SCS.1m and SCS.1d.
HSS1394 is just MIDI over IEEE1394 (Firewire) at wire speed. The Windows and OSX library source code is LGPL and available on LaunchPad here: https://launchpad.net/hss1394
The Stanton SCS.1m is a sound interface integrated with a two-way control surface that speaks HSS1394. (The sound card uses an Oxford chip set and works fine with FFADO 2.0.1 today up to 96kHz. I use it with Mixxx via JACK.)
The Stanton SCS.1d is a two-way control surface (no sound card) that speaks HSS1394 and is capable of sending ALOT of latency-sensitive data: about 4000 messages per platter rotation. (Now imagine if you had four or even two of them on the same network running at +50% speed. This would quickly overwhelm USB, at least at the time these devices were designed.)
Read about them here:
http://www.stantondj.com/stanton-controllers-systems/system1.html
After a lengthy discussion on the FFADO mailing list, we determined that the best (cleanest and most flexible) way to get Linux support for these devices is to write an ALSA kernel driver that speaks HSS1394 with the devices and presents an ALSA MIDI device (with no data rate limits) for each to Linux applications.
The advantage of doing this is that the devices will appear to all MIDI applications without them having to have specific support for HSS1394. This means they could be used in DAW applications as well.
(FWIW, FFADO trunk has a program called test-scs that does exactly this, but using that is impractical because it depends on various internal parts of the FFADO source so would require bundling all of FFADO with the application, and it's unable to see non-audio devices due to FFADO's intended use (so it sees the SCS.1m but not the .1d.))
So my questions are: where can I find documentation on writing a new MIDI driver for ALSA? And is anyone else interested in helping me do this?
Thank you very much for your time and work. Help me take the last step to my dream DJ setup! (Linux, FLAC and SCS.1 controllers.)
Sincerely,
Sean M. Pappalardo
"D.J. Pegasus"
Mixxx Developer - Controller Specialist
Clemens Ladisch
maintainerQuoted 1 line · Sean M. Pappalardo - D.J. Pegasus
where can I find documentation on writing a new MIDI driver for ALSA?
See the document "Writing an ALSA Driver", and look at the source code of other MIDI drivers, such as, for example, sound/usb/midi.c or the (untested) patch below.
BTW: What is the output of "lsfirewire -v" for these devices?
Regards,
Clemens
sound/firewire/Kconfig +13 -0
@@ -33,4 +33,17 @@ config SND_ISIGHT To compile this driver as a module, choose M here: the module will be called snd-isight. +config SND_SCS1X + tristate "Stanton Control System 1 MIDI" + select SND_PCM + select SND_RAWMIDI + select SND_FIREWIRE_LIB + help + Say Y here to include support for the MIDI ports of the Stanton + SCS.1d/SCS.1m DJ controllers. (SCS.1m audio is still handled + by FFADO.) + + To compile this driver as a module, choose M here: the module + will be called snd-scs1x. + endif # SND_FIREWIRE
sound/firewire/Makefile +2 -0
@@ -2,7 +2,9 @@ snd-firewire-lib-objs := lib.o iso-resources.o packets-buffer.o \ fcp.o cmp.o amdtp.o snd-firewire-speakers-objs := speakers.o snd-isight-objs := isight.o +snd-scs1x-objs := scs1x.o obj-$(CONFIG_SND_FIREWIRE_LIB) += snd-firewire-lib.o obj-$(CONFIG_SND_FIREWIRE_SPEAKERS) += snd-firewire-speakers.o obj-$(CONFIG_SND_ISIGHT) += snd-isight.o +obj-$(CONFIG_SND_SCS1X) += snd-scs1x.o
sound/firewire/scs1x.c new file +447 -0
447 lines not on this page · raw message
Hello again.
Quoted 3 lines · Clemens Ladisch
See the document "Writing an ALSA Driver", and look at the source code of other MIDI drivers, such as, for example,
sound/usb/midi.cor the (untested) patch below.
Holy crap!! Thank you so much for that patch, Clemens! I just updated my kernel and tried it with the SCS.1m but unfortunately it reports an error:
firewire_ohci: isochronous cycle inconsistentfirewire_core: created device fw1: GUID 0012600000000000, S400firewire_core: phy config: card 0, new root=ffc0, gap_count=5 snd_scs1x fw1.0: transaction failed: type errorsnd_scs1x: probe of fw1.0 failed with error -5
Turning on the SCS.1d then yields:firewire_core: phy config: card 0, new root=ffc2, gap_count=7firewire_core: phy config: card 0, new root=ffc2, gap_count=7firewire_core: created device fw2: GUID 0012600100000000, S400
I'm guessing the type error is around line 254 in scs1x.c, but where does tcode come from? (I'm totally green with systems and Firewire programming.) I glanced at the MIDI section of that "writing a driver" PDF before I wrote to this list. I guess I'll go actually read it now. :)
FYI, I'm now on kernel 3.2.18-rt23 #2 SMP PREEMPT x86_64.
Quoted 1 line
BTW: What is the output of "lsfirewire -v" for these devices?
device fw1:
vendor ID: 0x001260
model ID: 0x001000
vendor: Stanton DJ
model: SCS.1m
guid: 0x0012600000000000
units: 0x00a02d:0x010001
unit fw1.0:
model ID: 0x001000
model: SCS.1m
specifier ID: 0x00a02d
version: 0x010001device fw2:
vendor ID: 0x001260
model ID: 0x002000
vendor: Stanton DJ
model: SCS.1d
guid: 0x0012600100000000
units: 0x00a02d:0x010001
unit fw2.0:
model ID: 0x002000
model: SCS.1d
specifier ID: 0x00a02d
version: 0x010001bus 0, node 0: 080028:424296 Texas Instruments TSB41AB1/2 bus 0, node 1: 080028:424296 Texas Instruments TSB41AB1/2
I tried poking around with firewire-request read but didn't find anything interesting. (Then again, I don't really know what I'm looking at or for.)
Sincerely,
Sean M. Pappalardo
"D.J. Pegasus"
Mixxx Developer - Controller Specialist
Clemens Ladisch
maintainerQuoted 4 lines · Sean M. Pappalardo - D.J. Pegasus
I just updated my kernel and tried it with the SCS.1m but unfortunately it reports an error:
firewire_core: created device fw1: GUID 0012600000000000, S400snd_scs1xfw1.0: transaction failed: type error
This is from a snd_fw_transaction call, either the ping or the address setting.
Please check if these commands work:
firewire-request /dev/fwX read c007dedadada 4 firewire-request /dev/fwX write c007dedadada f100123456789abc
In theory, you should be able to write MIDI commands by prefixing them with 00, like this for a note-on:
firewire-request /dev/fwX write c007dedadada 00912345
Quoted 2 lines
Turning on the SCS.1d then yields:
firewire_core: created device fw2: GUID 0012600100000000, S400
FFADO had only the 1m's ID, so the driver does not yet know about the 1d.
Regards,
Clemens
Quoted 3 lines · Clemens Ladisch
Please check if these commands work:
firewire-request
/dev/fwXreadc007dedadada4
type error (on both devices)
Quoted 1 line
firewire-request /dev/fwX write c007dedadada f100123456789abc
no response (on both devices)
Quoted 2 lines
with 00, like this for a note-on:
firewire-request /dev/fwX write c007dedadada 00912345
That worked just fine. I lit up a few LEDs in different colors on both devices, and was able to stop the platter and move the pitch slider on the SCS.1d (yes, its slider is motorized) using CC messages. (I need sysex for the LCD displays though.)
So I feel like we're very close!
Sincerely,
Sean M. Pappalardo
"D.J. Pegasus"
Mixxx Developer - Controller Specialist
Clemens Ladisch
maintainerQuoted 3 lines · Sean M. Pappalardo - D.J. Pegasus
Quoted 1 line
firewire-request /dev/fwX write c007dedadada f100123456789abcno response (on both devices)
No error, which is good.
Quoted 3 lines
Quoted 1 line
firewire-request
/dev/fwXreadc007dedadada4type error (on both devices)
This is supposed to be used to confirm that this is indeed a HSS1394 device. In theory. But we can just omit this check. :)
New patch below (also with .1d support).
Regards,
Clemens
sound/firewire/Kconfig +13 -0
@@ -33,4 +33,17 @@ config SND_ISIGHT To compile this driver as a module, choose M here: the module will be called snd-isight. +config SND_SCS1X + tristate "Stanton Control System 1 MIDI" + select SND_PCM + select SND_RAWMIDI + select SND_FIREWIRE_LIB + help + Say Y here to include support for the MIDI ports of the Stanton + SCS.1d/SCS.1m DJ controllers. (SCS.1m audio is still handled + by FFADO.) + + To compile this driver as a module, choose M here: the module + will be called snd-scs1x. + endif # SND_FIREWIRE
sound/firewire/Makefile +2 -0
@@ -2,7 +2,9 @@ snd-firewire-lib-objs := lib.o iso-resources.o packets-buffer.o \ fcp.o cmp.o amdtp.o snd-firewire-speakers-objs := speakers.o snd-isight-objs := isight.o +snd-scs1x-objs := scs1x.o obj-$(CONFIG_SND_FIREWIRE_LIB) += snd-firewire-lib.o obj-$(CONFIG_SND_FIREWIRE_SPEAKERS) += snd-firewire-speakers.o obj-$(CONFIG_SND_ISIGHT) += snd-isight.o +obj-$(CONFIG_SND_SCS1X) += snd-scs1x.o
sound/firewire/scs1x.c new file +436 -0
436 lines not on this page · raw message
Quoted 1 line · Clemens Ladisch
New patch below (also with .1d support).
Sweet! It works perfectly with the SCS.1m!! The .1d works, but some of the non-standard data it sends appears to be getting corrupted. In particular, the device sends four-byte platter messages that start with 0xF9 and the remaining three can range from 0x00 to 0xFF. These are coming across as random three- or one-byte messages which cause all kinds of mayhem. (See attached amidi dump. Each line should begin with F9 and have three more bytes after it.)
Outbound SYSEX seems fine on both devices.
Sincerely,
Sean M. Pappalardo
"D.J. Pegasus"
Mixxx Developer - Controller Specialist
F9
EC
F2 6B
F9
F0
DC 6B
F9
F4
C5 6B
F9
F8
AE 6B
F9
FC
98 6B
F9 00
81 6B
F9 04
6A 6B
F9
08 53
6B
F9 0C
3C 6B
F9
10 25
6B
F9 14
0E 6B
F9
17
F8 6B
F9
1B
E1 6B
F9 1F
CA 6B
F9
23
B3 6B
F9 27
9C 6B
F9 2B
85 6B
F9 2F
6E 6B
F9
33 57
6B
F9 37
40 6B
F9
3B 29
6B
F9 3F
12 6B
F9
42
FC 6B
F9
46
E5 6B
F9 4A
CE 6B
F9
4E
B7 6B
F9 52
A0 6B
F9 56
89 6B
F9 5A
72 6B
F9
5E 5B
6B
F9 62
44 6B
F9
66 2D
6B
F9 6A
16 6B
F9
6D
FF 6B
F9
71
E8 6B
F9 75
D1 6B
F9
79
BB 6B
F9 7D
A4 6B
F9
81
8D 6B
F9
85 77 6B
F9
89 60 6B
F9
8D 4A 6B
F9
91 33 6B
F9
95 1C 6B
F9
99 06 6B
F9
9C
EF 6B
F9
A0
D8 6B
F9
A4
C2 6B
F9
A8
AB 6B
F9
AC
95 6B
F9
B0 7E 6B
F9
B4 67 6B
F9
B8 51 6B
F9
BC 3A 6B
F9
C0 23
6B
F9
C4 0D
6B
F9
C7
F6
6B
F9
CB
E0 6B
F9
CF
C9 6B
F9
D3
B2 6B
F9
D7
9C 6B
F9
DB
85 6B
F9
DF 6F
6B
F9
E3 58 6B
F9
E7 41 6B
F9
EB 2B 6B
F9
EF 14 6B
F9
F2
FD 6B
F9
F6
E7 6B
F9
FA
D0 6B
F9
BA 6B
F9 02
A3 6B
F9 06
8C 6B
F9 0A
75 6B
F9
0E 5E
6B
F9 12
47 6B
F9
16 30
6B
F9 1A
19 6B
F9
1E 02
6B
F9 21
EB 6B
F9 25
D4 6B
F9
29
BE 6B
F9 2D
A7 6B
F9 31
90 6B
F9 35
79 6B
F9
39 62
6B
F9 3D
4B 6B
F9
41 34
6B
F9 45
1D 6B
F9
49 06
6B
F9 4C
EF 6B
F9 50
D9 6B
F9
54
C2 6B
F9
58
AB 6B
F9 5C
94 6B
F9 60
7D 6B
F9
64 66
6B
F9 68
50 6B
F9
6C 3A
6B
F9 70
23 6B
F9
74 0C
6B
F9 77
F5
6B
F9
7B
DF 6B
F9
7F
C8 6B
F9
83
B2 6B
F9
87
9B 6B
F9
8B
84 6B
F9
8F 6E 6B
F9
93 57 6B
F9
97 40 6B
F9
9B 2A 6B
F9
9F 13 6B
F9
A2
FD 6B
F9
A6
E6 6B
F9
AA
CF 6B
F9
AE
B9 6B
F9
B2
A2 6B
F9
B6
8B 6B
F9
BA 75 6B
F9
BE 5E 6B
F9
C2 48
6B
F9
C6 31
6B
F9
CA 1A
6B
F9
CE 04
6B
F9
D1
ED 6B
F9
D5
D7 6B
F9
D9
C0 6B
F9
DD
A9 6B
F9
E1
93 6B
F9
E5 7C 6B
F9
E9 65 6B
F9
ED 4F 6B
F9
F1 38
6B
F9
F5
22
6B
F9
F9
0B
6B
F9
FC
F4
6B
F9
00
DE 6B
F9
04
C7 6B
F9
08
B0 6B
F9 0C
99 6B
F9 10
82 6B
F9 14
6B 6B
F9
18 54
6B
F9 1C
3E 6B
F9
20 27
6B
F9 24
10 6B
F9
27
F9 6B
F9
2B
E2 6B
F9 2F
CB 6B
F9
33
B4 6B
F9 37
9E 6B
F9 3B
87 6B
F9 3F
70 6B
F9
43 59
6B
F9 47
42 6B
F9
4B 2B
6B
F9 4F
14 6B
F9
52
FD 6B
F9
56
E6 6B
F9 5A
CF 6B
F9
5E
B8 6B
Quoted 9 lines · I wrote:
Quoted 6 lines · I wrote:
Quoted 1 line · Sean M. Pappalardo - D.J. Pegasus
I also see an F9 message slip through once in awhile according to amidi -d:
The driver currently assumes that there is exactly one MIDI message per packet. It appears that this is not true, and if F9 and real MIDI commands are mixed in one packet, the result is not correct.
New patch below.
Ping? Does it work? Wouldn't it be time to move it into the kernel? Would you be OK with this tag on the patch?
Regards,
Clemens
Hello again.
Quoted 1 line · Clemens Ladisch
Ping? Does it work? Wouldn't it be time to move it into the kernel?
I haven't tested the latest one fully and won't be able to for a couple of weeks due to traveling.
Quoted 2 lines
Would you be OK with this tag on the patch?
That's fine. I'm happy to provide help to other users if needed.
Sincerely,
Sean M. Pappalardo
"D.J. Pegasus"
Mixxx Developer - Controller Specialist