From patchwork Tue Dec 8 12:20:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 7796661 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 37687BEEE1 for ; Tue, 8 Dec 2015 12:21:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 60F93204D2 for ; Tue, 8 Dec 2015 12:21:21 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8C757202BE for ; Tue, 8 Dec 2015 12:21:18 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 008822663DF; Tue, 8 Dec 2015 13:21:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 079DE266088; Tue, 8 Dec 2015 13:21:09 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id D8F46266097; Tue, 8 Dec 2015 13:21:07 +0100 (CET) Received: from smtp311.phy.lolipop.jp (smtp311.phy.lolipop.jp [210.157.22.79]) by alsa0.perex.cz (Postfix) with ESMTP id C9F0A26607D for ; Tue, 8 Dec 2015 13:20:57 +0100 (CET) Received: from smtp311.phy.lolipop.lan (HELO smtp311.phy.lolipop.jp) (172.17.1.11) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp311.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Tue, 08 Dec 2015 21:20:54 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp311.phy.lolipop.jp (LOLIPOP-Fsecure); Tue, 08 Dec 2015 21:20:49 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) To: Clemens Ladisch References: <1449408224-13955-1-git-send-email-o-takashi@sakamocchi.jp> <1449408224-13955-3-git-send-email-o-takashi@sakamocchi.jp> <5666AF4E.9000100@ladisch.de> <5666BE1A.80304@sakamocchi.jp> <5666BF03.7060102@ladisch.de> From: Takashi Sakamoto X-Enigmail-Draft-Status: N1110 Message-ID: <5666CB21.8040406@sakamocchi.jp> Date: Tue, 8 Dec 2015 21:20:49 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <5666BF03.7060102@ladisch.de> Cc: tiwai@suse.de, alsa-devel@alsa-project.org, ffado-devel@lists.sf.net Subject: Re: [alsa-devel] [PATCH 2/3] fireface: add transaction support X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP On Dec 08 2015 20:29, Clemens Ladisch wrote: > Takashi Sakamoto wrote: >> On Dec 08 2015 19:22, Clemens Ladisch wrote: >>> Takashi Sakamoto wrote: >>>> + /* Calculate consume bytes. */ >>>> + consume = calculate_message_bytes(status); >>>> + if (consume <= 0) >>>> + return; >>> >>> As far as I can see, sending one of the "undefined" bytes can stop the >>> stream permanently. Invalid bytes need to be acked to ignore/remove >>> them. >> >> Exactly. We should find better way to handle such messages. Do you have >> any good ideas? > > Call snd_rawmidi_transmit_ack(, 1) and continue. $ git diff if ((*buf & 0x80) != 0x80) { Hm. This looks simple and works better, while I suspect that this is appropriate to device driver, because this idea drops the message from userspace. This is against a principle that device drivers just pass data from a side to another side without censoring and modification. I think it better to transfer the message to the device, even if it's invalid in MIDI spec. It's what the userspace wants. Thanks Takashi Sakamoto diff --git a/sound/firewire/fireface/fireface-transaction.c b/sound/firewire/fireface/fireface-transaction.c index 07a2b9c..6b8c7a8 100644 --- a/sound/firewire/fireface/fireface-transaction.c +++ b/sound/firewire/fireface/fireface-transaction.c @@ -148,8 +148,10 @@ static void transmit_midi_msg(struct snd_ff *ff, unsigned int port) /* Calculate consume bytes. */ consume = calculate_message_bytes(status); - if (consume <= 0) + if (consume <= 0) { + snd_rawmidi_transmit_ack(substream, 1); return; + } /* On running-status. */