Fix XUSB binding after reconnect
This commit is contained in:
parent
e68cdcd40f
commit
1e36571770
11 changed files with 74 additions and 11 deletions
|
|
@ -115,6 +115,12 @@ void test_manual_modes_bypass_and_consume_probe_state() {
|
|||
control_length) == 0 &&
|
||||
alarm_count == 0,
|
||||
"manual XInput did not serve XInput descriptors without probing");
|
||||
require(adapter_host_probe_vendor_control(
|
||||
0, CONTROL_STAGE_DATA, &request) &&
|
||||
adapter_host_probe_vendor_control(
|
||||
0, CONTROL_STAGE_ACK, &request) &&
|
||||
control_count == 1,
|
||||
"manual XInput did not retain the compatible-ID transfer");
|
||||
|
||||
reset_harness(kXInputBootMagic);
|
||||
adapter_host_probe_init(AdapterRequestedMode::kDInput);
|
||||
|
|
@ -154,6 +160,12 @@ void test_probe_transition_resets_before_watchdog() {
|
|||
alarm_count == 1 && pending_alarm_delay_ms == 100 &&
|
||||
reboot_count == 0,
|
||||
"auto probe did not queue the exact delayed transition");
|
||||
require(adapter_host_probe_vendor_control(
|
||||
0, CONTROL_STAGE_DATA, &request) &&
|
||||
adapter_host_probe_vendor_control(
|
||||
0, CONTROL_STAGE_ACK, &request) &&
|
||||
control_count == 1 && alarm_count == 1,
|
||||
"auto probe did not retain the compatible-ID transfer");
|
||||
|
||||
pending_alarm(1, pending_alarm_user_data);
|
||||
require(reset_count == 1 && reboot_count == 1 &&
|
||||
|
|
|
|||
|
|
@ -532,6 +532,27 @@ void test_failed_recovery_never_reboots() {
|
|||
"or failed recovery acknowledged, released ownership, or retried");
|
||||
}
|
||||
|
||||
void test_auto_xinput_disconnect_reboots_to_probe() {
|
||||
reset_harness(AdapterRequestedMode::kAuto);
|
||||
probed_active_mode = AdapterUsbMode::kXInput;
|
||||
adapter_mode_controller_on_usb_unmounted();
|
||||
adapter_mode_controller_on_usb_unmounted();
|
||||
require(runtime_reset_count == 1 && reboot_count == 1,
|
||||
"Auto XInput unmount did not schedule exactly one probe reboot");
|
||||
|
||||
reset_harness(AdapterRequestedMode::kXInput);
|
||||
probed_active_mode = AdapterUsbMode::kXInput;
|
||||
adapter_mode_controller_on_usb_unmounted();
|
||||
require(runtime_reset_count == 0 && reboot_count == 0,
|
||||
"manual XInput mode rebooted after USB unmount");
|
||||
|
||||
reset_harness(AdapterRequestedMode::kAuto);
|
||||
probed_active_mode = AdapterUsbMode::kSwitchProbe;
|
||||
adapter_mode_controller_on_usb_unmounted();
|
||||
require(runtime_reset_count == 0 && reboot_count == 0,
|
||||
"Auto Switch probe rebooted after USB unmount");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void configuration_service_initialize_pre_usb() {
|
||||
|
|
@ -659,5 +680,6 @@ int main() {
|
|||
test_configuration_failure_and_correlated_reboot();
|
||||
test_recovery_auto_wins_host_mode_interleaving();
|
||||
test_failed_recovery_never_reboots();
|
||||
test_auto_xinput_disconnect_reboots_to_probe();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,9 +146,12 @@ void test_microsoft_compatible_id_descriptor() {
|
|||
"Microsoft function count mismatch");
|
||||
for (uint8_t instance = 0;
|
||||
instance < SWITCH_PICO_HID_INSTANCE_COUNT; ++instance) {
|
||||
const uint8_t *function = &kMsCompatIdDescriptor[16 + instance * 24];
|
||||
const uint8_t* function =
|
||||
&kMsCompatIdDescriptor[16 + instance * 24];
|
||||
expect(function[0] == instance,
|
||||
"Microsoft descriptor interface mismatch");
|
||||
expect(function[1] == 1,
|
||||
"XUSB function must own exactly one interface");
|
||||
expect(std::memcmp(&function[2], "XUSB10", 6) == 0,
|
||||
"XUSB10 compatible ID missing");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue