All of lore.kernel.org
 help / color / mirror / Atom feed
* my first usb-midi experiment ends with segmentation fault
@ 2002-07-28 21:39 Martin Langer
  2002-07-29 10:40 ` Takashi Iwai
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Martin Langer @ 2002-07-28 21:39 UTC (permalink / raw)
  To: alsa-devel


Hi,

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.

cat /proc/bus/usb/devices 

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=01(audio) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0a4d ProdID=008e Rev= 2.00
S:  Manufacturer=Evolution Electronics Ltd.
S:  Product=MK-249C USB MIDI keyboard
C:* #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
I:  If#= 1 Alt= 0 #EPs= 2 Cls=01(audio) Sub=03 Prot=00 Driver=snd-usb-midi
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms


dmesg:

usb.c: registered new driver snd-usb-audio
usb.c: snd-usb-audio driver claimed interface dfe688c0
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?
... and doing rmmod snd-usb-midi and rmmod snd-usb-audio ends here with 
Segmentation fault:


Jul 28 22:28:07 tuba kernel: usb.c: deregistering driver snd-usb-audio
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
Jul 28 22:28:10 tuba kernel:  printing eip:
Jul 28 22:28:10 tuba kernel: e2858329
Jul 28 22:28:10 tuba kernel: *pde = 00000000
Jul 28 22:28:10 tuba kernel: Oops: 0002
Jul 28 22:28:10 tuba kernel: CPU:    0
Jul 28 22:28:10 tuba kernel: EIP:
0010:[snd-dt019x:__insmod_snd-dt019x_O/lib/modules/2.4.19-rc1/kernel/sound/i+-195799/96]
   Not tainted
   Jul 28 22:28:10 tuba kernel: EFLAGS: 00210246
   Jul 28 22:28:10 tuba kernel: eax: 29323030   ebx: dcb21940   ecx:
dcb21984   edx: dcb21900
Jul 28 22:28:10 tuba kernel: esi: d900d000   edi: 00001fff   ebp: e2b637dc
esp: d84cdee4
Jul 28 22:28:10 tuba kernel: ds: 0018   es: 0018   ss: 0018
Jul 28 22:28:10 tuba kernel: Process rmmod (pid: 529, stackpage=d84cd000)
Jul 28 22:28:10 tuba kernel: Stack: d9662dc0 db38cc00 e28583ed d900d000
e2854e5a d9662dc0 00001000 e2854fc5 
Jul 28 22:28:10 tuba kernel:        db38cc00 d900d000 db38cc00 00000001
e2b637c0 e28519ae db38cc00 00000001 
Jul 28 22:28:10 tuba kernel:        00000000 e2b62a01 db38cc00 dfe68898
c021e47d dfe67800 db38cc00 dfe67300 
Jul 28 22:28:10 tuba kernel: Call Trace:
[snd-dt019x:__insmod_snd-dt019x_O/lib/modules/2.4.19-rc1/kernel/sound/i+-195603/96]
[snd-dt019x:__insmod_snd-dt019x_O/lib/modules/2.4.19-rc1/kernel/sound/i+-209318/96]
[snd-dt019x:__insmod_snd-dt019x_O/lib/modules/2.4.19-rc1/kernel/sound/i+-208955/96]
[<e2b637c0>]
[snd-dt019x:__insmod_snd-dt019x_O/lib/modules/2.4.19-rc1/kernel/sound/i+-222802/96]

Jul 28 22:28:10 tuba kernel:    [<e2b62a01>] [usb_drivers_purge+141/224]
[<e2b637c0>] [usb_drivers_purge+62/224] [<e2b637c0>] [<e2b637c0>] 
Jul 28 22:28:10 tuba kernel:    [usb_deregister+114/144] [<e2b637c0>]
[<e2b62a8a>] [<e2b637c0>] [free_module+23/160] [sys_delete_module+247/448] 
Jul 28 22:28:10 tuba kernel:    [system_call+51/56] 
Jul 28 22:28:10 tuba kernel: 
Jul 28 22:28:10 tuba kernel: Code: 89 50 04 89 02 ff 4b 3c ff 43 44 0f 8e 05
07 00 00 53 56 e8 


a small bug or a big hole?

martin


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  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
  2 siblings, 1 reply; 16+ messages in thread
From: Takashi Iwai @ 2002-07-29 10:40 UTC (permalink / raw)
  To: martin-langer; +Cc: alsa-devel

At Sun, 28 Jul 2002 23:39:24 +0200,
Martin Langer wrote:
> 
> 
> Hi,
> 
> 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.
> 
> cat /proc/bus/usb/devices 
> 
> T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
> D:  Ver= 1.00 Cls=01(audio) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
> P:  Vendor=0a4d ProdID=008e Rev= 2.00
> S:  Manufacturer=Evolution Electronics Ltd.
> S:  Product=MK-249C USB MIDI keyboard
> C:* #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=  0mA
> I:  If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
> I:  If#= 1 Alt= 0 #EPs= 2 Cls=01(audio) Sub=03 Prot=00 Driver=snd-usb-midi
> E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
> E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
> 
> 
> dmesg:
> 
> usb.c: registered new driver snd-usb-audio
> usb.c: snd-usb-audio driver claimed interface dfe688c0
> 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?

it's ok.
so far, audio and midi are implemented in separate ways.
yes, it would be nice if they are integrated, though.

> ... and doing rmmod snd-usb-midi and rmmod snd-usb-audio ends here with 
> Segmentation fault:
> 
> 
> Jul 28 22:28:07 tuba kernel: usb.c: deregistering driver snd-usb-audio
> 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
> Jul 28 22:28:10 tuba kernel:  printing eip:
> Jul 28 22:28:10 tuba kernel: e2858329
> Jul 28 22:28:10 tuba kernel: *pde = 00000000
> Jul 28 22:28:10 tuba kernel: Oops: 0002
> Jul 28 22:28:10 tuba kernel: CPU:    0
> Jul 28 22:28:10 tuba kernel: EIP:
> 0010:[snd-dt019x:__insmod_snd-dt019x_O/lib/modules/2.4.19-rc1/kernel/sound/i+-195799/96]

hmm, why snd-dt019x module appears here..?
was it loaded?  the trace seems corrupted...

could you try to put snd-usb-audio to /etc/hotplug/blacklist, so that
it's not automatically loaded.  then we'll know the problem is related
only with snd-usb-midi.


Takashi


-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  2002-07-29 10:40 ` Takashi Iwai
@ 2002-07-29 12:30   ` Martin Langer
  0 siblings, 0 replies; 16+ messages in thread
From: Martin Langer @ 2002-07-29 12:30 UTC (permalink / raw)
  To: alsa-devel, tiwai

On Mon, Jul 29, 2002 at 12:40:51PM +0200, Takashi Iwai wrote:
> At Sun, 28 Jul 2002 23:39:24 +0200,
> Martin Langer wrote:
> > ... and doing rmmod snd-usb-midi and rmmod snd-usb-audio ends here with 
> > Segmentation fault:
> > 
> > 
> > Jul 28 22:28:07 tuba kernel: usb.c: deregistering driver snd-usb-audio
> > 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
> > Jul 28 22:28:10 tuba kernel:  printing eip:
> > Jul 28 22:28:10 tuba kernel: e2858329
> > Jul 28 22:28:10 tuba kernel: *pde = 00000000
> > Jul 28 22:28:10 tuba kernel: Oops: 0002
> > Jul 28 22:28:10 tuba kernel: CPU:    0
> > Jul 28 22:28:10 tuba kernel: EIP:
> > 0010:[snd-dt019x:__insmod_snd-dt019x_O/lib/modules/2.4.19-rc1/kernel/sound/i+-195799/96]
> 
> hmm, why snd-dt019x module appears here..?
> was it loaded?  the trace seems corrupted...
> 

yes, snd-dt019x was loaded, but that make no difference.

> could you try to put snd-usb-audio to /etc/hotplug/blacklist, so that
> it's not automatically loaded.  then we'll know the problem is related
> only with snd-usb-midi.
> 

in both cases:
- without snd-usb-audio
- without snd-usb-audio and without snd-dt019x 
the same occurs. Yes, good arguments for a problem in snd-usb-midi. Here is
what I have done: just a modprobe and rmmod.

-------------------

tuba:~# lsmod 
Module                  Size  Used by    Not tainted
snd-mixer-oss           9056   0  (autoclean) (unused)
snd                    24136   0  (autoclean) [snd-mixer-oss]
soundcore               3364   0  (autoclean) [snd]
tuba:~# modprobe snd-usb-midi
tuba:~# rmmod snd-usb-midi
Segmentation fault
tuba:~# lsmod
Module                  Size  Used by    Not tainted
snd-usb-midi               0   0  (deleted)
snd-seq-virmidi         2728   0  [snd-usb-midi]
snd-seq-midi-event      2872   0  [snd-usb-midi snd-seq-virmidi]
snd-seq                37356   0  [snd-usb-midi snd-seq-virmidi
snd-seq-midi-event]
snd-timer              10400   0  [snd-seq]
snd-rawmidi            12224   0  [snd-seq-virmidi]
snd-seq-device          3856   0  [snd-usb-midi snd-seq snd-rawmidi]
snd-mixer-oss           9056   0  (autoclean) (unused)
snd                    24136   0  (autoclean) [snd-usb-midi snd-seq-virmidi
snd-seq-midi-event snd-seq snd-timer snd-rawmidi snd-seq-device snd-mixer-oss]
soundcore               3364   0  (autoclean) [snd]
tuba:~# 

--------------------

Jul 29 14:15:09 tuba kernel: usb.c: registered new driver snd-usb-midi
Jul 29 14:15:09 tuba kernel: snd-usb-midi: using interface 1
Jul 29 14:15:09 tuba kernel: snd-usb-midi: MIDIStreaming version 01.00
Jul 29 14:15:09 tuba kernel: snd-usb-midi: using 1 input jack(s) on endpoint 1
Jul 29 14:15:09 tuba kernel: snd-usb-midi: using 1 output jack(s) on
endpoint 2
Jul 29 14:15:09 tuba kernel: snd-usb-midi: detected Evolution Electronics L
MK-2
49C USB MIDI keyboa
Jul 29 14:15:14 tuba kernel: usb.c: deregistering driver snd-usb-midi
Jul 29 14:15:14 tuba kernel:  printing eip:
Jul 29 14:15:14 tuba kernel: e2b20329
Jul 29 14:15:14 tuba kernel: Oops: 0002
Jul 29 14:15:14 tuba kernel: CPU:    0
Jul 29 14:15:14 tuba kernel: EIP:    0010:[<e2b20329>]    Not tainted
Jul 29 14:15:14 tuba kernel: EFLAGS: 00210246
Jul 29 14:15:14 tuba kernel: eax: 29323030   ebx: db5021c0   ecx: db502204
edx
: db502100
Jul 29 14:15:14 tuba kernel: esi: db500c00   edi: 00001fff   ebp: e2b3b7dc
esp
: db041ee4
Jul 29 14:15:14 tuba kernel: ds: 0018   es: 0018   ss: 0018
Jul 29 14:15:14 tuba kernel: Process rmmod (pid: 485, stackpage=db041000)
Jul 29 14:15:14 tuba kernel: Stack: daf98380 dd446e00 e2b203ed db500c00
e2b18e5a
 daf98380 00001000 e2b18fc5 
 Jul 29 14:15:14 tuba kernel:        dd446e00 db500c00 dd446e00 00000001
e2b3b7c0
 e2b159ae dd446e00 00000001 
 Jul 29 14:15:14 tuba kernel:        00000000 e2b3aa01 dd446e00 dfe688d8
c021e47d
 dfe67800 dd446e00 dfe67300 
 Jul 29 14:15:14 tuba kernel: Call Trace: [<e2b203ed>] [<e2b18e5a>]
[<e2b18fc5>] 
[<e2b3b7c0>] [<e2b159ae>] 
Jul 29 14:15:14 tuba kernel:    [<e2b3aa01>] [usb_drivers_purge+141/224]
[<e2b3b
7c0>] [usb_drivers_purge+62/224] [<e2b3b7c0>] [<e2b3b7c0>] 
Jul 29 14:15:14 tuba kernel:    [usb_deregister+114/144] [<e2b3b7c0>]
[<e2b3aa8a
>] [<e2b3b7c0>] [free_module+23/160] [sys_delete_module+247/448] 
Jul 29 14:15:14 tuba kernel:    [system_call+51/56] 
Jul 29 14:15:14 tuba kernel: 
Jul 29 14:15:14 tuba kernel: Code: 89 50 04 89 02 ff 4b 3c ff 43 44 0f 8e 05
07 
00 00 53 56 e8 



-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  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 21:51 ` Pedro Lopez-Cabanillas
  2002-07-30 13:09 ` Clemens Ladisch
  2 siblings, 0 replies; 16+ messages in thread
From: Pedro Lopez-Cabanillas @ 2002-07-29 21:51 UTC (permalink / raw)
  To: martin-langer; +Cc: ALSA devel

Hello!

I'm happy to see that I'm not the only MIDI guy at ALSA-USB world :)

El Dom 28 Jul 2002 23:39, Martin Langer escribió:
> 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.
>
> cat /proc/bus/usb/devices
>
> T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
> D:  Ver= 1.00 Cls=01(audio) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
> P:  Vendor=0a4d ProdID=008e Rev= 2.00
> S:  Manufacturer=Evolution Electronics Ltd.
> S:  Product=MK-249C USB MIDI keyboard
> C:* #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=  0mA
> I:  If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
> I:  If#= 1 Alt= 0 #EPs= 2 Cls=01(audio) Sub=03 Prot=00 Driver=snd-usb-midi
> E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
> E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
>
>
> dmesg:
>
> usb.c: registered new driver snd-usb-audio
> usb.c: snd-usb-audio driver claimed interface dfe688c0
> 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?

IMHO, those descriptors are very close to the USB-Audio specification. Your 
keyboard presents two interfaces: an AudioControl interface (Sub=01) and a  
MIDIStreaming one (Sub=03). Perhaps the snd-usb-audio claims making a very 
quick decision based only on the AudioControl interface. The AudioStreaming 
interface is Sub=02, and your keyboard has not one.

I am using two USB MIDI devices at home, both with the snd-usb-midi driver; an  
Edirol UM-2 (semi-compliant) and a Midiman Midisport 2x2, with a nice GPL  
firmware by Lars Doelle, that tryes to follow the standard. FYI, these are my 
last device descriptors:

T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0763 ProdID=1110 Rev= 0.01
S:  Manufacturer=Midiman
S:  Product=Midisport 2x2
S:  SerialNumber=Copyright (GPLv2) 2001 by Lars Doelle 
<lars.doelle@on-line.de>
C:* #Ifs= 2 Cfg#= 1 Atr=00 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=(none)
I:  If#= 1 Alt= 0 #EPs= 2 Cls=01(audio) Sub=03 Prot=00 Driver=snd-usb-midi
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=  0ms

As you can see, very similar to yours.

You can find the specs at http://www.usb.org/
The relevant documents about USB Audio Class and USB MIDI subclass are:
- Universal Serial Bus Revision 1.1 specification,
http://www.usb.org/developers/data/usbspec.zip
- Audio Device Document 1.0,
http://www.usb.org/developers/data/devclass/audio10.pdf
- USB MIDI Devices 1.0,
http://www.usb.org/developers/data/devclass/midi10.pdf


> ... and doing rmmod snd-usb-midi and rmmod snd-usb-audio ends here with
> Segmentation fault:
>

I can't reproduce this behaviour at home. Perhaps the jack or endpoint 
descriptor parser in snd-usb-midi gets confused for your keyboard. AFAIK, the 
MK-249C is not listed as tested or supported, though.

What I do is blacklist all the snd-usb-* and the corresponding usb oss 
modules, avoiding hotplug from loading them. Instead, the /etc/init.d/alsa 
boot script loads them, with some /etc/modules.conf lines like these:

alias char-major-14 soundcore
alias char-major-116 snd
alias snd-card-0 snd-ens1371
alias snd-card-1 snd-usb-midi
alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss

This is not very coherent with the usual USB devices hotplugging capabilities, 
but you have the chance of setting some options. Anyway, if your device is 
not 100% standard, perhaps you have to tweak the alsa-driver/usb/usbmidi.c 
file (search for 'snd_usbmidi_usb_id_table').

Another option is to use the daemon, that runs in userspace, and perhaps can 
be easy for experiment with it, along with hotplug.
You can find it at: http://www.informatik.uni-halle.de/~ladischc/usbmidid.html


Regards,
Pedro



-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  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 21:51 ` Pedro Lopez-Cabanillas
@ 2002-07-30 13:09 ` Clemens Ladisch
  2002-07-30 15:08   ` Pedro Lopez-Cabanillas
  2 siblings, 1 reply; 16+ messages in thread
From: Clemens Ladisch @ 2002-07-30 13:09 UTC (permalink / raw)
  To: martin-langer; +Cc: alsa-devel

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  2002-07-30 13:09 ` Clemens Ladisch
@ 2002-07-30 15:08   ` Pedro Lopez-Cabanillas
  2002-07-30 16:38     ` Clemens Ladisch
  0 siblings, 1 reply; 16+ messages in thread
From: Pedro Lopez-Cabanillas @ 2002-07-30 15:08 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: ALSA devel

El Mar 30 Jul 2002 15:09, Clemens Ladisch escribió:
> -		if (port < 0)
> +		if (port < 0) {
> +			snd_printk(KERN_ERR "cannot create port (error code %d)\n", err);
>  			return port;

I think that you mean:
			snd_printk(KERN_ERR "cannot create port (error code %d)\n", port);

Right? :)

Pedro.


-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  2002-07-30 15:08   ` Pedro Lopez-Cabanillas
@ 2002-07-30 16:38     ` Clemens Ladisch
  2002-07-30 18:18       ` Martin Langer
  0 siblings, 1 reply; 16+ messages in thread
From: Clemens Ladisch @ 2002-07-30 16:38 UTC (permalink / raw)
  To: alsa-devel; +Cc: martin-langer

Pedro Lopez-Cabanillas wrote:
> 
> El Mar 30 Jul 2002 15:09, Clemens Ladisch escribió:
> > -             if (port < 0)
> > +             if (port < 0) {
> > +                     snd_printk(KERN_ERR "cannot create port (error code %d)\n", err);
> >                       return port;
> 
> I think that you mean:
>                         snd_printk(KERN_ERR "cannot create port (error code %d)\n", port);
> 
> Right? :)

