[alsa-devel] Alsa Driver Development - General Concepts
Hi,
I've got a couple of audio/midi devices knocking around that I'd quite like to add ALSA support for (for use in Linux sequencers/DAWs) so I've been reading up on Linux device drivers and Alsa driver development.
I do have a programming background but unfortunately, I'm a little confused on a couple of points and I was hoping someone wouldn't mind helping me out.
I'm kind of basing my thoughts on the idea that I have a USB device which is not recognised by the kernel and does not expose a known midi interface (so requires a completely new Alsa driver?). The goal would be for this device to be usable in Linux midi sequencers.
- How does the Alsa driver communicate with the hardware? Would I need to write a Kernel driver (e.g. a character device) for the Alsa driver to talk to?
- Would my Alsa driver basically create a card instance and then a RawMidi component? I'm assuming the use of RawMidi would then allow applications to recognise the Alsa driver as a seemingly ordinary midi port??? Then implement _input_trigger() and _output_trigger() to exchange data with the application, whilst passing data to/from the kernel driver to talk to the hardware?
Sorry if I'm way off base. I'm trying to get in on this thing to help spread some extra Linux love in music world.
Many thanks.
On Wednesday 26 November 2008 15:48:26 karl@lil-voodoo.co.uk wrote:
Hi,
I've got a couple of audio/midi devices knocking around that I'd quite like to add ALSA support for (for use in Linux sequencers/DAWs) so I've been reading up on Linux device drivers and Alsa driver development.
I do have a programming background but unfortunately, I'm a little confused on a couple of points and I was hoping someone wouldn't mind helping me out.
I know the feeling. I'm just starting out on this too.
I'm kind of basing my thoughts on the idea that I have a USB device which is not recognised by the kernel and does not expose a known midi interface (so requires a completely new Alsa driver?). The goal would be for this device to be usable in Linux midi sequencers.
I would be careful on what you mean by "not recognised by the kernel". In a typical distro the "recognition" is not done by the kernel, but by some external utility which scans the hardware and attempts to associate the devices with drivers. Things like kudzu, harddrake, hotplugging and udev are things to research here.
It's entirely possible that the existing alsa modules are compatible with your equipment, but that they are not recognised by whatever utility your distro uses. It may simply require adding the USB vid/pid to the appropriate config files.
Of coure you can probably exeriment by loading the modules manually to see if they work.
- How does the Alsa driver communicate with the hardware? Would I need to
write a Kernel driver (e.g. a character device) for the Alsa driver to talk to?
Err, dunno, but as you're looking at developing a usb device driver, looking at the snd-usb-audio driver code might be a good place to start.
It may well be that a small patch to this code is all that is required, rather than developing a new driver from scratch.
Cheers,
Hi Keith,
I would be careful on what you mean by "not recognised by the kernel". In a typical distro the "recognition" is not done by the kernel, but by some external utility which scans the hardware and attempts to associate the devices with drivers. Things like kudzu, harddrake, hotplugging and udev are things to research here.
Yeah I didn't think through what I was saying there. The devices are recognised by the various parts of Linux (openSuse in this case) but no drivers are loaded.
I think I'm going to have to get used to writing drivers at some point in my Linux life, so might as well start with these simpler devices - even if some of the existing stuff would work given a few config changes.
Cheers mate.
At Wed, 26 Nov 2008 16:27:15 -0000 (UTC), Karl Dyson wrote:
Hi Keith,
I would be careful on what you mean by "not recognised by the kernel". In a typical distro the "recognition" is not done by the kernel, but by some external utility which scans the hardware and attempts to associate the devices with drivers. Things like kudzu, harddrake, hotplugging and udev are things to research here.
Yeah I didn't think through what I was saying there. The devices are recognised by the various parts of Linux (openSuse in this case) but no drivers are loaded.
When the device isn't recognized even after you load the kernel driver manually, it means usually that the device isn't supported. No automatic h/w detection problem.
A wild guess is that your device isn't USB standard class compliant. In most cases, weird devices provide via vendor-specific definitions although it's compatible with the standard. Just doing some quirk often solves the problem.
Takashi
participants (4)
-
Karl Dyson
-
karl@lil-voodoo.co.uk
-
Keith A. Milner
-
Takashi Iwai