Kernel - Fixing bugs in VT scrolling and keyboard mappings exposed by RHW tests
authorJohn Hodge <[email protected]>
Thu, 15 Mar 2012 14:26:52 +0000 (22:26 +0800)
committerJohn Hodge <[email protected]>
Thu, 15 Mar 2012 14:26:52 +0000 (22:26 +0800)
KernelLand/Kernel/drv/vterm.c
KernelLand/Kernel/drv/vterm_input.c
KernelLand/Kernel/drv/vterm_termbuf.c
KernelLand/Kernel/include/keysyms.h
KernelLand/Modules/Input/PS2KbMouse/kb.c
KernelLand/Modules/Input/PS2KbMouse/kb_transtab.h

index 40fa50f..0489d41 100644 (file)
@@ -24,7 +24,7 @@
 #define DEFAULT_INPUT  "Keyboard"
 #define        DEFAULT_WIDTH   640
 #define        DEFAULT_HEIGHT  480
-#define DEFAULT_SCROLLBACK     2       // 2 Screens of text + current screen
+#define DEFAULT_SCROLLBACK     4       // 2 Screens of text + current screen
 //#define DEFAULT_SCROLLBACK   0
 
 // === TYPES ===
index a037b34..20e47db 100644 (file)
@@ -91,6 +91,8 @@ void VT_KBCallBack(Uint32 Codepoint)
                if(term->Mode != TERM_MODE_TEXT)
                        break;
                
+//             Log_Debug("VTerm", "Magic Ctrl-Alt-0x%x", term->RawScancode);   
+
                switch(term->RawScancode)
                {
                // Scrolling
@@ -98,6 +100,7 @@ void VT_KBCallBack(Uint32 Codepoint)
                        if( term->Flags & VT_FLAG_ALTBUF )
                                return ;
                        term->ViewPos = MAX( 0, term->ViewPos - term->Width );
+                       VT_int_UpdateScreen(term, 1);
                        return;
                case KEYSYM_PGDN:
                        if( term->Flags & VT_FLAG_ALTBUF )
@@ -106,6 +109,7 @@ void VT_KBCallBack(Uint32 Codepoint)
                                term->ViewPos + term->Width,
                                term->Width * term->Height * giVT_Scrollback
                                );
+                       VT_int_UpdateScreen(term, 1);
                        return;
                }
                break;
index 2511048..b6aff95 100644 (file)
@@ -70,14 +70,15 @@ void VT_int_PutChar(tVTerm *Term, Uint32 Ch)
                write_pos -= write_pos % Term->TextWidth;
                break;
        