Yes, thank you.

Here again the same patch, now correct. (I hope :-)


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 16:33:28 -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", port);
 			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;
 }



-------------------------------------------------------
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_code1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  2002-07-30 16:38     ` Clemens Ladisch
@ 2002-07-30 18:18       ` Martin Langer
  2002-07-30 21:42         ` Martin Langer
                           ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Martin Langer @ 2002-07-30 18:18 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, plcl

On Tue, Jul 30, 2002 at 03:09:37PM +0200, Clemens Ladisch wrote:
> Martin Langer wrote:
> > snd-usb-midi: detected Evolution Electronics L MK-249C USB MIDI keyboa
> 
> 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).
> 

Thanks for all patches, but I don't found an error in the log-files. The last
line is/was always the detection, which seems to work fine (see above). I'm 
still missing a client in /proc/asound/seq/clients, so the driver never
reaches the port creation and I have no additional output from your patch.
Something else must be between usb-detection and creation of the port!

Also the entry in the /proc/asound/cards is/was all the time there, btw: I
have no hotplugtools installed, everything is manually loaded on my machine.

tuba:~# cat /proc/asound/cards 
0 [card0          ]: USB MIDI - Evolution Electronics L MK-249C Evolution
Electronics L MK-249C Evolution Elect (a4d:8e if 1 at 001/002)
                     Evolution Electronics L MK-249C Evolution Elect (a4d:8e
if 1 at 001/002)
1 [card1          ]: USB-Audio - USB Audio Driver
                     Evolution Electronics Ltd. MK-249C USB MIDI keyboard


The only strange thing I found are the unknown parts of the lsusb output
(broken descriptor?) and the impossible module reload = segfault.

martin


Bus 001 Device 002: ID 0a4d:008e  
  Language IDs: none (invalid length string descriptor bf; len=0)
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            1 Audio
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0a4d 
  idProduct          0x008e 
  bcdDevice            2.00
  iManufacturer           1 
  iProduct                2 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          101
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          3
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength            9
        bInCollection           1
        baInterfaceNr( 0)       1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 Non Streaming
      bInterfaceProtocol      0 
      iInterface              0 
  unknown descriptor type: 07 24 01 00 01 41 00
  unknown descriptor type: 06 24 02 01 01 00
  unknown descriptor type: 06 24 02 02 02 00
  unknown descriptor type: 09 24 03 01 03 01 02 01 00
  unknown descriptor type: 09 24 03 02 04 01 01 01 00
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               none
        wMaxPacketSize         64
        bInterval               0
        bRefresh                0
        bSynchAddress           0
  unknown descriptor type: 05 25 01 01 03
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               none
        wMaxPacketSize         64
        bInterval               0
        bRefresh                0
        bSynchAddress           0
  unknown descriptor type: 05 25 01 01 01
  Language IDs: none (invalid length string descriptor bf; len=0)




-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  2002-07-30 18:18       ` Martin Langer
@ 2002-07-30 21:42         ` Martin Langer
  2002-07-30 21:43         ` Pedro Lopez-Cabanillas
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Martin Langer @ 2002-07-30 21:42 UTC (permalink / raw)
  To: alsa-devel; +Cc: clemens, plcl

