Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFDBEC0044D for ; Mon, 16 Mar 2020 09:01:28 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56A3F20674 for ; Mon, 16 Mar 2020 09:01:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="ZkbIej+7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 56A3F20674 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 96B0717A3; Mon, 16 Mar 2020 10:00:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 96B0717A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1584349286; bh=nefbg1GmwcZTqql7Of8DWHbfYV0nk4Z5KAOf8imBtzM=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZkbIej+7KKQwM/qX+P/wbh+4LNDwhAs+/HQlXgjZhtKaRzOvn+ZQoEylEYzLo5vDY qLuNngxOO7CHA0kFDr2va19UDZl2WY2ClM1RNMY+K2rWjda7Xie6r9+d/C3DDN+9hq aDwJbTT+Dr9IXkHveewr/4Ylrx/D/xtkIs9kJo7w= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0E03EF800CD; Mon, 16 Mar 2020 10:00:36 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3AEA6F8015B; Mon, 16 Mar 2020 10:00:35 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D1242F800CD for ; Mon, 16 Mar 2020 10:00:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D1242F800CD X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 31EDAAD0F; Mon, 16 Mar 2020 09:00:32 +0000 (UTC) Date: Mon, 16 Mar 2020 10:00:32 +0100 Message-ID: From: Takashi Iwai To: Andreas Steinmetz Subject: Re: BUG: ALSA snd-virmidi: snd-virmidi is not MIDI 1.0 specification compliant In-Reply-To: <3b4a4e0f232b7afbaf0a843f63d0e538e3029bfd.camel@domdv.de> References: <3b4a4e0f232b7afbaf0a843f63d0e538e3029bfd.camel@domdv.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Sun, 15 Mar 2020 12:57:13 +0100, Andreas Steinmetz wrote: > > snd-virmidi, as of kernel 5.4.23, does not adhere to the MIDI > specification: > > >From MIDI 1.0 Detailed Specification, Document Version 4.2, Appendix A- > 1 (RUNNING STATUS), Page A-2: > > "3. Buffer is cleared when a System Exclusive or Common status message > is received." > > snd-virmidi does not clear the running status in case of a SysEx > message. > > How to test: > > Load snd-virmidi module and get the card number of the module. > In the following 5 is assumed as the card number and device 1 is used. > > You need two shells, in shell 1 do: > > aconnect 'Virtual Raw MIDI 5-1':0 'Virtual Raw MIDI 5-1':0 > amidi -p hw:VirMIDI,1 -d > > Now, in shell 2 do: > > amidi -p hw:VirMIDI,1 -S '80 01 02 F0 01 F7 80 02 03' > > This sends a note off, followed by a SysEx, followed by another note > off. The result in shell 1 is: > > 80 01 02 > F0 01 F7 > 02 > 03 > > So snd-virmidi did not clear the running status. The correct result > would be: > > 80 01 02 > F0 01 F7 > 80 02 03 Thanks for the report. Indeed it's a very old bug. The fix is simple as below. Since there is a similar bug in OSS emulation layer, too, I'm going to submit a proper patch set including this. Takashi --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c @@ -81,6 +81,7 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev, if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) continue; snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream); + snd_midi_event_reset_decode(vmidi->parser); } else { len = snd_midi_event_decode(vmidi->parser, msg, sizeof(msg), ev); if (len > 0)