#include <tpl_drv_terminal.h>
#include <errno.h>
+#define USE_CTRL_ALT 0
+
// === CONSTANTS ===
#define VERSION ((0<<8)|(50))
if(!gsVT_OutputDevice) gsVT_OutputDevice = "/Devices/"DEFAULT_OUTPUT;
if(!gsVT_InputDevice) gsVT_InputDevice = "/Devices/"DEFAULT_INPUT;
- LOG("Using '%s' as output", gsVT_OutputDevice);
- LOG("Using '%s' as input", gsVT_InputDevice);
+ Log_Log("VTerm", "Using '%s' as output", gsVT_OutputDevice);
+ Log_Log("VTerm", "Using '%s' as input", gsVT_InputDevice);
// Create Nodes
for( i = 0; i < NUM_VTS; i++ )
// Set kernel output to VT0
Debug_SetKTerminal("/Devices/VTerm/0");
- return MODULE_INIT_SUCCESS;
+ return MODULE_ERR_OK;
}
/**
break;
case TERM_MODE_FB:
- case TERM_MODE_OPENGL:
+ //case TERM_MODE_:
while(pos < Length)
{
while(term->InputRead == term->InputWrite) Threads_Yield();
case TERM_MODE_TEXT:
VT_int_PutString(term, Buffer, Length);
break;
+ case TERM_MODE_FB:
+ if( term->RealWidth > term->Width || term->RealHeight > term->Height )
+ {
+ #if 0
+ int x, y, h;
+ x = Offset/4; y = x / term->Width; x %= term->Width;
+ w = Length/4+x; h = w / term->Width; w %= term->Width;
+ while(h--)
+ {
+ VFS_WriteAt( giVT_OutputDevHandle,
+ (x+y*term->RealWidth)*4,
+ term->Width * 4,
+ Buffer
+ );
+ Buffer = (void*)( (Uint)Buffer + term->Width*term->Height*4 );
+ }
+ #endif
+ return 0;
+ }
+ else {
+ return VFS_WriteAt( giVT_OutputDevHandle, Offset, Length, Buffer );
+ }
}
//LEAVE('i', 0);
tVTerm *term = Node->ImplPtr;
ENTER("pNode iId pData", Node, Id, Data);
+ if(Id >= DRV_IOCTL_LOOKUP) {
+ if( Threads_GetUID() != 0 ) return -1;
+ }
+
switch(Id)
{
case DRV_IOCTL_TYPE:
Log("VT_Terminal_IOCtl - RETURN term->Height = %i", term->Height);
LEAVE('i', term->Height);
return term->Height;
+
+ case TERM_IOCTL_FORCESHOW:
+ VT_SetTerminal( Node->Inode );
+ LEAVE('i', 1);
+ return 1;
}
LEAVE('i', -1);
return -1;
VFS_IOCtl( giVT_OutputDevHandle, VIDEO_IOCTL_GETSETMODE, &modeNum );
// Update current terminal ID
- Log("Changed terminal from %i to %i", giVT_CurrentTerminal, ID);
+ Log_Log("VTerm", "Changed terminal from %i to %i", giVT_CurrentTerminal, ID);
giVT_CurrentTerminal = ID;
// Update the screen
/**
* \fn void VT_KBCallBack(Uint32 Codepoint)
* \brief Called on keyboard interrupt
+ * \param Codepoint Pseudo-UTF32 character
+ *
+ * Handles a key press and sends the key code to the user's buffer.
+ * If the code creates a kernel-magic sequence, it is not passed to the
+ * user and is handled in-kernel.
*/
void VT_KBCallBack(Uint32 Codepoint)
{
Codepoint &= 0x7FFFFFFF;
switch(Codepoint)
{
+ #if !USE_CTRL_ALT
+ case KEY_RSHIFT: gbVT_CtrlDown = 0; break;
+ case KEY_LSHIFT: gbVT_AltDown = 0; break;
+ #else
case KEY_LALT:
case KEY_RALT:
gbVT_AltDown = 0;
case KEY_RCTRL:
gbVT_CtrlDown = 0;
break;
+ #endif
}
return;
}
switch(Codepoint)
{
+ #if !USE_CTRL_ALT
+ case KEY_RSHIFT: gbVT_CtrlDown = 1; break;
+ case KEY_LSHIFT: gbVT_AltDown = 1; break;
+ #else
case KEY_LALT:
case KEY_RALT:
gbVT_AltDown = 1;
case KEY_RCTRL:
gbVT_CtrlDown = 1;
break;
+ #endif
default:
+ #if USE_CTRL_ALT
if(!gbVT_AltDown || !gbVT_CtrlDown)
break;
+ #endif
switch(Codepoint)
{
case KEY_F1: VT_SetTerminal(0); return;
free(Term->Text);
Term->Buffer = calloc( Term->Width*Term->Height, sizeof(Uint32) );
break;
- case TERM_MODE_OPENGL:
- return;
+ //case TERM_MODE_OPENGL:
+ // return;
}
Term->Mode = NewMode;