On Tue, Jul 30, 2002 at 08:18:34PM +0200, Martin Langer wrote:
> Bus 001 Device 002: ID 0a4d:008e  
>   Language IDs: none (invalid length string descriptor bf; len=0)
> Device Descriptor:
>   bLength                18

Ohhhhh, two lines of lsusb were missing in my mail. 
It has to be so (with "string descriptor X invalid ..."):


Bus 001 Device 002: ID 0a4d:008e  
  Language IDs: none (invalid length string descriptor bf; len=0)
string descriptor 1 invalid (bf bf; len=0)
string descriptor 2 invalid (bf bf; len=0)
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            1 Audio
  bDeviceSubClass         0 
  bDeviceProtocol         0 
	      


-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  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:26         ` my first usb-midi experiment ends with segmentation fault Clemens Ladisch
  3 siblings, 0 replies; 16+ messages in thread
From: Pedro Lopez-Cabanillas @ 2002-07-30 21:43 UTC (permalink / raw)
  To: martin-langer, Clemens Ladisch; +Cc: alsa-devel

El Mar 30 Jul 2002 20:18, Martin Langer escribió:
> The only strange thing I found are the unknown parts of the lsusb output
> (broken descriptor?) and the impossible module reload = segfault.
>

These 'unknown descriptor' lines at lsusb output are jack descriptors and MS 
endpoint descriptors, as required by the specification documents (see 
midi10.pdf, pages 39-43). The lsusb utility should be updated.

I will try to manually decode that descriptors.

>
> Bus 001 Device 002: ID 0a4d:008e
>   Language IDs: none (invalid length string descriptor bf; len=0)
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               1.00
>   bDeviceClass            1 Audio
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0        64
>   idVendor           0x0a4d
>   idProduct          0x008e
>   bcdDevice            2.00
>   iManufacturer           1
>   iProduct                2
>   iSerial                 0
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength          101
>     bNumInterfaces          2
>     bConfigurationValue     1
>     iConfiguration          3
>     bmAttributes         0xc0
>       Self Powered
>     MaxPower                0mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass         1 Audio
>       bInterfaceSubClass      1 Control Device
>       bInterfaceProtocol      0
>       iInterface              0
>       AudioControl Interface Descriptor:
>         bLength                 9
>         bDescriptorType        36
>         bDescriptorSubtype      1 (HEADER)
>         bcdADC               1.00
>         wTotalLength            9
>         bInCollection           1
>         baInterfaceNr( 0)       1
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass         1 Audio
>       bInterfaceSubClass      3 Non Streaming
>       bInterfaceProtocol      0
>       iInterface              0
>   unknown descriptor type: 07 24 01 00 01 41 00
		Class Specific Interface Descriptor
			bLength				7
			bDescriptorType		0x24  (CS_INTERFACE)
			bDescriptorSubtype		1  header
			bcdADC				1.0
			wTotalLength			65 

>   unknown descriptor type: 06 24 02 01 01 00
		MIDI Jack Descriptor
			bLength				6
			bDescriptorType		0x24
			bDescriptorSubtype		2  IN
			bJackType				1  EMBEDDED
			bJackID				1

>   unknown descriptor type: 06 24 02 02 02 00
		MIDI Jack Descriptor
			bLength				6
			bDescriptorType		0x24
			bDescriptorSubtype		2  IN
			bJackType				2  EXTERNAL
			bJackID				2

>   unknown descriptor type: 09 24 03 01 03 01 02 01 00
		MIDI Jack Descriptor
			bLength				9
			bDescriptorType		0x24
			bDescriptorSubtype		3  OUT
			bJackType				1  EMBEDDED
			bJackID				3
			bNrInputPins			1
			BaSourceID			2
			BaSourcePin			1

>   unknown descriptor type: 09 24 03 02 04 01 01 01 00
		MIDI Jack Descriptor
			bLength				9
			bDescriptorType		0x24
			bDescriptorSubtype		3  OUT
			bJackType				2  EXTERNAL
			bJackID				4
			bNrInputPins			1
			BaSourceID			1
			BaSourcePin			1

>       Endpoint Descriptor:
>         bLength                 9
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               none
>         wMaxPacketSize         64
>         bInterval               0
>         bRefresh                0
>         bSynchAddress           0
>   unknown descriptor type: 05 25 01 01 03
			MIDIStreaming Bulk Endpoint Descriptor
				bLength				5
				bDescriptorType		0x25 (CS_ENDPOINT)
				bDescriptorSubtype		1 MS_GENERAL
				bNumEmbMIDIJack		1
				BaAssocJackID			3

>       Endpoint Descriptor:
>         bLength                 9
>         bDescriptorType         5
>         bEndpointAddress     0x02  EP 2 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               none
>         wMaxPacketSize         64
>         bInterval               0
>         bRefresh                0
>         bSynchAddress           0
>   unknown descriptor type: 05 25 01 01 01
			MIDIStreaming Bulk Endpoint Descriptor
				bLength				5
				bDescriptorType		0x25 (CS_ENDPOINT)
				bDescriptorSubtype		1 MS_GENERAL
				bNumEmbMIDIJack		1
				BaAssocJackID			1

>   Language IDs: none (invalid length string descriptor bf; len=0)

Regards,
Pedro





-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Alsa-devel][Patch] usbmidi fixes
  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         ` 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
  3 siblings, 2 replies; 16+ messages in thread
