Changeset 10569b1 in mainline for console/console.c
- Timestamp:
- 2006-06-02T08:44:26Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1180a88e
- Parents:
- df688cd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
console/console.c
rdf688cd r10569b1 41 41 #include <screenbuffer.h> 42 42 43 #define CONSOLE_COUNT 843 #define CONSOLE_COUNT 12 44 44 #define MAX_KEYREQUESTS_BUFFERED 32 45 45 … … 89 89 return CONSOLE_COUNT; 90 90 } 91 92 /** Check key and process special keys. 93 * 94 * */ 95 static void write_char(int console, char key) 96 { 97 screenbuffer_t *scr = &(connections[console].screenbuffer); 98 99 switch (key) { 100 case '\n': 101 scr->position_y += 1; 102 scr->position_x = 0; 103 break; 104 case '\r': 105 break; 106 case '\t': 107 scr->position_x += 8; 108 scr->position_x -= scr->position_x % 8; 109 break; 110 case '\b': 111 if (scr->position_x == 0) 112 break; 113 114 scr->position_x--; 115 116 if (console == active_console) { 117 ipc_call_async_3(fb_info.phone, FB_PUTCHAR, ' ', scr->position_y, scr->position_x, NULL, NULL); 118 } 119 120 screenbuffer_putchar(scr, ' '); 121 122 break; 123 default: 124 if (console == active_console) { 125 ipc_call_async_3(fb_info.phone, FB_PUTCHAR, key, scr->position_y, scr->position_x, NULL, NULL); 126 } 127 128 screenbuffer_putchar(scr, key); 129 scr->position_x++; 130 } 131 132 scr->position_y += (scr->position_x >= scr->size_x); 133 134 if (scr->position_y >= scr->size_y) { 135 scr->position_y = scr->size_y - 1; 136 screenbuffer_clear_line(scr, scr->top_line++); 137 ipc_call_async(fb_info.phone, FB_SCROLL, 1, NULL, NULL); 138 } 139 140 scr->position_x = scr->position_x % scr->size_x; 141 scr->position_y = scr->position_y % scr->size_y; 142 143 } 144 91 145 92 146 /* Handler for keyboard */ … … 119 173 if ((c >= '1') && (c < '1' + CONSOLE_COUNT)) { 120 174 /*FIXME: draw another console content from buffer */ 121 175 if (c - KBD_KEY_F1 == active_console) 176 break; 122 177 active_console = c - '1'; 123 178 conn = &connections[active_console]; … … 125 180 ipc_call_async(fb_info.phone, FB_CURSOR_VISIBILITY, 0, NULL, NULL); 126 181 ipc_call_async_2(fb_info.phone, FB_CLEAR, 0, 0, NULL, NULL); 182 127 183 for (i = 0; i < conn->screenbuffer.size_x; i++) 128 184 for (j = 0; j < conn->screenbuffer.size_y; j++) { … … 167 223 return; 168 224 } 169 225 170 226 connections[consnum].used = 1; 171 227 connections[consnum].client_phone = IPC_GET_ARG3(call); 172 228 screenbuffer_clear(&(connections[consnum].screenbuffer)); 173 229 174 230 /* Accept the connection */ 175 231 ipc_answer_fast(iid,0,0,0); … … 183 239 return; 184 240 case CONSOLE_PUTCHAR: 185 186 /* Send message to fb */ 187 if (consnum == active_console) { 188 ipc_call_async_3(fb_info.phone, FB_PUTCHAR, IPC_GET_ARG2(call), connections[consnum].screenbuffer.position_y, \ 189 connections[consnum].screenbuffer.position_x, NULL, NULL); 190 } 191 192 screenbuffer_putchar(&(connections[consnum].screenbuffer), IPC_GET_ARG2(call)); 241 write_char(consnum, IPC_GET_ARG1(call)); 193 242 break; 194 243 case CONSOLE_CLEAR: … … 271 320 } 272 321 322 273 323 if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, &phonehash) != 0) { 274 324 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.