Subversion Repositories HelenOS-historic

Rev

Rev 1466 | Rev 1481 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1466 Rev 1476
Line 42... Line 42...
42
{
42
{
43
    __SYSCALL3(SYS_IO, 1, &c, 1);
43
    __SYSCALL3(SYS_IO, 1, &c, 1);
44
 
44
 
45
}
45
}
46
//#define CONSOLE_COUNT VFB_CONNECTIONS
46
//#define CONSOLE_COUNT VFB_CONNECTIONS
47
#define CONSOLE_COUNT 6
47
#define CONSOLE_COUNT 8
48
 
48
 
49
#define NAME "CONSOLE"
49
#define NAME "CONSOLE"
50
 
50
 
51
int active_client = 0;
51
int active_console = 1;
52
 
52
 
53
 
53
 
54
typedef struct {
54
typedef struct {
55
    keybuffer_t keybuffer;
55
    keybuffer_t keybuffer;
56
    int client_phone;
56
    int client_phone;
Line 91... Line 91...
91
{
91
{
92
    ipc_callid_t callid;
92
    ipc_callid_t callid;
93
    ipc_call_t call;
93
    ipc_call_t call;
94
    int retval;
94
    int retval;
95
    int i;
95
    int i;
-
 
96
    char c;
96
 
97
 
97
    /* Ignore parameters, the connection is alread opened */
98
    /* Ignore parameters, the connection is alread opened */
98
    while (1) {
99
    while (1) {
99
        callid = async_get_call(&call);
100
        callid = async_get_call(&call);
100
        switch (IPC_GET_METHOD(call)) {
101
        switch (IPC_GET_METHOD(call)) {
Line 109... Line 110...
109
           
110
           
110
            /* if client is awaiting key, send it */
111
            /* if client is awaiting key, send it */
111
           
112
           
112
            /*FIXME: else store key to its buffer */
113
            /*FIXME: else store key to its buffer */
113
            retval = 0;
114
            retval = 0;
114
            i = IPC_GET_ARG1(call) & 0xff;
115
            c = IPC_GET_ARG1(call);
-
 
116
//          ipc_call_sync_2(connections[3].vfb_phone, FB_PUTCHAR, 0, c,NULL,NULL);
115
            /* switch to another virtual console */
117
            /* switch to another virtual console */
116
            if ((i >= KBD_KEY_F1) && (i < KBD_KEY_F1 + CONSOLE_COUNT)) {
118
            if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + CONSOLE_COUNT)) {
117
                active_client = i - KBD_KEY_F1;
119
                active_console = c - KBD_KEY_F1;
118
                break;
120
                break;
119
            }
121
            }
120
            keybuffer_push(&(connections[active_client].keybuffer), i);
122
            keybuffer_push(&(connections[active_console].keybuffer), c);
-
 
123
           
121
            /* Send it to first FB, DEBUG */
124
            /* Send it to first FB, DEBUG */
122
//          ipc_call_async_2(connections[0].vfb_phone, FB_PUTCHAR, 0, IPC_GET_ARG1(call),NULL,NULL);
125
//          ipc_call_async_2(connections[0].vfb_phone, FB_PUTCHAR, 0, IPC_GET_ARG1(call),NULL,NULL);
123
//          ipc_call_sync_2(connections[0].vfb_phone, FB_PUTCHAR, 0, IPC_GET_ARG1(call),NULL,NULL);
126
//          ipc_call_sync_2(connections[4].vfb_phone, FB_PUTCHAR, 0, c,NULL,NULL);
124
 
127
 
125
            break;
128
            break;
126
        default:
129
        default:
127
            retval = ENOENT;
130
            retval = ENOENT;
128
        }      
131
        }      
Line 154... Line 157...
154
        case IPC_M_PHONE_HUNGUP:
157
        case IPC_M_PHONE_HUNGUP:
155
            /* TODO */
158
            /* TODO */
156
            ipc_answer_fast(callid, 0,0,0);
159
            ipc_answer_fast(callid, 0,0,0);
157
            return;
160
            return;
158
        case CONSOLE_PUTCHAR:
161
        case CONSOLE_PUTCHAR:
-
 
162
            if (consnum != active_console) {
-
 
163
            }
159
            /* Send message to fb */
164
            /* Send message to fb */
160
            ipc_call_async_2(connections[consnum].vfb_phone, FB_PUTCHAR, IPC_GET_ARG1(call), IPC_GET_ARG2(call), NULL, NULL);
165
            ipc_call_sync_2(connections[consnum].vfb_phone, FB_PUTCHAR, IPC_GET_ARG1(call), IPC_GET_ARG2(call), NULL, NULL);
-
 
166
//          ipc_call_sync_2(connections[6].vfb_phone, FB_PUTCHAR, 0, IPC_GET_ARG2(call),NULL,NULL);
-
 
167
            break;
-
 
168
        case CONSOLE_CLEAR:
161
            break;
169
            break;
-
 
170
        case CONSOLE_GOTO:
-
 
171
            break;
-
 
172
 
162
        case CONSOLE_GETCHAR:
173
        case CONSOLE_GETCHAR:
163
            /* FIXME: Only temporary solution until request storage will be created  */
174
            /* FIXME: Only temporary solution until request storage will be created  */
164
            while (!keybuffer_pop(&(connections[active_client].keybuffer), (char *)&arg1)) {
175
            while (keybuffer_empty(&(connections[consnum].keybuffer))) {
165
                /* FIXME: buffer empty -> store request */
176
                /* FIXME: buffer empty -> store request */
166
                async_usleep(100000);
177
                async_usleep(1000);
167
            };
178
            };
-
 
179
            keybuffer_pop(&(connections[consnum].keybuffer), (char *)&arg1);
-
 
180
//          ipc_call_sync_2(connections[6].vfb_phone, FB_PUTCHAR, 0, arg1,NULL,NULL);
168
           
181
           
169
            break;
182
            break;
170
        }
183
        }
171
        ipc_answer_fast(callid, 0, arg1, 0);
184
        ipc_answer_fast(callid, 0, arg1, 0);
172
    }
185
    }