Corrected expected total descriptor length

This commit is contained in:
Florian Jung 2021-04-13 00:38:12 +02:00
parent 50e4094ed0
commit dd71bcaeb0
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
[package]
name = "usbd-midi"
version = "0.2.0"
authors = ["beau trepp <beautrepp@gmail.com>"]
authors = ["beau trepp <beautrepp@gmail.com>", "Florian Jung <flo@windfis.ch>"]
edition = "2018"
description = "A usb-midi implementation for usb-device"
homepage = "https://github.com/btrepp/usbd-midi"

View file

@ -117,7 +117,7 @@ impl<B: UsbBus> UsbClass<B> for MidiClass<'_, B> {
let midi_streaming_start_byte = writer.position();
let midi_streaming_total_length =
7 + (self.n_in_jacks + self.n_out_jacks) as usize * (MIDI_IN_SIZE + MIDI_OUT_SIZE) as usize
+ 9 + (4+self.n_out_jacks as usize) + 9 + (4+self.n_in_jacks as usize);
+ 7 + (4+self.n_out_jacks as usize) + 7 + (4+self.n_in_jacks as usize);
//Streaming extra info
writer.write( // len = 7
@ -190,7 +190,7 @@ impl<B: UsbBus> UsbClass<B> for MidiClass<'_, B> {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 // jack mappings. must be filled in and cropped.
];
writer.endpoint(&self.standard_bulkout)?; // len = 9
writer.endpoint(&self.standard_bulkout)?; // len = 7
endpoint_data[1] = self.n_out_jacks;
for i in 0..self.n_out_jacks {
@ -201,7 +201,7 @@ impl<B: UsbBus> UsbClass<B> for MidiClass<'_, B> {
&endpoint_data[0..2+self.n_out_jacks as usize]
)?;
writer.endpoint(&self.standard_bulkin)?; // len = 9
writer.endpoint(&self.standard_bulkin)?; // len = 7
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);