~jakub/helenos/ia64-revival

« back to all changes in this revision

Viewing changes to uspace/srv/hid/kbd/generic/kbd.c

  • Committer: Jakub Jermar
  • Date: 2011-04-13 14:45:41 UTC
  • mfrom: (527.1.397 main-clone)
  • Revision ID: jakub@jermar.eu-20110413144541-x0j3r1zxqhsljx1o
MergeĀ mainlineĀ changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
/** @file
36
36
 */
37
37
 
38
 
#include <ipc/ipc.h>
39
38
#include <ipc/services.h>
40
39
#include <ipc/kbd.h>
41
40
#include <sysinfo.h>
67
66
/** Currently pressed lock keys. We track these to tackle autorepeat. */
68
67
static unsigned lock_keys;
69
68
 
70
 
int cir_service = 0;
71
 
int cir_phone = -1;
 
69
bool irc_service = false;
 
70
int irc_phone = -1;
72
71
 
73
72
#define NUM_LAYOUTS 3
74
73
 
172
171
        ipc_call_t call;
173
172
        int retval;
174
173
 
175
 
        ipc_answer_0(iid, EOK);
 
174
        async_answer_0(iid, EOK);
176
175
 
177
176
        while (1) {
178
177
                callid = async_get_call(&call);
179
 
                switch (IPC_GET_METHOD(call)) {
 
178
                switch (IPC_GET_IMETHOD(call)) {
180
179
                case IPC_M_PHONE_HUNGUP:
181
180
                        if (client_phone != -1) {
182
 
                                ipc_hangup(client_phone);
 
181
                                async_hangup(client_phone);
183
182
                                client_phone = -1;
184
183
                        }
185
184
                        
186
 
                        ipc_answer_0(callid, EOK);
 
185
                        async_answer_0(callid, EOK);
187
186
                        return;
188
187
                case IPC_M_CONNECT_TO_ME:
189
188
                        if (client_phone != -1) {
204
203
                default:
205
204
                        retval = EINVAL;
206
205
                }
207
 
                ipc_answer_0(callid, retval);
 
206
                async_answer_0(callid, retval);
208
207
        }       
209
208
}
210
209
 
216
215
        sysarg_t fhc;
217
216
        sysarg_t obio;
218
217
        
219
 
        if ((sysinfo_get_value("kbd.cir.fhc", &fhc) == EOK) && (fhc))
220
 
                cir_service = SERVICE_FHC;
221
 
        else if ((sysinfo_get_value("kbd.cir.obio", &obio) == EOK) && (obio))
222
 
                cir_service = SERVICE_OBIO;
 
218
        if (((sysinfo_get_value("kbd.cir.fhc", &fhc) == EOK) && (fhc))
 
219
            || ((sysinfo_get_value("kbd.cir.obio", &obio) == EOK) && (obio)))
 
220
                irc_service = true;
223
221
        
224
 
        if (cir_service) {
225
 
                while (cir_phone < 0) {
226
 
                        cir_phone = ipc_connect_me_to_blocking(PHONE_NS, cir_service,
227
 
                            0, 0);
228
 
                }
 
222
        if (irc_service) {
 
223
                while (irc_phone < 0)
 
224
                        irc_phone = service_connect_blocking(SERVICE_IRC, 0, 0);
229
225
        }
230
226
        
231
227
        /* Initialize port driver. */
249
245
        char kbd[DEVMAP_NAME_MAXLEN + 1];
250
246
        snprintf(kbd, DEVMAP_NAME_MAXLEN, "%s/%s", NAMESPACE, NAME);
251
247
        
252
 
        dev_handle_t dev_handle;
253
 
        if (devmap_device_register(kbd, &dev_handle) != EOK) {
 
248
        devmap_handle_t devmap_handle;
 
249
        if (devmap_device_register(kbd, &devmap_handle) != EOK) {
254
250
                printf("%s: Unable to register device %s\n", NAME, kbd);
255
251
                return -1;
256
252
        }