-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
109 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
|
||
use rusb::Context; | ||
|
||
|
||
pub fn connect<T: UsbContext>(context: &mut T) -> Result<DeviceHandle<T>, SimpleError> { | ||
|
||
//let vid = 0x0403; | ||
//let pid = 0x601e; | ||
|
||
// "N3DSXL.2" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,36 @@ | ||
pub mod katsukitty; | ||
|
||
use simple_error::SimpleError; | ||
use rusb::{Device, DeviceDescriptor, DeviceHandle, UsbContext}; | ||
|
||
trait Capture { | ||
fn connect<T: UsbContext>(context: &mut T) -> Result<DeviceHandle<T>, SimpleError>; | ||
|
||
fn open_device<T: UsbContext>( | ||
context: &mut T, | ||
vid: u16, | ||
pid: u16, | ||
) -> Option<(Device<T>, DeviceDescriptor, DeviceHandle<T>)> { | ||
let devices = match context.devices() { | ||
Ok(d) => d, | ||
Err(_) => return None, | ||
}; | ||
|
||
for device in devices.iter() { | ||
let device_desc = match device.device_descriptor() { | ||
Ok(d) => d, | ||
Err(_) => continue, | ||
}; | ||
|
||
if device_desc.vendor_id() == vid && device_desc.product_id() == pid { | ||
match device.open() { | ||
Ok(handle) => return Some((device, device_desc, handle)), | ||
Err(e) => panic!("Device found but failed to open: {}", e), | ||
} | ||
} | ||
} | ||
|
||
None | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
mod capture; | ||
|
||
fn main() { | ||
//capture::katsukitty::do_capture(); | ||
capture::loopy::do_capture(); | ||
} |