From: John Hodge Date: Thu, 15 Mar 2012 14:26:52 +0000 (+0800) Subject: Kernel - Fixing bugs in VT scrolling and keyboard mappings exposed by RHW tests X-Git-Tag: rel0.15~728 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=168af87d8fcc01a6a521f3929835f15b201b5251;p=tpg%2Facess2.git Kernel - Fixing bugs in VT scrolling and keyboard mappings exposed by RHW tests --- diff --git a/KernelLand/Kernel/drv/vterm.c b/KernelLand/Kernel/drv/vterm.c index 40fa50f6..0489d41b 100644 --- a/KernelLand/Kernel/drv/vterm.c +++ b/KernelLand/Kernel/drv/vterm.c @@ -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 === diff --git a/KernelLand/Kernel/drv/vterm_input.c b/KernelLand/Kernel/drv/vterm_input.c index a037b34c..20e47db0 100644 --- a/KernelLand/Kernel/drv/vterm_input.c +++ b/KernelLand/Kernel/drv/vterm_input.c @@ -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; diff --git a/KernelLand/Kernel/drv/vterm_termbuf.c b/KernelLand/Kernel/drv/vterm_termbuf.c index 2511048c..b6aff95c 100644 --- a/KernelLand/Kernel/drv/vterm_termbuf.c +++ b/KernelLand/Kernel/drv/vterm_termbuf.c @@ -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; diff --git a/KernelLand/Kernel/include/keysyms.h b/KernelLand/Kernel/include/keysyms.h index d240ef30..b880b8e1 100644 --- a/KernelLand/Kernel/include/keysyms.h +++ b/KernelLand/Kernel/include/keysyms.h @@ -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, diff --git a/KernelLand/Modules/Input/PS2KbMouse/kb.c b/KernelLand/Modules/Input/PS2KbMouse/kb.c index c0ead3a4..1c04542e 100644 --- a/KernelLand/Modules/Input/PS2KbMouse/kb.c +++ b/KernelLand/Modules/Input/PS2KbMouse/kb.c @@ -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 { diff --git a/KernelLand/Modules/Input/PS2KbMouse/kb_transtab.h b/KernelLand/Modules/Input/PS2KbMouse/kb_transtab.h index 7ae82103..7ffbe0da 100644 --- a/KernelLand/Modules/Input/PS2KbMouse/kb_transtab.h +++ b/KernelLand/Modules/Input/PS2KbMouse/kb_transtab.h @@ -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 /*00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0-F /*10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, KEYSYM_KPENTER, KEYSYM_RIGHTCTRL, 0, 0, -/*20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/*30*/ 0, 0, 0, 0, 0, KEYSYM_KPSLASH, 0, 0, KEYSYM_RIGHTALT, 0, 0, 0, 0, 0, 0, 0, -/*40*/ 0, 0, 0, 0, 0, 0, 0, KEYSYM_HOME, +/*20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1/*Fake LShift*/, 0, 0, 0, 0, 0, +/*30*/ 0, 0, 0, 0, 0, KEYSYM_KPSLASH, 0, KEYSYM_PRINTSCREEN, + KEYSYM_RIGHTALT, 0, 0, 0, 0, 0, 0, 0, +/*40*/ 0, 0, 0, 0, 0, 0, 0/*Break*/, KEYSYM_HOME, KEYSYM_UPARROW, KEYSYM_PGUP, 0, KEYSYM_LEFTARROW, 0, KEYSYM_RIGHTARROW, 0, KEYSYM_END, /*50*/ KEYSYM_DOWNARROW, KEYSYM_PGDN, KEYSYM_INSERT, KEYSYM_DELETE, 0, 0, 0, 0, - 0, 0, 0, KEYSYM_LEFTGUI, KEYSYM_RIGHTGUI, KEYSYM_APPLICATION, 0, 0, -/*60*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, KEYSYM_LEFTGUI, KEYSYM_RIGHTGUI, KEYSYM_APPLICATION, KEYSYM_POWER/*Power*/, 0/*Sleep*/, +/*60*/ 0, 0, 0/*Wake*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*70*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; // - 0xE1 Prefixed