Anime: Better prevent await blocking. Prevent Slash taking over anime USB dev

This commit is contained in:
Luke D. Jones
2024-05-05 10:56:55 +12:00
parent 661ea8d3bf
commit 487d140bd5
9 changed files with 204 additions and 124 deletions

View File

@@ -44,6 +44,11 @@ pub struct CtrlSlash {
impl CtrlSlash {
#[inline]
pub fn new(config: SlashConfig) -> Result<CtrlSlash, RogError> {
let slash_type = get_slash_type()?;
if matches!(slash_type, SlashType::Unknown | SlashType::Unsupported) {
return Err(RogError::Slash(SlashError::NoDevice));
}
let usb = USBRaw::new(rog_slash::usb::PROD_ID).ok();
let hid = HidRaw::new(rog_slash::usb::PROD_ID_STR).ok();
let node = if usb.is_some() {
@@ -54,11 +59,6 @@ impl CtrlSlash {
return Err(RogError::NotSupported);
};
let slash_type = get_slash_type()?;
if slash_type == SlashType::Unknown {
return Err(RogError::Slash(SlashError::NoDevice));
}
let ctrl = CtrlSlash {
node,
config,