// === IMPORTS ===
extern void Video_SetCursorPos(short X, short Y);
const char *gsMouseDevice;
-extern int giTerminalFD;
+extern int giTerminalFD_Input;
extern int giScreenWidth;
extern int giScreenHeight;
void Input_FillSelect(int *nfds, fd_set *set)
{
- if(*nfds < giTerminalFD) *nfds = giTerminalFD;
+ if(*nfds < giTerminalFD_Input) *nfds = giTerminalFD_Input;
if(*nfds < giMouseFD) *nfds = giMouseFD;
- FD_SET(giTerminalFD, set);
+ FD_SET(giTerminalFD_Input, set);
FD_SET(giMouseFD, set);
}
void Input_HandleSelect(fd_set *set)
{
- if(FD_ISSET(giTerminalFD, set))
+ if(FD_ISSET(giTerminalFD_Input, set))
{
uint32_t codepoint;
static uint32_t scancode;
#define KEY_CODEPOINT_MASK 0x3FFFFFFF
- if( read(giTerminalFD, &codepoint, sizeof(codepoint)) != sizeof(codepoint) )
+ size_t readlen = read(giTerminalFD_Input, &codepoint, sizeof(codepoint));
+ if( readlen != sizeof(codepoint) )
{
// oops, error
- _SysDebug("Terminal read failed?");
+ _SysDebug("Terminal read failed? (%i != %i)", readlen, sizeof(codepoint));
}
// _SysDebug("Keypress 0x%x", codepoint);
#include <wm.h>
#include <string.h>
+// === IMPORTS ===
+extern int giTerminalFD_Input;
+
// === PROTOTYPES ===
void Video_Setup(void);
void Video_SetCursorPos(short X, short Y);
}
#else
giTerminalFD = 1;
+ giTerminalFD_Input = 0;
// Check that the console is a VT
// - ioctl(..., 0, NULL) returns the type, which should be 2
if( ioctl(1, 0, NULL) != 2 )