Changeset b3c185b6 in mainline for uspace/lib/display/src/disp_srv.c
- Timestamp:
- 2019-11-04T14:05:35Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- be15256
- Parents:
- 22faaf2
- git-author:
- Jiri Svoboda <jiri@…> (2019-10-03 18:05:09)
- git-committer:
- Jiri Svoboda <jiri@…> (2019-11-04 14:05:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/display/src/disp_srv.c
r22faaf2 rb3c185b6 36 36 37 37 #include <disp_srv.h> 38 #include <display/event.h> 38 39 #include <errno.h> 40 #include <io/log.h> 39 41 #include <ipc/display.h> 40 42 #include <stdlib.h> 41 43 #include <stddef.h> 44 45 #include <stdio.h> 46 static void display_callback_create_srv(display_srv_t *srv, ipc_call_t *call) 47 { 48 printf("display_callback_create_srv\n"); 49 50 async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE); 51 if (sess == NULL) { 52 async_answer_0(call, ENOMEM); 53 return; 54 } 55 56 srv->client_sess = sess; 57 async_answer_0(call, EOK); 58 } 42 59 43 60 static void display_window_create_srv(display_srv_t *srv, ipc_call_t *icall) … … 45 62 sysarg_t wnd_id; 46 63 errno_t rc; 64 65 printf("display_window_create_srv\n"); 47 66 48 67 if (srv->ops->window_create == NULL) { … … 60 79 errno_t rc; 61 80 81 printf("display_window_destroy_srv\n"); 82 62 83 wnd_id = ipc_get_arg1(icall); 63 84 … … 71 92 } 72 93 94 static void display_get_event_srv(display_srv_t *srv, ipc_call_t *icall) 95 { 96 sysarg_t wnd_id; 97 display_wnd_ev_t event; 98 ipc_call_t call; 99 size_t size; 100 errno_t rc; 101 102 printf("display_get_event_srv\n"); 103 104 if (srv->ops->get_event == NULL) { 105 async_answer_0(icall, ENOTSUP); 106 return; 107 } 108 109 rc = srv->ops->get_event(srv->arg, &wnd_id, &event); 110 if (rc != EOK) 111 async_answer_0(icall, rc); 112 113 /* Transfer event data */ 114 if (!async_data_read_receive(&call, &size)) { 115 async_answer_0(icall, EREFUSED); 116 return; 117 } 118 119 if (size != sizeof(event)) { 120 async_answer_0(icall, EREFUSED); 121 async_answer_0(&call, EREFUSED); 122 return; 123 } 124 125 rc = async_data_read_finalize(&call, &event, sizeof(event)); 126 if (rc != EOK) { 127 async_answer_0(icall, rc); 128 async_answer_0(&call, rc); 129 return; 130 } 131 132 async_answer_1(icall, EOK, wnd_id); 133 } 134 73 135 void display_conn(ipc_call_t *icall, display_srv_t *srv) 74 136 { 75 137 /* Accept the connection */ 76 138 async_accept_0(icall); 139 printf("display_conn\n"); 77 140 78 141 while (true) { … … 88 151 } 89 152 153 printf("display_conn method=%lu\n", method); 90 154 switch (method) { 155 case DISPLAY_CALLBACK_CREATE: 156 display_callback_create_srv(srv, &call); 157 break; 91 158 case DISPLAY_WINDOW_CREATE: 92 159 display_window_create_srv(srv, &call); … … 94 161 case DISPLAY_WINDOW_DESTROY: 95 162 display_window_destroy_srv(srv, &call); 163 break; 164 case DISPLAY_GET_EVENT: 165 display_get_event_srv(srv, &call); 96 166 break; 97 167 default: … … 101 171 } 102 172 173 /** Send 'pending' event to client. 174 * 175 * @param srv Display server structure 176 */ 177 void display_srv_ev_pending(display_srv_t *srv) 178 { 179 async_exch_t *exch; 180 181 printf("display_srv_ev_pending()\n"); 182 183 exch = async_exchange_begin(srv->client_sess); 184 async_msg_0(exch, DISPLAY_EV_PENDING); 185 async_exchange_end(exch); 186 } 187 103 188 /** @} 104 189 */
Note:
See TracChangeset
for help on using the changeset viewer.