diff --git a/usb/src/dev_handler.rs b/usb/src/dev_handler.rs index bc17e0c..149b3a8 100644 --- a/usb/src/dev_handler.rs +++ b/usb/src/dev_handler.rs @@ -5,12 +5,12 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::time::Duration; use async_trait::async_trait; use log::{debug, error, info, trace}; -use rusb::{Direction, UsbContext}; +use rusb::Direction; use tokio::sync::mpsc; use pod_core::midi_io::{MidiIn, MidiOut}; use crate::devices::UsbDevice; use crate::endpoint::{Endpoint, find_endpoint}; -use crate::framer::{BoxedInFramer, BoxedOutFramer, InFramer}; +use crate::framer::{BoxedInFramer, BoxedOutFramer}; use crate::line6::line6_read_serial; use crate::midi_framer::new_usb_midi_framer; use crate::podxt_framer::new_pod_xt_framer; @@ -51,14 +51,6 @@ pub struct DeviceOutput { inner: Arc } -pub struct DevHandler { - handle: Arc, - read_ep: Endpoint, - write_ep: Endpoint, - tx: mpsc::UnboundedSender>, - rx: mpsc::UnboundedReceiver> -} - const READ_DURATION: Duration = Duration::from_millis(10 * 1000); const WRITE_DURATION: Duration = Duration::from_millis(10 * 1000); diff --git a/usb/src/lib.rs b/usb/src/lib.rs index 73737b8..60ac730 100644 --- a/usb/src/lib.rs +++ b/usb/src/lib.rs @@ -246,7 +246,7 @@ pub fn usb_device_for_address(dev_addr: &str) -> Result<(impl MidiIn, impl MidiO let port_n_re = Regex::new(r"\d+").unwrap(); let port_id_re = Regex::new(r"\d+:\d+").unwrap(); - let mut found; + let found; if port_id_re.is_match(dev_addr) { found = devices.get_mut(dev_addr); } else if port_n_re.is_match(dev_addr) { diff --git a/usb/src/midi_framer.rs b/usb/src/midi_framer.rs index 984b525..45cd333 100644 --- a/usb/src/midi_framer.rs +++ b/usb/src/midi_framer.rs @@ -31,7 +31,7 @@ impl InFramer for UsbMidiInFramer { let mut ret = vec![]; bytes.chunks_exact(4).for_each(|b| { let mut push_sysex = false; - let mut sysex_ptr = &mut self.sysex_buffer[self.sysex_offset .. self.sysex_offset + 3]; + let sysex_ptr = &mut self.sysex_buffer[self.sysex_offset .. self.sysex_offset + 3]; match b[0] { 0x0b => ret.push( b[1 .. 4].to_vec() ), 0x0c => ret.push( b[1 .. 3].to_vec() ), diff --git a/usb/src/podxt_framer.rs b/usb/src/podxt_framer.rs index 404b293..2d05cb5 100644 --- a/usb/src/podxt_framer.rs +++ b/usb/src/podxt_framer.rs @@ -46,13 +46,13 @@ impl PodXtInFramer { impl InFramer for PodXtInFramer { fn decode_incoming(&mut self, bytes: &[u8]) -> Vec> { // add received data to the read buffer at current read offset - let mut read_ptr = &mut self.read_buffer[self.read_offset .. self.read_offset + bytes.len()]; + let read_ptr = &mut self.read_buffer[self.read_offset .. self.read_offset + bytes.len()]; read_ptr.copy_from_slice(bytes); // go through the whole receive buffer from offset 0, check for // for messages as send them to the MIDI thread let process_len = self.read_offset + read_ptr.len(); - let mut process_buf = self.read_buffer[..process_len].as_mut(); + let process_buf = self.read_buffer[..process_len].as_mut(); let mut process_offset = 0; let mut ret = vec![]; loop { diff --git a/usb/src/usb.rs b/usb/src/usb.rs index 9a023a1..a498c0a 100644 --- a/usb/src/usb.rs +++ b/usb/src/usb.rs @@ -9,7 +9,7 @@ use std::thread; use std::time::Duration; use log::{debug, error, info}; use rusb::{Context, Hotplug, HotplugBuilder, Registration, UsbContext}; -use rusb::constants::{LIBUSB_ENDPOINT_DIR_MASK, LIBUSB_ENDPOINT_IN, LIBUSB_ENDPOINT_OUT, LIBUSB_ERROR_INTERRUPTED, LIBUSB_TRANSFER_CANCELLED, LIBUSB_TRANSFER_TYPE_BULK}; +use rusb::constants::{LIBUSB_ENDPOINT_DIR_MASK, LIBUSB_ENDPOINT_IN, LIBUSB_ENDPOINT_OUT, LIBUSB_TRANSFER_TYPE_BULK}; use rusb::ffi::{libusb_alloc_transfer, libusb_cancel_transfer, libusb_free_transfer, libusb_submit_transfer, libusb_transfer}; use crate::check; use crate::util::usb_address_string; @@ -390,7 +390,7 @@ pub mod libusb { } /// Resets the specified device handle. - pub(super) fn reset(mut hdl: DeviceHandle) -> rusb::Result> { + pub(super) fn reset(hdl: DeviceHandle) -> rusb::Result> { let dev = hdl.device(); let port = dev.port_numbers()?; // WinUSB API with libusbK driver requires interface 0 to be claimed in