Attempts at restoring windows compatibility

This commit is contained in:
Florian Jung 2021-04-10 17:18:16 +02:00
parent b06d1dcb50
commit 42b1efa16b

View file

@ -4,7 +4,7 @@ use crate::data::usb::constants::*;
use crate::data::usb_midi::usb_midi_event_packet::{UsbMidiEventPacket, MidiPacketParsingError}; use crate::data::usb_midi::usb_midi_event_packet::{UsbMidiEventPacket, MidiPacketParsingError};
const MIDI_IN_SIZE: u8 = 0x06; const MIDI_IN_SIZE: u8 = 0x06;
const MIDI_OUT_SIZE: u8 = 0x07; const MIDI_OUT_SIZE: u8 = 0x09;
pub const MIDI_PACKET_SIZE: usize = 4; pub const MIDI_PACKET_SIZE: usize = 4;
pub const MAX_PACKET_SIZE: usize = 64; pub const MAX_PACKET_SIZE: usize = 64;
@ -104,7 +104,7 @@ impl<B: UsbBus> UsbClass<B> for MidiClass<'_, B> {
let midi_streaming_start_byte = writer.position(); let midi_streaming_start_byte = writer.position();
let midi_streaming_total_length = let midi_streaming_total_length =
7 + self.n_in_jacks as usize * MIDI_IN_SIZE as usize + self.n_out_jacks as usize * MIDI_OUT_SIZE as usize 7 + self.n_in_jacks as usize * MIDI_IN_SIZE as usize + self.n_out_jacks as usize * MIDI_OUT_SIZE as usize
+ 7 + (4+self.n_in_jacks as usize) + 7 + (4+self.n_out_jacks as usize); + 9 + (4+self.n_in_jacks as usize) + 9 + (4+self.n_out_jacks as usize);
//Streaming extra info //Streaming extra info
writer.write( // len = 7 writer.write( // len = 7
@ -137,6 +137,7 @@ impl<B: UsbBus> UsbClass<B> for MidiClass<'_, B> {
EMBEDDED, EMBEDDED,
self.out_jack_id(i), //id self.out_jack_id(i), //id
0x00, // no pins 0x00, // no pins
0x00, 0x00, // windows wants these two bytes, no idea why. they don't belong here.
0x00 0x00
] ]
)?; )?;
@ -148,7 +149,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. 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 = 7 writer.endpoint(&self.standard_bulkout)?; // len = 9
endpoint_data[1] = self.n_in_jacks; endpoint_data[1] = self.n_in_jacks;
for i in 0..self.n_in_jacks { for i in 0..self.n_in_jacks {
@ -159,7 +160,7 @@ impl<B: UsbBus> UsbClass<B> for MidiClass<'_, B> {
&endpoint_data[0..2+self.n_in_jacks as usize] &endpoint_data[0..2+self.n_in_jacks as usize]
)?; )?;
writer.endpoint(&self.standard_bulkin)?; // len = 7 writer.endpoint(&self.standard_bulkin)?; // len = 9
endpoint_data[1] = self.n_out_jacks; endpoint_data[1] = self.n_out_jacks;
for i in 0..self.n_out_jacks { for i in 0..self.n_out_jacks {
endpoint_data[2 + i as usize] = self.out_jack_id(i); endpoint_data[2 + i as usize] = self.out_jack_id(i);