[haiku-commits] haiku: hrev43675 - in src: add-ons/input_server/devices/keyboard add-ons/kernel/bus_managers/ps2 bin/consoled

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 21 Jan 2012 06:48:51 +0100 (CET)

hrev43675 adds 4 changesets to branch 'master'
old head: bf2b0138feafd4c9a8c64cc804e669cfc407f16f
new head: 124759d0dfcc525e5eddf5b77c4409639a02365e

----------------------------------------------------------------------------

79d286a: Ignore KDE backup files.

da6ab90: Fix leaks.

268dde3: Always cleanup the debug reader flags when closing the keyboard 
device, not only when the very last device ist closed.

124759d: This makes keyboard input working when leaving the consoled debugger.
  * Fix trace.
  * Try to read key input again when the device is just B_BUSY.

                                     [ czeidler <haiku@xxxxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 20 insertions(+), 10 deletions(-)
.gitignore                                         |    2 ++
.../devices/keyboard/KeyboardInputDevice.cpp       |   16 +++++++++++-----
.../kernel/bus_managers/ps2/ps2_keyboard.cpp       |   10 +++++-----
src/bin/consoled/consoled.cpp                      |    2 ++

############################################################################

Commit:      79d286a56f658fb760a0128f7b314cdd9292777b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=79d286a
Author:      czeidler <haiku@xxxxxxxxxxxxxxxxxx>
Date:        Sat Jan 21 04:54:34 2012 UTC

Ignore KDE backup files.

----------------------------------------------------------------------------

diff --git a/.gitignore b/.gitignore
index 0770a52..75fcde6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,5 @@ generated*
 build/jam/UserBuildConfig
 build/user_config_headers
 
+# ignore KDE backup files ending with a ~ 
+*~

############################################################################

Commit:      da6ab904f878e29f8131f25ac963a39b7c3706bb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=da6ab90
Author:      czeidler <haiku@xxxxxxxxxxxxxxxxxx>
Date:        Sat Jan 21 04:30:49 2012 UTC

Fix leaks.

----------------------------------------------------------------------------

diff --git a/src/bin/consoled/consoled.cpp b/src/bin/consoled/consoled.cpp
index dc577fe..3a1497f 100644
--- a/src/bin/consoled/consoled.cpp
+++ b/src/bin/consoled/consoled.cpp
@@ -262,6 +262,8 @@ open_keyboards(int target, const char* start, struct 
keyboard* previous)
                                        B_URGENT_DISPLAY_PRIORITY, keyboard);
                                if (keyboard->thread < 0) {
                                        close(fd);
+                                       closedir(dir);
+                                       delete keyboard;
                                        return NULL;
                                }
 

############################################################################

Commit:      268dde32de5b9d3eb07a365e62809e6880df6cce
URL:         http://cgit.haiku-os.org/haiku/commit/?id=268dde3
Author:      czeidler <haiku@xxxxxxxxxxxxxxxxxx>
Date:        Sat Jan 21 04:33:24 2012 UTC

Always cleanup the debug reader flags when closing the keyboard device, not 
only when the very last device ist closed.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp 
b/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp
index d4a36cd..b474a13 100644
--- a/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp
+++ b/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp
@@ -388,14 +388,14 @@ keyboard_close(void *_cookie)
 
                atomic_and(&ps2_device[PS2_DEVICE_KEYB].flags, 
~PS2_FLAG_ENABLED);
 
-               if (cookie->is_reader)
-                       sHasKeyboardReader = false;
-               if (cookie->is_debugger)
-                       sHasDebugReader = false;
-
                sKeyboardIds[0] = sKeyboardIds[1] = 0;
        }
 
+       if (cookie->is_reader)
+               sHasKeyboardReader = false;
+       if (cookie->is_debugger) {
+               sHasDebugReader = false;
+
        TRACE("ps2: keyboard_close done\n");
        return B_OK;
 }

############################################################################

Revision:    hrev43675
Commit:      124759d0dfcc525e5eddf5b77c4409639a02365e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=124759d
Author:      czeidler <haiku@xxxxxxxxxxxxxxxxxx>
Date:        Sat Jan 21 04:39:12 2012 UTC

This makes keyboard input working when leaving the consoled debugger.
* Fix trace.
* Try to read key input again when the device is just B_BUSY.

----------------------------------------------------------------------------

diff --git a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 
b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp
index a4c05f8..d33fe6c 100644
--- a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp
+++ b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp
@@ -31,6 +31,8 @@
 //#define TRACE_KEYBOARD_DEVICE
 #ifdef TRACE_KEYBOARD_DEVICE
 
+static int32           sFunctionDepth = -1;
+
 class FunctionTracer {
 public:
        FunctionTracer(const void* pointer, const char* className,
@@ -54,14 +56,12 @@ public:
                sFunctionDepth--;
        }
 
-       static int32 Depth() const { return sFunctionDepth; }
+       static int32 Depth() { return sFunctionDepth; }
 
 private:
                        BString         fFunctionName;
                        BString         fPrepend;
                        const void* fPointer;
-
-       static  int32           sFunctionDepth = -1;
 };
 
 #      define KD_CALLED(x...) \
@@ -73,7 +73,7 @@ private:
                        _to.Append(' ', (FunctionTracer::Depth() + 1) * 2); \
                        debug_printf("%p -> %s", this, _to.String()); \
                        debug_printf(x); } while (0)
-#      define LOG_EVENT(text...) do {} while (0)
+#      define LOG_EVENT(text...) debug_printf(text)
 #      define LOG_ERR(text...) TRACE(text)
 #else
 #      define TRACE(x...) do {} while (0)
@@ -291,7 +291,13 @@ KeyboardDevice::_ControlThread()
        }
 
        while (fActive) {
-               if (ioctl(fFD, KB_READ, &keyInfo, sizeof(keyInfo)) != B_OK) {
+               status_t status = ioctl(fFD, KB_READ, &keyInfo, 
sizeof(keyInfo));
+               if (status == B_BUSY) {
+                       // probably the debugger is listening to key events, 
wait and try
+                       // again
+                       snooze(100000);
+                       continue;
+               } else if (status != B_OK) {
                        _ControlThreadCleanup();
                        // TOAST!
                        return 0;


Other related posts: