From: Clemens Ladisch <clemens@ladisch.de>
To: martin-langer@gmx.de
Cc: alsa-devel@alsa-project.org
Subject: Re: my first usb-midi experiment ends with segmentation fault
Date: Tue, 30 Jul 2002 15:09:37 +0200 [thread overview]
Message-ID: <3D469011.855453A7@ladisch.de> (raw)
In-Reply-To: 20020728213924.GA522@tuba.home
Martin Langer wrote:
> my new USB-MIDI-Keyboard has two USB subclasses usb-midi and usb-audio.
> Evolution, the manufacturer, told me "it's an Audio Class compliant device",
> but I don't find a new entry in /proc/asound/seq/clients after loading the
> modules.
>
> usb.c: registered new driver snd-usb-midi
> snd-usb-midi: using interface 1
> snd-usb-midi: MIDIStreaming version 01.00
> snd-usb-midi: using 1 input jack(s) on endpoint 1
> snd-usb-midi: using 1 output jack(s) on endpoint 2
> snd-usb-midi: detected Evolution Electronics L MK-249C USB MIDI keyboa
> usb.c: snd-usb-midi driver claimed interface dfe688d8
>
> It's not typical to have a midi-keyboard with two subclasses, or?
As Pedro said, subclass 1 is an AudioControl interface. There should be
two cards, one created by snd-usb-audio, and the other one created by
snd-usb-midi (see /proc/asound/cards). The contents of the control
interface (if there are any controls) should be visible in the output
of the "lsusb" command.
Your keyboard is unusual in two respects: it's an Audio Class compliant
device (yes, this _is_ unusual for USB MIDI devices :-) , and it uses
two endpoints, one for each direction. The combination of these two
triggers an ugly bug in the descriptor parsing code (device_info isn't
initialized).
Please try the following patch (the current taciturnity of the driver
is somewhat inconvenient, so it adds some error messages as well).
Index: usb/usbmidi.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/usb/usbmidi.c,v
retrieving revision 1.4
diff -u -r1.4 usbmidi.c
--- usb/usbmidi.c 5 Jul 2002 13:39:28 -0000 1.4
+++ usb/usbmidi.c 30 Jul 2002 12:39:00 -0000
@@ -834,8 +834,10 @@
port = snd_seq_event_port_attach(umidi->seq_client,
&port_callback,
cap, type, port_name);
- if (port < 0)
+ if (port < 0) {
+ snd_printk(KERN_ERR "cannot create port (error code %d)\n", err);
return port;
+ }
if (in)
umidi->endpoints[ep].in->ports[c].seq_port = port;
@@ -1084,6 +1086,8 @@
usb_ms_endpoint_descriptor_t* ms_ep;
int i, epidx;
+ memset(device_info, 0, sizeof(*device_info));
+
if (usb_device->descriptor.iManufacturer == 0 ||
usb_string(usb_device, usb_device->descriptor.iManufacturer,
device_info->vendor, sizeof(device_info->vendor)) < 0)
@@ -1180,12 +1184,15 @@
{
usbmidi_device_info_t device_info;
snd_card_t* card = NULL;
+ int err;
if (snd_usbmidi_get_device_info(device, ifnum, device_id,
&device_info) == 0) {
printk(KERN_INFO "snd-usb-midi: detected %s %s\n",
device_info.vendor, device_info.product);
- snd_usbmidi_card_create(device, &device_info, &card);
+ err = snd_usbmidi_card_create(device, &device_info, &card);
+ if (err < 0)
+ snd_printk(KERN_ERR "cannot create card (error code %d)\n", err);
}
return card;
}
> ... and doing rmmod snd-usb-midi and rmmod snd-usb-audio ends here with
> Segmentation fault:
>
> Jul 28 22:28:10 tuba kernel: usb.c: deregistering driver snd-usb-midi
> Jul 28 22:28:10 tuba kernel: Unable to handle kernel paging request at
> virtual address 29323034
>
> a small bug or a big hole?
A small bug which results in a big mess.
HTH
Clemens
-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
next prev parent reply other threads:[~2002-07-30 13:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-28 21:39 my first usb-midi experiment ends with segmentation fault Martin Langer
2002-07-29 10:40 ` Takashi Iwai
2002-07-29 12:30 ` Martin Langer
2002-07-29 21:51 ` Pedro Lopez-Cabanillas
2002-07-30 13:09 ` Clemens Ladisch [this message]
2002-07-30 15:08 ` Pedro Lopez-Cabanillas
2002-07-30 16:38 ` Clemens Ladisch
2002-07-30 18:18 ` Martin Langer
2002-07-30 21:42 ` Martin Langer
2002-07-30 21:43 ` Pedro Lopez-Cabanillas
2002-07-31 10:02 ` [Alsa-devel][Patch] usbmidi fixes Clemens Ladisch
2002-07-31 10:45 ` Martin Langer
2002-07-31 14:38 ` Takashi Iwai
2002-07-31 10:26 ` my first usb-midi experiment ends with segmentation fault Clemens Ladisch
2002-07-31 21:02 ` Martin Langer
2002-08-01 9:48 ` Clemens Ladisch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D469011.855453A7@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=martin-langer@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.