mirror of
https://github.com/G2-Games/minidisc-cli.git
synced 2025-04-19 11:42:53 -05:00
Moved some crate components around
This commit is contained in:
parent
4aee02c150
commit
c563a41781
5 changed files with 10 additions and 12 deletions
|
@ -10,11 +10,8 @@ license = "AGPL-3.0"
|
|||
|
||||
[dependencies]
|
||||
hex = "0.4.3"
|
||||
cross_usb = { path = "/home/g2/Documents/projects/code/rust/cross-usb/" }
|
||||
[target.'cfg(target_family = "wasm")'.dependencies]
|
||||
tokio = { version = "1.35.1", features = ["macros"] }
|
||||
[target.'cfg(not(target_family = "wasm"))'.dependencies]
|
||||
tokio = { version = "1.35.1", features = ["full"] }
|
||||
cross_usb = "0.1"
|
||||
tokio = { version = "1.35.1", features = ["macros", "rt", "rt-multi-thread"] }
|
||||
|
||||
[dependencies.minidisc_rs]
|
||||
path = "minidisc-rs"
|
||||
|
|
|
@ -21,7 +21,7 @@ unicode-normalization = "0.1.22"
|
|||
hex = "0.4.3"
|
||||
regex = "1.10.2"
|
||||
lazy_static = "1.4.0"
|
||||
cross_usb = { path = "../../cross-usb/" }
|
||||
cross_usb = "0.1"
|
||||
num-derive = "0.3.3"
|
||||
num-traits = "0.2.14"
|
||||
rand = "0.8.5"
|
||||
|
|
|
@ -12,7 +12,7 @@ use gloo::{
|
|||
|
||||
// USB stuff
|
||||
//use nusb::transfer::{Control, ControlIn, ControlOut, ControlType, Recipient, RequestBuffer};
|
||||
use cross_usb::context::{UsbDevice, UsbInterface};
|
||||
use cross_usb::{UsbDevice, UsbInterface};
|
||||
use cross_usb::usb::{ControlIn, ControlOut, ControlType, Device, Interface, Recipient};
|
||||
//use nusb::{Device, DeviceInfo, Interface};
|
||||
|
||||
|
@ -328,7 +328,7 @@ impl NetMD {
|
|||
Ok(final_result)
|
||||
}
|
||||
|
||||
pub async fn write_bulk(&mut self, data: Vec<u8>) -> Result<usize, Box<dyn Error>> {
|
||||
pub async fn write_bulk(&mut self, data: &[u8]) -> Result<usize, Box<dyn Error>> {
|
||||
self.usb_interface.bulk_out(BULK_WRITE_ENDPOINT, data).await
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ use crate::netmd::utils::{
|
|||
half_width_to_full_width_range, length_after_encoding_to_jis, sanitize_full_width_title,
|
||||
sanitize_half_width_title, time_to_duration,
|
||||
};
|
||||
use cross_usb::UsbDevice;
|
||||
use encoding_rs::*;
|
||||
use hex;
|
||||
use magic_crypt::{new_magic_crypt, MagicCrypt, MagicCryptTrait, SecureBit};
|
||||
|
@ -204,7 +205,7 @@ impl NetMDInterface {
|
|||
const MAX_INTERIM_READ_ATTEMPTS: u8 = 4;
|
||||
const INTERIM_RESPONSE_RETRY_INTERVAL: u32 = 100;
|
||||
|
||||
pub async fn new(device: &cross_usb::context::UsbDevice) -> Result<Self, Box<dyn Error>> {
|
||||
pub async fn new(device: &UsbDevice) -> Result<Self, Box<dyn Error>> {
|
||||
let net_md_device = base::NetMD::new(device).await?;
|
||||
Ok(NetMDInterface { net_md_device })
|
||||
}
|
||||
|
@ -1042,7 +1043,7 @@ impl NetMDInterface {
|
|||
(3, Descriptor::AudioUTOC4TD)
|
||||
}
|
||||
false => {
|
||||
new_title = sanitize_half_width_title(title.clone());
|
||||
new_title = sanitize_half_width_title(title);
|
||||
(2, Descriptor::AudioUTOC1TD)
|
||||
}
|
||||
};
|
||||
|
@ -1533,7 +1534,7 @@ impl NetMDInterface {
|
|||
} else {
|
||||
data.clone()
|
||||
};
|
||||
self.net_md_device.write_bulk(binpack).await?;
|
||||
self.net_md_device.write_bulk(&binpack).await?;
|
||||
_written_bytes += data.len();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use cross_usb::usb::Device;
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let device = cross_usb::context::get_device(0x054c, 0x0186).await.unwrap();
|
||||
let device = cross_usb::get_device(0x054c, 0x0186).await.unwrap();
|
||||
|
||||
dbg!(device.vendor_id().await);
|
||||
|
||||
|
|
Loading…
Reference in a new issue