mirror of
https://github.com/G2-Games/minidisc-cli.git
synced 2025-04-19 19:52:53 -05:00
Updated the way you build an interface
This commit is contained in:
parent
797c37ded6
commit
cc2918fb2e
2 changed files with 6 additions and 3 deletions
|
@ -182,9 +182,9 @@ impl NetMDInterface {
|
|||
const MAX_INTERIM_READ_ATTEMPTS: u8 = 4;
|
||||
const INTERIM_RESPONSE_RETRY_INTERVAL: u32 = 100;
|
||||
|
||||
pub fn new(device: rusb::DeviceHandle<rusb::GlobalContext>, descriptor: rusb::DeviceDescriptor) -> Self {
|
||||
pub fn new(device: rusb::DeviceHandle<rusb::GlobalContext>, descriptor: rusb::DeviceDescriptor) -> Result<Self, Box<dyn Error>> {
|
||||
let net_md_device = base::NetMD::new(device, descriptor).unwrap();
|
||||
NetMDInterface { net_md_device }
|
||||
Ok(NetMDInterface { net_md_device })
|
||||
}
|
||||
|
||||
fn construct_multibyte(&self, buffer: &Vec<u8>, n: u8, offset: &mut usize) -> u32 {
|
||||
|
|
|
@ -19,7 +19,10 @@ fn main() {
|
|||
new_device.read_product_string_ascii(&device_desc)
|
||||
);
|
||||
|
||||
let player_controller = netmd::interface::NetMDInterface::new(new_device, device_desc);
|
||||
let player_controller = match netmd::interface::NetMDInterface::new(new_device, device_desc) {
|
||||
Ok(player) => player,
|
||||
Err(_) => continue
|
||||
};
|
||||
|
||||
println!(
|
||||
"Player Model: {}",
|
||||
|
|
Loading…
Reference in a new issue