[alsa-devel] MTP-AV Bugs

Takashi Iwai tiwai at suse.de
Wed Feb 11 13:08:22 CET 2009


At Tue, 10 Feb 2009 21:54:32 +0100,
Holger Dehnhardt wrote:
> 
> After some time I found the following bug:
> 
> static void snd_mtpav_inmidi_h(struct mtpav *mcrd, u8 inbyte)
> {
>         if (inbyte >= 0xf8) {
>                 /* real-time midi code */
> -->                snd_mtpav_inmidi_process(mcrd, inbyte);
> 	//here the inmidiport is not translated to the prtnumber, so 
> 	// snd_mtpav_inmidi_process the port with an index of some 80000 
> 	// in the ports array of the mtpav struct was called

Good catch.  I think the patch below should fix the problem.

> The following change made the driver work:
> static void snd_mtpav_inmidi_h(struct mtpav *mcrd, u8 inbyte)
> {
>         if (inbyte >= 0xf8) {
>                 /* real-time midi code */
> 		mcrd->inmidiport = translate_hwport_to_subdevice(mcrd, inbyte);

This isn't correct since inbyte is supposed to be under 0x13.

> After that I realised, that with the recent driver - even without my change - 
> playing midi files din not work anymore.
> Only the first midi event was sent to the interface, everything else was 
> dropped somewhere.
> 
> So a diff between the last workin version and the recent version showed only 
> one change:

What was the last working version exactly?

> 699,701c703,705
> <       card = snd_card_new(index, id, THIS_MODULE, sizeof(*mtp_card));
> <       if (! card)
> <               return -ENOMEM;
> ---
> >       err = snd_card_create(index, id, THIS_MODULE, sizeof(*mtp_card), 
> &card);
> >       if (err < 0)
> >               return err;
> 
> which seems due to an api change. After rolling that back to the old 
> (deprecated) way of creating the sound card, everything works fine.

This must be some coincidence.  This API change has nothing to do.


thanks,

Takashi

---
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c
index 5b89c08..48b64e6 100644
--- a/sound/drivers/mtpav.c
+++ b/sound/drivers/mtpav.c
@@ -706,7 +706,6 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
 	mtp_card->card = card;
 	mtp_card->irq = -1;
 	mtp_card->share_irq = 0;
-	mtp_card->inmidiport = 0xffffffff;
 	mtp_card->inmidistate = 0;
 	mtp_card->outmidihwport = 0xffffffff;
 	init_timer(&mtp_card->timer);
@@ -719,6 +718,8 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
 	if (err < 0)
 		goto __error;
 
+	mtp_card->inmidiport = mtp_card->num_ports + MTPAV_PIDX_BROADCAST;
+
 	err = snd_mtpav_get_ISA(mtp_card);
 	if (err < 0)
 		goto __error;


More information about the Alsa-devel mailing list