-       case '\t': { int tmp = write_pos / Term->TextWidth;
+       case '\t': {
+               int line = write_pos / Term->TextWidth;
                write_pos %= Term->TextWidth;
                do {
                        buffer[ write_pos ].Ch = '\0';
                        buffer[ write_pos ].Colour = Term->CurColour;
                        write_pos ++;
                } while(write_pos & 7);
-               write_pos += tmp * Term->TextWidth;
+               write_pos += line * Term->TextWidth;
                break; }
        
        case '\b':
@@ -85,7 +86,7 @@ void VT_int_PutChar(tVTerm *Term, Uint32 Ch)
                if(write_pos == 0)      break;
                
                write_pos --;
-               // Singe Character
+               // Single Character
                if(buffer[ write_pos ].Ch != '\0') {
                        buffer[ write_pos ].Ch = 0;
                        buffer[ write_pos ].Colour = Term->CurColour;
@@ -114,7 +115,6 @@ void VT_int_PutChar(tVTerm *Term, Uint32 Ch)
        
        if(Term->Flags & VT_FLAG_ALTBUF)
        {
-               Term->AltBuf = buffer;
                Term->AltWritePos = write_pos;
                
                if(Term->AltWritePos >= Term->TextWidth*Term->TextHeight)
@@ -126,7 +126,6 @@ void VT_int_PutChar(tVTerm *Term, Uint32 Ch)
        }
        else
        {
-               Term->Text = buffer;
                Term->WritePos = write_pos;
                // Move Screen
                // - Check if we need to scroll the entire scrollback buffer
@@ -134,10 +133,6 @@ void VT_int_PutChar(tVTerm *Term, Uint32 Ch)
                {
                         int    base;
                        
-                       // Update previous line
-                       Term->WritePos -= Term->TextWidth;
-                       VT_int_UpdateScreen( Term, 0 );
-                       
                        // Update view position
                        base = Term->TextWidth*Term->TextHeight*(giVT_Scrollback);
                        if(Term->ViewPos < base)
@@ -146,16 +141,12 @@ void VT_int_PutChar(tVTerm *Term, Uint32 Ch)
                                Term->ViewPos = base;
                        
                        VT_int_ScrollText(Term, 1);
+                       Term->WritePos -= Term->TextWidth;
                }
                // Ok, so we only need to scroll the screen
                else if(Term->WritePos >= Term->ViewPos + Term->TextWidth*Term->TextHeight)
                {
-                       // Update the last line
-                       Term->WritePos -= Term->TextWidth;
-                       VT_int_UpdateScreen( Term, 0 );
-                       Term->WritePos += Term->TextWidth;
-                       
-                       VT_int_ScrollText(Term, 1);
+                       VT_int_ScrollFramebuffer( Term, 1 );
                        
                        Term->ViewPos += Term->TextWidth;
                }
@@ -189,7 +180,7 @@ void VT_int_ScrollText(tVTerm *Term, int Count)
                scroll_height = height;
        }
 
-       // Scroll text downwards        
+       // Scroll text upwards (more space at bottom)
        if( Count > 0 )
        {
                 int    base;
index d240ef3..b880b8e 100644 (file)
@@ -89,7 +89,7 @@ enum eUSB_Keysyms
        KEYSYM_KPPERIOD,
        
        KEYSYM_NONUS_BACKSLASH,
-       KEYSYM_APPLICATION,     // Windows Key
+       KEYSYM_APPLICATION,     // Menu
        KEYSYM_POWER,
        KEYSYM_KPEQUALS,
        
@@ -128,6 +128,25 @@ enum eUSB_Keysyms
        KEYSYM_KBINT8,
        KEYSYM_KBINT9,
 
+       KEYSYM_LANG1,
+       KEYSYM_LANG2,
+       KEYSYM_LANG3,
+       KEYSYM_LANG4,
+       KEYSYM_LANG5,
+       KEYSYM_LANG6,
+       KEYSYM_LANG7,
+       KEYSYM_LANG8,
+       KEYSYM_LANG9,
+
+       KEYSYM_ALT_ERASE,
+       KEYSYM_SYSRQ,
+       KEYSYM_CANCEL,
+       KEYSYM_CLEAR,
+       KEYSYM_PRIOR,
+       KEYSYM_RETURN_,
+       KEYSYM_SEPAR,
+       KEYSYM_OUT,
+       KEYSYM_OPER,
        // TODO: Define this void
        
        KEYSYM_LEFTCTRL = 0xE0,
index c0ead3a..1c04542 100644 (file)
@@ -72,10 +72,15 @@ void KB_HandleScancode(Uint8 scancode)
        #endif
 
        hidcode = gp101_to_HID[giPS2Kb_Layer][scancode];
-       if( !hidcode )
+       if( hidcode == 0)
        {
-               Log_Warning("PS2Kb", "Unknown scancode %i:0x%x", giPS2Kb_Layer, scancode);
-               return ;
+               Log_Warning("PS2Kb", "Unknown scancode %i:0x%x %s", giPS2Kb_Layer, scancode,
+                       gbPS2Kb_KeyUp ? "release" : "press"
+                       );
+       }
+       else if( hidcode == -1 )
+       {
+               // Ignored (Fake shift)
        }
        else
        {
index 7ae8210..7ffbe0d 100644 (file)
@@ -40,13 +40,14 @@ Uint32      gp101_to_HID_2[128] = {
 //     0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F\r
 /*00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0-F\r
 /*10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, KEYSYM_KPENTER, KEYSYM_RIGHTCTRL, 0, 0,\r
-/*20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
-/*30*/ 0, 0, 0, 0, 0, KEYSYM_KPSLASH, 0, 0, KEYSYM_RIGHTALT, 0, 0, 0, 0, 0, 0, 0,\r
-/*40*/ 0, 0, 0, 0, 0, 0, 0, KEYSYM_HOME,\r
+/*20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1/*Fake LShift*/, 0, 0, 0, 0, 0,\r
+/*30*/ 0, 0, 0, 0, 0, KEYSYM_KPSLASH, 0, KEYSYM_PRINTSCREEN,\r
+       KEYSYM_RIGHTALT, 0, 0, 0, 0, 0, 0, 0,\r
+/*40*/ 0, 0, 0, 0, 0, 0, 0/*Break*/, KEYSYM_HOME,\r
        KEYSYM_UPARROW, KEYSYM_PGUP, 0, KEYSYM_LEFTARROW, 0, KEYSYM_RIGHTARROW, 0, KEYSYM_END,\r
 /*50*/ KEYSYM_DOWNARROW, KEYSYM_PGDN, KEYSYM_INSERT, KEYSYM_DELETE, 0, 0, 0, 0,\r
-       0, 0, 0, KEYSYM_LEFTGUI, KEYSYM_RIGHTGUI, KEYSYM_APPLICATION, 0, 0,\r
-/*60*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
+       0, 0, 0, KEYSYM_LEFTGUI, KEYSYM_RIGHTGUI, KEYSYM_APPLICATION, KEYSYM_POWER/*Power*/, 0/*Sleep*/,\r
+/*60*/ 0, 0, 0/*Wake*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
 /*70*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
 };\r
 // - 0xE1 Prefixed\r

UCC git Repository :: git.ucc.asn.au