From 4d49f1459a23ec9c75acfbe84ab58aa52b6a50df Mon Sep 17 00:00:00 2001 From: Oliver Rockstedt Date: Sun, 26 May 2024 00:09:56 +0200 Subject: [PATCH] Extended endpoint descriptors to 9 bytes --- CHANGELOG.md | 1 + src/midi_device.rs | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7020ff1..8a99d03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Updated `usb-device` dependency to 0.3.2. - Updated `num_enum` dependency to 0.7.2. +- Extended endpoint descriptors to 9 bytes as stated in specification. ### Removed diff --git a/src/midi_device.rs b/src/midi_device.rs index 9e0ba73..cf35647 100644 --- a/src/midi_device.rs +++ b/src/midi_device.rs @@ -123,9 +123,9 @@ impl UsbClass for MidiClass<'_, B> { let midi_streaming_total_length = 7 + (self.n_in_jacks + self.n_out_jacks) as usize * (MIDI_IN_SIZE + MIDI_OUT_SIZE) as usize - + 7 + + 9 + (4 + self.n_out_jacks as usize) - + 7 + + 9 + (4 + self.n_in_jacks as usize); //Streaming extra info @@ -206,7 +206,11 @@ impl UsbClass for MidiClass<'_, B> { 0, // jack mappings. must be filled in and cropped. ]; - writer.endpoint(&self.standard_bulkout)?; // len = 7 + writer.endpoint_ex(&self.standard_bulkout, |data| { + data[0] = 0; // bRefresh + data[1] = 0; // bSynchAddress + Ok(2) + })?; // len = 9 endpoint_data[1] = self.n_out_jacks; for i in 0..self.n_out_jacks { @@ -218,7 +222,12 @@ impl UsbClass for MidiClass<'_, B> { &endpoint_data[0..2 + self.n_out_jacks as usize], )?; - writer.endpoint(&self.standard_bulkin)?; // len = 7 + writer.endpoint_ex(&self.standard_bulkin, |data| { + data[0] = 0; // bRefresh + data[1] = 0; // bSynchAddress + Ok(2) + })?; // len = 9 + endpoint_data[1] = self.n_in_jacks; for i in 0..self.n_in_jacks { endpoint_data[2 + i as usize] = self.out_jack_id_emb(i);