From 5b9d5a2ec9b28fb9d787dc264e8903a4dbc3fb55 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Wed, 11 Mar 2009 12:17:23 +0000 Subject: [PATCH] * Add has_debugger_command() so whether or not a debugger command is available can be checked. * Make the usb_keyboard module check the presence of the needed debugger commands to avoid the error messages in case of them being unavailable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29472 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/debug.h | 1 + src/add-ons/kernel/debugger/usb_keyboard/usb_keyboard.cpp | 6 ++++++ src/system/kernel/debug/debug_commands.cpp | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/headers/private/kernel/debug.h b/headers/private/kernel/debug.h index 551223232c..cd92ffa28f 100644 --- a/headers/private/kernel/debug.h +++ b/headers/private/kernel/debug.h @@ -142,6 +142,7 @@ extern status_t add_debugger_command_etc(const char* name, extern status_t add_debugger_command_alias(const char* newName, const char* oldName, const char* description); extern bool print_debugger_command_usage(const char* command); +extern bool has_debugger_command(const char* command); extern const char *debug_demangle_symbol(const char* symbol, char* buffer, size_t bufferSize, bool* _isObjectMethod); 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 8f6089c5c0..a9a79f2090 100644 --- a/src/add-ons/kernel/debugger/usb_keyboard/usb_keyboard.cpp +++ b/src/add-ons/kernel/debugger/usb_keyboard/usb_keyboard.cpp @@ -150,6 +150,12 @@ static size_t sKeyTableSize = sizeof(sKeyTable) / sizeof(sKeyTable[0]); static void enter_debugger(void) { + if (!has_debugger_command("get_usb_keyboard_config") + || !has_debugger_command("get_usb_pipe_for_id") + || (!has_debugger_command("uhci_process_transfer") + && !has_debugger_command("ohci_process_transfer"))) + return; + evaluate_debug_command("get_usb_keyboard_config"); sUSBTransferLength = get_debug_variable("_usbReportSize", 0); if (sUSBTransferLength == 0 || sUSBTransferLength > sizeof(sUSBTransferData)) diff --git a/src/system/kernel/debug/debug_commands.cpp b/src/system/kernel/debug/debug_commands.cpp index 66da7a2109..419d1e15da 100644 --- a/src/system/kernel/debug/debug_commands.cpp +++ b/src/system/kernel/debug/debug_commands.cpp @@ -496,6 +496,14 @@ print_debugger_command_usage(const char* commandName) } +bool +has_debugger_command(const char* commandName) +{ + bool ambiguous; + return find_debugger_command(commandName, false, ambiguous) != NULL; +} + + // #pragma mark - public API int