Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965241AbbLWLuW (ORCPT ); Wed, 23 Dec 2015 06:50:22 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37105 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756631AbbLWLuS (ORCPT ); Wed, 23 Dec 2015 06:50:18 -0500 Subject: Re: [PATCH 1/2] usb: gadget: f_midi: refactor state machine To: Clemens Ladisch , linux-usb@vger.kernel.org References: <1450800486-18150-1-git-send-email-eu@felipetonello.com> <5679840F.5010805@ladisch.de> Cc: linux-kernel@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , Robert Baldyga From: Felipe Ferreri Tonello X-Enigmail-Draft-Status: N1111 Message-ID: <567A8A77.4000504@felipetonello.com> Date: Wed, 23 Dec 2015 11:50:15 +0000 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: <5679840F.5010805@ladisch.de> Content-Type: multipart/mixed; boundary="------------050104010504010604080009" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9191 Lines: 177 This is a multi-part message in MIME format. --------------050104010504010604080009 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Clemens, On 22/12/15 17:10, Clemens Ladisch wrote: > Felipe F. Tonello wrote: >> This refactor includes the following: >> * Cleaner state machine code; > > It does not correctly handle system real time messages inserted between > the status and data bytes of other messages. True, thanks for pointing that out. I fixed that on next revision of this patch. > >> * Reset state if MIDI message parsed is non-conformant; > > Why? In a byte stream like "C1 C3 44", where the data byte of the first > message was lost, the reset would also drop the second message. True. That was fixed as well. > >> * Fixed bug when a conformant MIDI message was followed by a non-conformant >> causing the MIDI-USB message to use old temporary data (port->data[0..1]), >> thus packing a wrong MIDI-USB request. > > Running status is feature. What do you mean by that? I don't qualify writing a *wrong* MIDI-USB packet because of a previous MIDI message as a feature. For instance, try this MIDI message: "8A 54 24 00 40" It will be converted to MIDI-USB as "08 8A 54 24 08 8A 00 40" which is wrong. It should only be "08 8A 54 24" and ignore the "00 40" MIDI bytes. On every state byte the message should basically reset data[0..1] to zero overwriting previous data. This should also be true when a MIDI-USB packet is complete. Felipe --------------050104010504010604080009 Content-Type: application/pgp-keys; name="0x92698E6A.asc" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0x92698E6A.asc" -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v2 mQINBFYedIcBEACVKGKoEjb3zlvAz5SUvBej7Sx13BPd8hVulQD+mqjfuRFPmZA5 LBXPX1zTRWwGEbbZegP3tLfKP+XekzO6BQhDihMmKuRusdgDsdMtldwhjHuUwKn7 kxB2k79jSG802lAjIv2l5hijOfKIGTATKwiMijuXho54DGltIgNyN/Onwk9HnM6d jsV5uubaI468JRH6j8HXXievo24BDvsimIE75ImiM53ruiwPwEry1hi1CnE5OpqG oe/lt27+nLXijfNZOpBZ3Q+RPVBdqPTkMlBJAa4sg+qwZoSMvQJFAGROiJ7+ICCW O4GPMrAn8CRcCI9ENKBj2dQ4bBEP1a+f16GNMUUU37wocqtyNHo0Pa/DnFh91kcu /2dvUX4XPeEimEoSKroRLOXC9RGSFYB/r9UXqFgbmyQ4TZLx0mAWIjoUQtbIJNRz Pt46UeznCVLJTg7CzIvtv8vwmMFvaepr8ONoZn+tpX8VW4dgzsMZDrVspE0Vg3oo K9JRi1nN3GcJJK4zG2ShvEkPffRHuBuyX5wR8MPRYTShKnJR5qd1cCSK73fCv4DP bjywmGjucqcLiyYbByjmHaqzRaKJclmT/jhs6qZHs+pVLkmHkHdf/WLP6Xgcvmo8 c+SATrJwRsyW9riyMB7uNg3T84umbQrl00nAhcq73rem/602H+Qrh8rEfQARAQAB tC1GZWxpcGUgRmVycmVyaSBUb25lbGxvIDxldUBmZWxpcGV0b25lbGxvLmNvbT6J AjwEEwEI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c7uLAvH D2b9Sd40P1V2ochSf/DS/osfEIEeBf5mkG/MHBBbNxvSGP1h2yUM5C7g4nc6B+nz 5bIULhw0ojZx+U1i63gJkMsVMjKDAa+mGsWu0vAI3v0AEQEAAYkCHwQYAQgACQIb DAUCVlXsegAKCRDMRLTQkmmOao4vD/9GYLw5VmydK5BJ0sX12QmR7oMK4skMkcg/ gofkJ6njI4ETDG/pQfgBSQ/P0gUMXmhHgmpaRgs0tkS2NwsvURianXiQNpJwUA2g qKngqWlEvGOVkgOw7JKpdLWBvEW4vfP0Z0Q9brdeQG//9T9xyoyTC/jPM9A33NtI KlexBfBT7lXBy/y4tqf96KTOXk3STmI6nmSwmpPPtjxXXGQiMExGxAru+VX0HFxi JBS2fw/ucluVk2kffAO0y7DTL0UH3IWq4wEtHJQlEcujmUkP8PJSVIkhJpNlppR2 97DVxLcMAbnyxCW+ms1lCuZ5KB98KtowipqY9jhAPeP06W2WikENdmpLfNHhyIaM NKF7J+4zqPda7jZN1aKqs5OguJ4V82xXRJ0O6qSAd3Kvwi3MaKtNAv09JFG7UIcK ALJ+OQBzc00z54ii19ZPHjER6cYmcVutBUGOssqtyCOZymVbc7VYecdjxVrLwdDp LHHpcIjFn5ADjIAwGlt5ttkPvFTmqLeSWG9+vtoBShzQdeKJ4AN4r6/for/XsmF4 Jf7qGK8RamVX8lpWaNjUGtVSUOMTaSR1pmQJERDO2/WEZCm5hUFkYDbu+h+9m1W+ KL2ZkyGRC8FoZ46ly1J8koEeEoa57Au/uyK3KyvzlXuCI5zgGE+TohIjOr6d3TN4 SkAyCfQaSw=3D=3D =3DJwBB -----END PGP PUBLIC KEY BLOCK----- --------------050104010504010604080009-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/