From: Clemens Ladisch @ 2002-07-31 10:02 UTC (permalink / raw)
  To: Martin Langer; +Cc: alsa-devel, Takashi Iwai


Below is the final version of my changes to usbmidi.c.
I used the opportunity to make some further fixes.

These changes are desirable even if (apparently) they don't fix
Martin's problem.


- enlarged vendor/device name strings
- fixed buffer overflow for card->shortname
- added error messages if initialization fails
- made information messages more consistent
- fixed module_setup comment


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	31 Jul 2002 10:00:51 -0000
@@ -167,8 +167,8 @@
  * or is supplied explicitly for broken devices.
  */
 struct usbmidi_device_info {
-	char vendor[24];		/* vendor name */
-	char product[24];		/* device name */
+	char vendor[32];		/* vendor name */
+	char product[32];		/* device name */
 	int16_t ifnum;			/* interface number */
 	struct usbmidi_endpoint_info {
 		int16_t epnum;		/* endpoint number,
@@ -803,7 +803,7 @@
 	int cap, type, port;
 	int out, in;
 	snd_seq_port_callback_t port_callback;
-	char port_name[40];
+	char port_name[48];
 
 	for (c = 0; c < 0x10; ++c) {
 		out = ep_info->out_cables & (1 << c);
@@ -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", port);
 			return port;
+		}
 		if (in)
 			umidi->endpoints[ep].in->ports[c].seq_port = port;
 
@@ -889,7 +891,7 @@
 		err = snd_usbmidi_create_endpoint_ports(umidi, i, &port_idx);
 		if (err < 0)
 			return err;
-		printk(KERN_INFO "snd-usb-midi: endpoint %d: %d output and %d input ports\n",
+		printk(KERN_INFO "snd-usb-midi: endpoint %d: created %d output and %d input ports\n",
 		       ep_info->epnum,
 		       snd_usbmidi_count_bits(ep_info->out_cables),
 		       snd_usbmidi_count_bits(ep_info->in_cables));
@@ -972,12 +974,12 @@
 		return -ENOMEM;
 	}
 	strcpy(card->driver, "USB MIDI");
-	sprintf(card->shortname, "%s %s",
-		device_info->vendor, device_info->product);
-	sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
-		card->shortname, usb_device->descriptor.idVendor,
-		usb_device->descriptor.idProduct, device_info->ifnum,
-		usb_device->bus->busnum, usb_device->devnum);
+	snprintf(card->shortname, sizeof(card->shortname), "%s %s",
+		 device_info->vendor, device_info->product);
+	snprintf(card->longname, sizeof(card->longname), "%s %s at %03d/%03d if %d",
+		 device_info->vendor, device_info->product,
+		 usb_device->bus->busnum, usb_device->devnum,
+		 device_info->ifnum);
 	card->private_data = (void*)dev;
 
 	err = snd_seq_device_new(card, 0, SNDRV_SEQ_DEV_ID_USBMIDI,
@@ -1084,14 +1086,16 @@
 	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)
-		strcpy(device_info->vendor, "Unknown Vendor");
+		sprintf(device_info->vendor, "Unknown Vendor %x", usb_device->descriptor.idVendor);
 	if (usb_device->descriptor.iProduct == 0 ||
 	    usb_string(usb_device, usb_device->descriptor.iProduct,
 		       device_info->product, sizeof(device_info->product)) < 0)
-		strcpy(device_info->product, "Unknown Device");
+		sprintf(device_info->product, "Unknown Device %x", usb_device->descriptor.idProduct);
 
 	intf = usb_ifnum_to_if(usb_device, ifnum);
 	if (!intf)
@@ -1140,7 +1144,7 @@
 		} else {
 			device_info->endpoints[epidx].out_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1;
 		}
-		printk(KERN_INFO "snd-usb-midi: using %d %s jack(s) on endpoint %d\n",
+		printk(KERN_INFO "snd-usb-midi: detected %d %s jack(s) on endpoint %d\n",
 		       ms_ep->bNumEmbMIDIJack,
 		       ep->bEndpointAddress & USB_DIR_IN ? "input" : "output",
 		       device_info->endpoints[epidx].epnum);
@@ -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;
 }
@@ -1369,7 +1376,8 @@
 #ifndef MODULE
 
 /*
- * format is snd-usb-midi=snd_enable,snd_index,snd_id,snd_pid,snd_int_transfer
+ * format is snd-usb-midi=snd_enable,snd_index,snd_id,
+ *                        snd_vid,snd_pid,snd_int_transfer
  */
 static int __init snd_usbmidi_module_setup(char* str)
 {


-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  2002-07-30 18:18       ` Martin Langer
                           ` (2 preceding siblings ...)
  2002-07-31 10:02         ` [Alsa-devel][Patch] usbmidi fixes Clemens Ladisch
@ 2002-07-31 10:26         ` Clemens Ladisch
  2002-07-31 21:02           ` Martin Langer
  3 siblings, 1 reply; 16+ messages in thread
From: Clemens Ladisch @ 2002-07-31 10:26 UTC (permalink / raw)
  To: Martin Langer; +Cc: alsa-devel

Martin Langer wrote:
> Thanks for all patches, but I don't found an error in the log-files. The last
> line is/was always the detection, which seems to work fine (see above). I'm
> still missing a client in /proc/asound/seq/clients, so the driver never
> reaches the port creation and I have no additional output from your patch.
> Something else must be between usb-detection and creation of the port!

It seems that snd_usbmidi_seq_device_new is never called (???), or fails.

Please try the following patch (in addition to my other one), which will output
a lot of debug messages:


--- usb/usbmidi.c.org	Wed Jul 31 10:57:09 2002
+++ usb/usbmidi.c	Wed Jul 31 12:13:03 2002
@@ -874,20 +874,24 @@
 	for (i = 0; i < MAX_ENDPOINTS; ++i) {
 		usbmidi_endpoint_info_t* ep_info = &umidi->device_info.endpoints[i];
 
+		printk(KERN_INFO "endpoint %d ...\n", i);
 		if (!ep_info->epnum)
 			continue;
 		if (ep_info->out_cables) {
+			printk(KERN_INFO "... output\n");
 			err = snd_usbmidi_out_endpoint_create(umidi, ep_info,
 							      &umidi->endpoints[i]);
 			if (err < 0)
 				return err;
 		}
 		if (ep_info->in_cables) {
+			printk(KERN_INFO "... input\n");
 			err = snd_usbmidi_in_endpoint_create(umidi, ep_info,
 							     &umidi->endpoints[i]);
 			if (err < 0)
 				return err;
 		}
+		printk(KERN_INFO "... ports\n");
 		err = snd_usbmidi_create_endpoint_ports(umidi, i, &port_idx);
 		if (err < 0)
 			return err;
@@ -909,8 +913,10 @@
 	snd_seq_client_info_t client_info;
 	int i, err;
 
+	printk(KERN_INFO "snd_usbmidi_seq_device_new() called\n");
 	umidi = (usbmidi_t*)SNDRV_SEQ_DEVICE_ARGPTR(seq_device);
 
+	printk(KERN_INFO "creating client\n");
 	memset(&client_callback, 0, sizeof(client_callback));
 	client_callback.allow_output = 1;
 	client_callback.allow_input = 1;
@@ -919,6 +925,7 @@
 	if (umidi->seq_client < 0)
 		return umidi->seq_client;
 
+	printk(KERN_INFO "setting client name\n");
 	memset(&client_info, 0, sizeof(client_info));
 	client_info.client = umidi->seq_client;
 	client_info.type = KERNEL_CLIENT;
@@ -928,12 +935,15 @@
 				  SNDRV_SEQ_IOCTL_SET_CLIENT_INFO,
 				  &client_info);
 
+	printk(KERN_INFO "creating endpoints\n");
 	err = snd_usbmidi_create_endpoints(umidi);
 	if (err < 0) {
+		printk(KERN_INFO "... failed\n");
 		snd_usbmidi_seq_device_delete(seq_device);
 		return err;
 	}
 
+	printk(KERN_INFO "submitting URBs\n");
 	for (i = 0; i < MAX_ENDPOINTS; ++i)
 		if (umidi->endpoints[i].in)
 			snd_usbmidi_submit_urb(umidi->endpoints[i].in->urb,



> tuba:~# cat /proc/asound/cards
> 0 [card0          ]: USB MIDI - Evolution Electronics L MK-249C Evolution
> Electronics L MK-249C Evolution Elect (a4d:8e if 1 at 001/002)
>                      Evolution Electronics L MK-249C Evolution Elect (a4d:8e
> if 1 at 001/002)
> 
> The only strange thing I found are the unknown parts of the lsusb output
> (broken descriptor?) and the impossible module reload = segfault.

IMHO the garbled device name is strange, too. ;-)  This is a (rather
harmless) buffer overflow which has been fixed by the latest version of my
other patch.


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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Alsa-devel][Patch] usbmidi fixes
  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
  1 sibling, 0 replies; 16+ messages in thread
From: Martin Langer @ 2002-07-31 10:45 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Wed, Jul 31, 2002 at 12:02:09PM +0200, Clemens Ladisch wrote:
> 
> 
> These changes are desirable even if (apparently) they don't fix
> Martin's problem.
> 

The buffer overflow is fixed .... It looks like totally fixed!
I do some more tests this evening. Maybe I find something else;-)

So far: Thank you very much, Clemens.

martin



---------------

tuba:~# modprobe snd-usb-midi
tuba:~# rmmod snd-usb-midi 
tuba:~# modprobe snd-usb-midi 
tuba:~# cat /proc/asound/seq/clients 
Client info
  cur  clients : 2
  peak clients : 2
  max  clients : 192
      
Client   0 : "System" [Kernel]
  Port   0 : "Timer" (Rwe-)
  Port   1 : "Announce" (R-e-)
Client  64 : "Evolution Electronics Ltd. MK-249C USB MIDI keyboard" [Kernel]
  Port   0 : "MK-249C USB MIDI keyboard Port 0" (R-e-)
  Port   1 : "MK-249C USB MIDI keyboard Port 1" (-We-)
tuba:~# 
    


-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Alsa-devel][Patch] usbmidi fixes
  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
  1 sibling, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2002-07-31 14:38 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: Martin Langer, alsa-devel

At Wed, 31 Jul 2002 12:02:09 +0200,
Clemens Ladisch wrote:
> 
> 
> Below is the final version of my changes to usbmidi.c.
> I used the opportunity to make some further fixes.
> 
> These changes are desirable even if (apparently) they don't fix
> Martin's problem.
> 
> 
> - enlarged vendor/device name strings
> - fixed buffer overflow for card->shortname
> - added error messages if initialization fails
> - made information messages more consistent
> - fixed module_setup comment

ok, now on cvs.


Takashi


-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  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
  0 siblings, 1 reply; 16+ messages in thread
From: Martin Langer @ 2002-07-31 21:02 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Wed, Jul 31, 2002 at 12:26:33PM +0200, Clemens Ladisch wrote:
> 
> IMHO the garbled device name is strange, too. ;-)  This is a (rather
> harmless) buffer overflow which has been fixed by the latest version of my
> other patch.
> 

Rather harmless buffer overflows results in segfaults - a tough ideology!
Don't show me any of your critical buffer overflows ;-) 

After having some fun with my working snd-usb-midi module I can say: it's
working, working and working (without problems).

So, the "Evolution MK-249C" can be add to the list of supported devices.

Finally there is only one point, which doesn't show perfect beauty. It's the
shortname of the proc entry, which looks incomplete, but that's really
"rather harmless", because everything works for me, there is no buffer
overflow(!) .... and other things are much more important.


Thanks again and sorry for the mess,
martin

---------------------------------

3 [card3          ]: USB MIDI - Evolution Electronics Ltd. MK-2
                     Evolution Electronics Ltd. MK-249C USB MIDI keyboard at
001/002 if 1





-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: my first usb-midi experiment ends with segmentation fault
  2002-07-31 21:02           ` Martin Langer
@ 2002-08-01  9:48             ` Clemens Ladisch
  0 siblings, 0 replies; 16+ messages in thread
From: Clemens Ladisch @ 2002-08-01  9:48 UTC (permalink / raw)
  To: Martin Langer; +Cc: alsa-devel

Martin Langer wrote:
> On Wed, Jul 31, 2002 at 12:26:33PM +0200, Clemens Ladisch wrote:
> >
> > IMHO the garbled device name is strange, too. ;-)  This is a (rather
> > harmless) buffer overflow which has been fixed by the latest version of my
> > other patch.
>
> Rather harmless buffer overflows results in segfaults - a tough ideology!

It was the uninitialized variable which caused the segfault, the buffer
overflow only garbled the long name.

> Finally there is only one point, which doesn't show perfect beauty. It's the
> shortname of the proc entry, which looks incomplete,
>
> 3 [card3          ]: USB MIDI - Evolution Electronics Ltd. MK-2
>                      Evolution Electronics Ltd. MK-249C USB MIDI keyboard at
> 001/002 if 1

ALSA limits the length of the shortname to 32 bytes (hence _short_name).
You already know what happens if the shortname isn't restricted to that
size.  ;-)


Clemens



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2002-08-01  9:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.