mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: HyeongJun An <sammiee5311@gmail.com>
To: Takashi Iwai <tiwai@suse.com>
Cc: Jaroslav Kysela <perex@perex.cz>,
	Alyandra Zahran Nadhir <alyandra5b@gmail.com>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	HyeongJun An <sammiee5311@gmail.com>
Subject: [PATCH 0/4] ALSA: ump: Fix RPN/NRPN handling at MIDI 1.0 CC conversion
Date: Sun,  8 Nov 2026 21:47:47 +0900	[thread overview]
Message-ID: <cover.1794141913.git.sammiee5311@gmail.com> (raw)

Hello Takashi,

As you asked in [1], this puts Alyandra's selector fix and my fixes for
the other RPN/NRPN cases into one series, for both the UMP core
converter and the sequencer.

Patches 1 and 2 are Alyandra's [2], without the KUnit test. Selecting
an RPN now clears the NRPN selection and vice versa. Patches 3 and 4
keep the selection after a send and clear only the data, drop data when
nothing is selected, and handle a Null NRPN like a Null RPN.

What a MIDI 2.0 receiver gets, before and after the series:

  Input                                    Before             After
  Null RPN, Data Entry, select RPN 0/1     RPN 0/0 = 0x40     nothing
  Data Entry, select RPN 0/1               RPN 0/0 = 0x40     nothing
  RPN 0/2 + data, data again, RPN 0/1      0/2, then 0/0      0/2, 0/2
  Null RPN, Data Entry, select NRPN 0/5    NRPN 0/0 = 0x40    nothing
  select RPN 0/0, NRPN 1/2 + data          RPN 0/0            NRPN 1/2
  Null NRPN, Data Entry                    NRPN 127/127       nothing
  select RPN 0/127, Null RPN, data         RPN 0/127          nothing
  RPN 0/1 + data, CC 38, select RPN 0/2    0/1, then 0/0      0/1, 0/1
  RPN 1/1 + data, RPN LSB 2, data          1/1, then 0/2      1/1, 1/2
  Null RPN, RPN MSB 5, data                RPN 5/0            RPN 5/127
  RPN 0/1 + data (unchanged)               RPN 0/1            RPN 0/1

The 0/127 row and the last two changes come from holding the RPN/NRPN
numbers, as a MIDI 1.0 receiver does.

I checked the core converter with a local KUnit test over 35 input
sequences. The 17 that changed are all of the kinds above, and the
others give the same packets as before. The sequencer side was run
with a legacy client sending CC and CONTROL14 events to a MIDI 2.0
client on a patched kernel under qemu. That test will become the
selftest, with Alyandra's cases added, as a separate patch.

Two cases are left as they were. A CC 6 alone waits for a CC 38 or
the next CC 98 to 101, so a second CC 6 replaces the first instead of
sending it. A CC 38 alone after a send waits the same way, and when
the next CC 98 to 101 flushes it, it still goes out with MSB 0, now
under the kept selection. Changing those would be a separate patch.

[1] https://lore.kernel.org/all/878q33y4z4.wl-tiwai@suse.de/
[2] https://lore.kernel.org/all/20261107111056.667-1-alyandra5b@gmail.com/

Prepared with Claude Code (Claude Opus 5.5). Tested on x86_64.

Best regards,
HyeongJun An

Alyandra Zahran Nadhir (2):
  ALSA: ump: Clear stale RPN selector on NRPN change
  ALSA: seq: ump: Clear stale selectors in sequencer conversion

HyeongJun An (2):
  ALSA: ump: Fix RPN/NRPN state handling at MIDI 1.0 CC conversion
  ALSA: seq: ump: Fix RPN/NRPN state handling at MIDI 1.0 CC conversion

 sound/core/seq/seq_ump_convert.c | 32 ++++++++++++++++++++++++++++----
 sound/core/ump_convert.c         | 28 ++++++++++++++++++++++++----
 2 files changed, 52 insertions(+), 8 deletions(-)

-- 
2.43.0


             reply	other threads:[~2026-11-08 12:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08 12:47 HyeongJun An [this message]
2026-11-08 12:47 ` [PATCH 1/4] ALSA: ump: Clear stale RPN selector on NRPN change HyeongJun An
2026-11-08 12:47 ` [PATCH 2/4] ALSA: seq: ump: Clear stale selectors in sequencer conversion HyeongJun An
2026-11-08 12:47 ` [PATCH 3/4] ALSA: ump: Fix RPN/NRPN state handling at MIDI 1.0 CC conversion HyeongJun An
2026-11-08 12:47 ` [PATCH 4/4] ALSA: seq: " HyeongJun An

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1794141913.git.sammiee5311@gmail.com \
    --to=sammiee5311@gmail.com \
    --cc=alyandra5b@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®