Add cases for when rpunithm is enabled in segatools.ini

This commit is contained in:
jinsoul 2024-05-05 22:36:13 -05:00
parent 4be2d972bb
commit 47459136b9
1 changed files with 12 additions and 3 deletions

View File

@ -401,8 +401,15 @@ fn yubideck_init() -> Result<()> {
continue;
};
device.set_active_configuration(1)?;
device.claim_interface(0)?;
// the rpunithm exposes the slider interface on interface 2, as opposed to interface 0 on the yubideck
if CONFIGURATION.rpunithm == 1 {
device.set_active_configuration(1)?;
device.claim_interface(2)?;
}
else {
device.set_active_configuration(1)?;
device.claim_interface(0)?;
};
let mut global_device = DEVICE.write().unwrap();
*global_device = Some(device);
@ -438,8 +445,10 @@ fn input_thread_proc() {
};
let usb_out = unsafe { output_shmem.as_slice_mut() };
let endpoint = if CONFIGURATION.rpunithm == 1 {0x83} else {0x81};
loop {
if let Err(e) = device.read_interrupt(0x81, usb_in, TIMEOUT) {
if let Err(e) = device.read_interrupt(endpoint, usb_in, TIMEOUT) {
match e {
rusb::Error::NoDevice | rusb::Error::Io => {
error!("Controller disconnected.");