From 326645d2daa33ad504042fc46630dbdca2e6358b Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 31 Aug 2014 22:51:43 +0200 Subject: [PATCH] usb_keyboard: Simplify to generalized usb_process_transfer. --- .../debugger/usb_keyboard/usb_keyboard.cpp | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/src/add-ons/kernel/debugger/usb_keyboard/usb_keyboard.cpp b/src/add-ons/kernel/debugger/usb_keyboard/usb_keyboard.cpp index b4eea22c51..ee91d2981a 100644 --- a/src/add-ons/kernel/debugger/usb_keyboard/usb_keyboard.cpp +++ b/src/add-ons/kernel/debugger/usb_keyboard/usb_keyboard.cpp @@ -15,11 +15,6 @@ static uint8 sLastTransferData[64]; static size_t sUSBTransferLength = 0; static void *sUSBPipe = NULL; -static bool sUseUHCI = false; -static bool sUseOHCI = false; -static bool sUseEHCI = false; -static bool sUseXHCI = false; - // simple ring buffer static int sBufferedChars[32]; static uint8 sBufferSize = sizeof(sBufferedChars) / sizeof(sBufferedChars[0]); @@ -155,14 +150,9 @@ static size_t sKeyTableSize = sizeof(sKeyTable) / sizeof(sKeyTable[0]); static void enter_debugger(void) { - sUseUHCI = has_debugger_command("uhci_process_transfer"); - sUseOHCI = has_debugger_command("ohci_process_transfer"); - sUseEHCI = has_debugger_command("ehci_process_transfer"); - sUseXHCI = has_debugger_command("xhci_process_transfer"); - if (!has_debugger_command("get_usb_keyboard_config") || !has_debugger_command("get_usb_pipe_for_id") - || (!sUseUHCI && !sUseOHCI && !sUseEHCI && !sUseXHCI)) { + || !has_debugger_command("usb_process_transfer")) { return; } @@ -189,15 +179,7 @@ exit_debugger(void) if (sUseUSBKeyboard) { // make sure a possibly pending transfer is canceled set_debug_variable("_usbPipe", (uint64)sUSBPipe); - if (sUseUHCI) - evaluate_debug_command("uhci_process_transfer cancel"); - if (sUseOHCI) - evaluate_debug_command("ohci_process_transfer cancel"); - if (sUseEHCI) - evaluate_debug_command("ehci_process_transfer cancel"); - if (sUseXHCI) - evaluate_debug_command("xhci_process_transfer cancel"); - + evaluate_debug_command("usb_process_transfer cancel"); sUseUSBKeyboard = false; } } @@ -222,16 +204,10 @@ debugger_getchar(void) set_debug_variable("_usbPipe", (uint64)sUSBPipe); set_debug_variable("_usbTransferData", (uint64)sUSBTransferData); set_debug_variable("_usbTransferLength", (uint64)sUSBTransferLength); - if ((!sUseUHCI - || evaluate_debug_command("uhci_process_transfer") != 0) - && (!sUseOHCI - || evaluate_debug_command("ohci_process_transfer") != 0) - && (!sUseEHCI - || evaluate_debug_command("ehci_process_transfer") != 0) - && (!sUseXHCI - || evaluate_debug_command("xhci_process_transfer") != 0)) { + + status_t status = evaluate_debug_command("usb_process_transfer"); + if (status != B_OK) return -1; - } bool phantomState = true; for (size_t i = 2; i < sUSBTransferLength; i++) {