Subversion Repositories HelenOS

Rev

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

Rev 2479 Rev 2619
Line 66... Line 66...
66
#endif
66
#endif
67
   
67
   
68
    kbd_arch_process(&keybuffer, call);
68
    kbd_arch_process(&keybuffer, call);
69
 
69
 
70
    if (cons_connected && phone2cons != -1) {
70
    if (cons_connected && phone2cons != -1) {
-
 
71
        /*
71
        /* recode to ASCII - one interrupt can produce more than one code so result is stored in fifo */
72
         * recode to ASCII - one interrupt can produce more than one
-
 
73
         * code so result is stored in fifo
-
 
74
         */
72
        while (!keybuffer_empty(&keybuffer)) {
75
        while (!keybuffer_empty(&keybuffer)) {
73
            if (!keybuffer_pop(&keybuffer, (int *)&chr))
76
            if (!keybuffer_pop(&keybuffer, (int *)&chr))
74
                break;
77
                break;
75
 
78
 
76
            async_msg(phone2cons, KBD_PUSHCHAR, chr);
79
            async_msg(phone2cons, KBD_PUSHCHAR, chr);
Line 83... Line 86...
83
    ipc_callid_t callid;
86
    ipc_callid_t callid;
84
    ipc_call_t call;
87
    ipc_call_t call;
85
    int retval;
88
    int retval;
86
 
89
 
87
    if (cons_connected) {
90
    if (cons_connected) {
88
        ipc_answer_fast(iid, ELIMIT, 0, 0);
91
        ipc_answer_0(iid, ELIMIT);
89
        return;
92
        return;
90
    }
93
    }
91
    cons_connected = 1;
94
    cons_connected = 1;
92
    ipc_answer_fast(iid, 0, 0, 0);
95
    ipc_answer_0(iid, EOK);
93
 
96
 
94
    while (1) {
97
    while (1) {
95
        callid = async_get_call(&call);
98
        callid = async_get_call(&call);
96
        switch (IPC_GET_METHOD(call)) {
99
        switch (IPC_GET_METHOD(call)) {
97
        case IPC_M_PHONE_HUNGUP:
100
        case IPC_M_PHONE_HUNGUP:
98
            cons_connected = 0;
101
            cons_connected = 0;
99
            ipc_hangup(phone2cons);
102
            ipc_hangup(phone2cons);
100
            phone2cons = -1;
103
            phone2cons = -1;
101
            ipc_answer_fast(callid, 0,0,0);
104
            ipc_answer_0(callid, EOK);
102
            return;
105
            return;
103
        case IPC_M_CONNECT_TO_ME:
106
        case IPC_M_CONNECT_TO_ME:
104
            if (phone2cons != -1) {
107
            if (phone2cons != -1) {
105
                retval = ELIMIT;
108
                retval = ELIMIT;
106
                break;
109
                break;
Line 109... Line 112...
109
            retval = 0;
112
            retval = 0;
110
            break;
113
            break;
111
        default:
114
        default:
112
            retval = EINVAL;
115
            retval = EINVAL;
113
        }
116
        }
114
        ipc_answer_fast(callid, retval, 0, 0);
117
        ipc_answer_0(callid, retval);
115
    }  
118
    }  
116
}
119
}
117
 
120
 
118
 
121
 
119
int main(int argc, char **argv)
122
int main(int argc, char **argv)