Changeset b0f00a9 in mainline for uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c
- Timestamp:
- 2011-11-06T22:21:05Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 898e847
- Parents:
- 2bdf8313 (diff), 7b5f4c9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c
r2bdf8313 rb0f00a9 39 39 #include <ddi.h> 40 40 #include <libarch/ddi.h> 41 #include < devmap.h>41 #include <loc.h> 42 42 #include <io/console.h> 43 43 #include <vfs/vfs.h> 44 #include <ipc/mouse .h>44 #include <ipc/mouseev.h> 45 45 #include <async.h> 46 46 #include <unistd.h> … … 50 50 #include <errno.h> 51 51 #include <inttypes.h> 52 53 52 #include "s3c24xx_ts.h" 54 53 55 #define NAME "s3c24ser"56 #define NAMESPACE "hid_in"54 #define NAME "s3c24ser" 55 #define NAMESPACE "hid" 57 56 58 57 static irq_cmd_t ts_irq_cmds[] = { … … 70 69 static s3c24xx_ts_t *ts; 71 70 72 static void s3c24xx_ts_connection(ipc_callid_t iid, ipc_call_t *icall); 71 static void s3c24xx_ts_connection(ipc_callid_t iid, ipc_call_t *icall, 72 void *arg); 73 73 static void s3c24xx_ts_irq_handler(ipc_callid_t iid, ipc_call_t *call); 74 74 static void s3c24xx_ts_pen_down(s3c24xx_ts_t *ts); … … 86 86 printf(NAME ": S3C24xx touchscreen driver\n"); 87 87 88 rc = devmap_driver_register(NAME, s3c24xx_ts_connection);88 rc = loc_server_register(NAME, s3c24xx_ts_connection); 89 89 if (rc < 0) { 90 90 printf(NAME ": Unable to register driver.\n"); … … 99 99 return -1; 100 100 101 rc = devmap_device_register(NAMESPACE "/mouse", &ts->devmap_handle);101 rc = loc_service_register(NAMESPACE "/mouse", &ts->service_id); 102 102 if (rc != EOK) { 103 103 printf(NAME ": Unable to register device %s.\n", … … 130 130 131 131 ts->io = vaddr; 132 ts->client_ phone = -1;132 ts->client_sess = NULL; 133 133 ts->state = ts_wait_pendown; 134 134 ts->last_x = 0; … … 280 280 button = 1; 281 281 press = 0; 282 async_msg_2(ts->client_phone, MEVENT_BUTTON, button, press); 282 283 async_exch_t *exch = async_exchange_begin(ts->client_sess); 284 async_msg_2(exch, MOUSEEV_BUTTON_EVENT, button, press); 285 async_exchange_end(exch); 283 286 284 287 s3c24xx_ts_wait_for_int_mode(ts, updn_down); … … 321 324 322 325 /* Send notifications to client. */ 323 async_msg_2(ts->client_phone, MEVENT_MOVE, dx, dy); 324 async_msg_2(ts->client_phone, MEVENT_BUTTON, button, press); 326 async_exch_t *exch = async_exchange_begin(ts->client_sess); 327 async_msg_2(exch, MOUSEEV_MOVE_EVENT, dx, dy); 328 async_msg_2(exch, MOUSEEV_BUTTON_EVENT, button, press); 329 async_exchange_end(exch); 325 330 326 331 ts->last_x = x_pos; … … 370 375 371 376 /** Handle mouse client connection. */ 372 static void s3c24xx_ts_connection(ipc_callid_t iid, ipc_call_t *icall) 373 { 374 ipc_callid_t callid; 375 ipc_call_t call; 376 int retval; 377 377 static void s3c24xx_ts_connection(ipc_callid_t iid, ipc_call_t *icall, 378 void *arg) 379 { 378 380 async_answer_0(iid, EOK); 379 380 while (1) { 381 callid = async_get_call(&call); 382 switch (IPC_GET_IMETHOD(call)) { 383 case IPC_M_PHONE_HUNGUP: 384 if (ts->client_phone != -1) { 385 async_hangup(ts->client_phone); 386 ts->client_phone = -1; 381 382 while (true) { 383 ipc_call_t call; 384 ipc_callid_t callid = async_get_call(&call); 385 386 if (!IPC_GET_IMETHOD(call)) { 387 if (ts->client_sess != NULL) { 388 async_hangup(ts->client_sess); 389 ts->client_sess = NULL; 387 390 } 388 391 389 392 async_answer_0(callid, EOK); 390 393 return; 391 case IPC_M_CONNECT_TO_ME:392 if (ts->client_phone != -1) {393 retval = ELIMIT;394 break;395 }396 ts->client_phone = IPC_GET_ARG5(call);397 retval = 0;398 break;399 default:400 retval = EINVAL;401 394 } 402 async_answer_0(callid, retval); 395 396 async_sess_t *sess = 397 async_callback_receive_start(EXCHANGE_SERIALIZE, &call); 398 if (sess != NULL) { 399 if (ts->client_sess == NULL) { 400 ts->client_sess = sess; 401 async_answer_0(callid, EOK); 402 } else 403 async_answer_0(callid, ELIMIT); 404 } else 405 async_answer_0(callid, EINVAL); 403 406 } 404 407 }
Note:
See TracChangeset
for help on using the changeset viewer.
