From: RasmusML <rasmusml0501@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: RasmusML <rasmusml@hotmail.dk>
Subject: [PATCH BlueZ 2/2] unit/test-midi: Add multi-channel writer test
Date: Mon, 2 Nov 2026 23:12:23 +0100 [thread overview]
Message-ID: <20261102221223.16079-2-rasmusml0501@gmail.com> (raw)
In-Reply-To: <20261102221223.16079-1-rasmusml0501@gmail.com>
From: RasmusML <rasmusml@hotmail.dk>
Add a writer test with messages of the same type on different channels
for Note On, Note Off, Control Change and Pitch Bend. Each of these
needs its own status byte preceded by timestampLow, and running status
must only be used when the channel matches too.
The existing writer tests use a single channel for every event, which
is why the missing timestampLow was not caught before.
Assisted-by: Claude:claude-opus-5-5
---
unit/test-midi.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/unit/test-midi.c b/unit/test-midi.c
index 702133e59..79cb03123 100644
--- a/unit/test-midi.c
+++ b/unit/test-midi.c
@@ -525,6 +525,24 @@ static const snd_seq_event_t event5_expect[] = {
static const struct midi_write_test midi5 = BLE_WRITE_TEST_INIT(event5, event5_expect);
+/*
+ * Same event type on different channels: each needs its own status byte and
+ * timestampLow, so running status must not carry over between them.
+ */
+static const snd_seq_event_t event6[] = {
+ NOTE_EVENT(NOTEON, 0, 60, 100), /* Note On */
+ NOTE_EVENT(NOTEON, 1, 64, 100), /* Note On, other channel */
+ NOTE_EVENT(NOTEON, 1, 67, 100), /* Note On, running status */
+ NOTE_EVENT(NOTEOFF, 0, 60, 0), /* Note Off */
+ NOTE_EVENT(NOTEOFF, 1, 64, 0), /* Note Off, other channel */
+ CONTROL_EVENT(CONTROLLER, 2, 0, 123), /* All Notes Off */
+ CONTROL_EVENT(CONTROLLER, 3, 0, 123), /* All Notes Off, other channel */
+ CONTROL_EVENT(PITCHBEND, 4, 0, 0), /* Pitch Bend */
+ CONTROL_EVENT(PITCHBEND, 5, 0, 0), /* Pitch Bend, other channel */
+};
+
+static const struct midi_write_test midi6 = BLE_WRITE_TEST_INIT_BASIC(event6);
+
struct midi_data {
size_t events_tested;
const struct midi_write_test *midi_test;
@@ -618,6 +636,8 @@ int main(int argc, char *argv[])
&midi4, NULL, test_midi_writer, NULL);
tester_add("Split ALSA SysEx events to raw BLE packets",
&midi5, NULL, test_midi_writer, NULL);
+ tester_add("ALSA Seq events on several channels to Raw BLE packets",
+ &midi6, NULL, test_midi_writer, NULL);
return tester_run();
}
--
2.43.0
next prev parent reply other threads:[~2026-11-02 22:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 22:12 [PATCH BlueZ 1/2] profiles/midi: Fix running status across channels RasmusML
2026-11-02 22:12 ` RasmusML [this message]
2026-11-03 1:57 ` [BlueZ,1/2] " bluez.test.bot
2026-11-03 16:30 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth
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=20261102221223.16079-2-rasmusml0501@gmail.com \
--to=rasmusml0501@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=rasmusml@hotmail.dk \
/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