Changeset fa09449 in mainline
- Timestamp:
- 2009-02-15T22:31:07Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6cd9aa6
- Parents:
- 76dd25b
- Location:
- uspace
- Files:
-
- 3 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tetris/input.c
r76dd25b rfa09449 115 115 cons_phone = get_cons_phone(); 116 116 getchar_inprog = async_send_2(cons_phone, 117 CONSOLE_GET CHAR, 0, 0, &charcall);117 CONSOLE_GETKEY, 0, 0, &charcall); 118 118 } 119 119 if (!s) … … 128 128 stop("end of file, help"); 129 129 } 130 lastchar = IPC_GET_ARG 1(charcall);130 lastchar = IPC_GET_ARG4(charcall); 131 131 } 132 132 if (tvp) { -
uspace/app/trace/trace.c
r76dd25b rfa09449 624 624 V_INTEGER, 625 625 V_INTEGER, 626 V_INTEGER 626 V_INTEGER 627 627 }; 628 628 … … 659 659 660 660 p = proto_new("console"); 661 resp_def[0] = V_CHAR; 662 o = oper_new("getchar", 0, arg_def, V_INTEGER, 2, resp_def); 663 proto_add_oper(p, CONSOLE_GETCHAR, o); 661 resp_def[0] = V_INTEGER; resp_def[1] = V_INTEGER; 662 resp_def[2] = V_INTEGER; resp_def[3] = V_CHAR; 663 o = oper_new("getkey", 0, arg_def, V_ERRNO, 4, resp_def); 664 proto_add_oper(p, CONSOLE_GETKEY, o); 664 665 665 666 arg_def[0] = V_CHAR; -
uspace/lib/libc/Makefile
r76dd25b rfa09449 80 80 generic/err.c \ 81 81 generic/stdlib.c \ 82 generic/kbd.c \ 82 83 generic/mman.c \ 83 84 generic/udebug.c \ -
uspace/lib/libc/generic/io/stream.c
r76dd25b rfa09449 44 44 #include <ipc/services.h> 45 45 #include <ipc/console.h> 46 #include <kbd/kbd.h> 46 47 #include <unistd.h> 47 48 #include <async.h> … … 59 60 open_console(); 60 61 if (console_phone >= 0) { 61 ipcarg_t r0, r1; 62 kbd_event_t ev; 63 int rc; 62 64 size_t i = 0; 63 65 64 66 while (i < count) { 65 if (async_req_0_2(console_phone, CONSOLE_GETCHAR, &r0, &r1) < 0) 66 return -1; 67 ((char *) buf)[i++] = r0; 67 do { 68 rc = kbd_get_event(&ev); 69 if (rc < 0) return -1; 70 } while (ev.c == 0); 71 72 ((char *) buf)[i++] = ev.c; 68 73 } 69 74 return i; -
uspace/lib/libc/include/ipc/console.h
r76dd25b rfa09449 39 39 40 40 typedef enum { 41 CONSOLE_GET CHAR= IPC_FIRST_USER_METHOD,41 CONSOLE_GETKEY = IPC_FIRST_USER_METHOD, 42 42 CONSOLE_PUTCHAR, 43 43 CONSOLE_CLEAR, -
uspace/srv/console/console.c
r76dd25b rfa09449 298 298 ipc_call_t call; 299 299 int retval; 300 int c;300 kbd_event_t ev; 301 301 connection_t *conn; 302 302 int newcon; … … 320 320 retval = 0; 321 321 break; 322 case KBD_ PUSHCHAR:323 /* got key from keyboard driver*/322 case KBD_EVENT: 323 /* Got event from keyboard driver. */ 324 324 retval = 0; 325 c = IPC_GET_ARG1(call); 325 ev.type = IPC_GET_ARG1(call); 326 ev.key = IPC_GET_ARG2(call); 327 ev.mods = IPC_GET_ARG3(call); 328 ev.c = IPC_GET_ARG4(call); 329 326 330 /* switch to another virtual console */ 327 331 328 332 conn = &connections[active_console]; 329 /* 330 * if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + 331 * CONSOLE_COUNT)) { 332 */ 333 if ((c >= 0x101) && (c < 0x101 + CONSOLE_COUNT)) { 334 if (c == 0x112) 333 334 if ((ev.key >= 0x101) && (ev.key < 0x101 + 335 CONSOLE_COUNT)) { 336 if (ev.key == 0x112) 335 337 change_console(KERNEL_CONSOLE); 336 338 else 337 change_console( c- 0x101);339 change_console(ev.key - 0x101); 338 340 break; 339 341 } … … 342 344 if (conn->keyrequest_counter > 0) { 343 345 conn->keyrequest_counter--; 344 ipc_answer_ 1(fifo_pop(conn->keyrequests), EOK,345 c);346 ipc_answer_4(fifo_pop(conn->keyrequests), EOK, 347 ev.type, ev.key, ev.mods, ev.c); 346 348 break; 347 349 } 348 349 keybuffer_push(&conn->keybuffer, c);350 351 keybuffer_push(&conn->keybuffer, &ev); 350 352 retval = 0; 351 353 352 354 break; 353 355 default: … … 364 366 ipc_call_t call; 365 367 int consnum; 366 ipcarg_t arg1, arg2, arg3 ;368 ipcarg_t arg1, arg2, arg3, arg4; 367 369 connection_t *conn; 368 370 … … 389 391 arg1 = 0; 390 392 arg2 = 0; 393 arg3 = 0; 394 arg4 = 0; 395 391 396 switch (IPC_GET_METHOD(call)) { 392 397 case IPC_M_PHONE_HUNGUP: … … 459 464 curs_visibility(arg1); 460 465 break; 461 case CONSOLE_GET CHAR:466 case CONSOLE_GETKEY: 462 467 if (keybuffer_empty(&conn->keybuffer)) { 463 468 /* buffer is empty -> store request */ … … 475 480 continue; 476 481 } 477 int ch; 478 keybuffer_pop(&conn->keybuffer, &ch); 479 arg1 = ch; 482 kbd_event_t ev; 483 keybuffer_pop(&conn->keybuffer, &ev); 484 arg1 = ev.type; 485 arg2 = ev.key; 486 arg3 = ev.mods; 487 arg4 = ev.c; 480 488 break; 481 489 } 482 ipc_answer_ 2(callid, EOK, arg1, arg2);490 ipc_answer_4(callid, EOK, arg1, arg2, arg3, arg4); 483 491 } 484 492 } -
uspace/srv/kbd/arch/arm32/src/kbd_gxemul.c
r76dd25b rfa09449 123 123 /* 124 124 // Preserve for detecting scan codes. 125 keybuffer_push (keybuffer, to_hex((scan_code>>4)&0xf));126 keybuffer_push (keybuffer, to_hex(scan_code&0xf));127 keybuffer_push (keybuffer, 'X');128 keybuffer_push (keybuffer, 'Y');125 keybuffer_push0(keybuffer, to_hex((scan_code>>4)&0xf)); 126 keybuffer_push0(keybuffer, to_hex(scan_code&0xf)); 127 keybuffer_push0(keybuffer, 'X'); 128 keybuffer_push0(keybuffer, 'Y'); 129 129 return 1; 130 130 */ … … 137 137 switch (buf) { 138 138 case GXEMUL_KEY_F5: 139 keybuffer_push (keybuffer,FUNCTION_KEYS | 5);139 keybuffer_push0(keybuffer,FUNCTION_KEYS | 5); 140 140 buf = count = 0; 141 141 return 1; 142 142 case GXEMUL_KEY_F6: 143 keybuffer_push (keybuffer,FUNCTION_KEYS | 6);143 keybuffer_push0(keybuffer,FUNCTION_KEYS | 6); 144 144 buf = count = 0; 145 145 return 1; 146 146 case GXEMUL_KEY_F7: 147 keybuffer_push (keybuffer,FUNCTION_KEYS | 7);147 keybuffer_push0(keybuffer,FUNCTION_KEYS | 7); 148 148 buf = count = 0; 149 149 return 1; 150 150 case GXEMUL_KEY_F8: 151 keybuffer_push (keybuffer,FUNCTION_KEYS | 8);151 keybuffer_push0(keybuffer,FUNCTION_KEYS | 8); 152 152 buf = count = 0; 153 153 return 1; 154 154 case GXEMUL_KEY_F9: 155 keybuffer_push (keybuffer,FUNCTION_KEYS | 9);155 keybuffer_push0(keybuffer,FUNCTION_KEYS | 9); 156 156 buf = count = 0; 157 157 return 1; 158 158 case GXEMUL_KEY_F10: 159 keybuffer_push (keybuffer,FUNCTION_KEYS | 10);159 keybuffer_push0(keybuffer,FUNCTION_KEYS | 10); 160 160 buf = count = 0; 161 161 return 1; 162 162 case GXEMUL_KEY_F11: 163 keybuffer_push (keybuffer,FUNCTION_KEYS | 11);163 keybuffer_push0(keybuffer,FUNCTION_KEYS | 11); 164 164 buf = count = 0; 165 165 return 1; 166 166 case GXEMUL_KEY_F12: 167 keybuffer_push (keybuffer,FUNCTION_KEYS | 12);167 keybuffer_push0(keybuffer,FUNCTION_KEYS | 12); 168 168 buf = count = 0; 169 169 return 1; 170 170 default: 171 keybuffer_push (keybuffer, buf & 0xff);172 keybuffer_push (keybuffer, (buf >> 8) & 0xff);173 keybuffer_push (keybuffer, (buf >> 16) & 0xff);174 keybuffer_push (keybuffer, (buf >> 24) & 0xff);175 keybuffer_push (keybuffer, scan_code);171 keybuffer_push0(keybuffer, buf & 0xff); 172 keybuffer_push0(keybuffer, (buf >> 8) & 0xff); 173 keybuffer_push0(keybuffer, (buf >> 16) & 0xff); 174 keybuffer_push0(keybuffer, (buf >> 24) & 0xff); 175 keybuffer_push0(keybuffer, scan_code); 176 176 buf = count = 0; 177 177 return 1; … … 183 183 184 184 if ((buf & 0xff) != (GXEMUL_KEY_F1 & 0xff)) { 185 keybuffer_push (keybuffer, buf);185 keybuffer_push0(keybuffer, buf); 186 186 buf = count = 0; 187 187 return 1; … … 195 195 && (buf & 0xffff) != (GXEMUL_KEY_F5 & 0xffff) ) { 196 196 197 keybuffer_push (keybuffer, buf & 0xff);198 keybuffer_push (keybuffer, (buf >> 8) &0xff);197 keybuffer_push0(keybuffer, buf & 0xff); 198 keybuffer_push0(keybuffer, (buf >> 8) &0xff); 199 199 buf = count = 0; 200 200 return 1; … … 207 207 switch (buf) { 208 208 case GXEMUL_KEY_F1: 209 keybuffer_push (keybuffer,FUNCTION_KEYS | 1);209 keybuffer_push0(keybuffer,FUNCTION_KEYS | 1); 210 210 buf = count = 0; 211 211 return 1; 212 212 case GXEMUL_KEY_F2: 213 keybuffer_push (keybuffer,FUNCTION_KEYS | 2);213 keybuffer_push0(keybuffer,FUNCTION_KEYS | 2); 214 214 buf = count = 0; 215 215 return 1; 216 216 case GXEMUL_KEY_F3: 217 keybuffer_push (keybuffer,FUNCTION_KEYS | 3);217 keybuffer_push0(keybuffer,FUNCTION_KEYS | 3); 218 218 buf = count = 0; 219 219 return 1; 220 220 case GXEMUL_KEY_F4: 221 keybuffer_push (keybuffer,FUNCTION_KEYS | 4);221 keybuffer_push0(keybuffer,FUNCTION_KEYS | 4); 222 222 buf = count = 0; 223 223 return 1; … … 228 228 && (buf & 0xffffff) != (GXEMUL_KEY_F9 & 0xffffff)) { 229 229 230 keybuffer_push (keybuffer, buf & 0xff);231 keybuffer_push (keybuffer, (buf >> 8) & 0xff);232 keybuffer_push (keybuffer, (buf >> 16) & 0xff);230 keybuffer_push0(keybuffer, buf & 0xff); 231 keybuffer_push0(keybuffer, (buf >> 8) & 0xff); 232 keybuffer_push0(keybuffer, (buf >> 16) & 0xff); 233 233 buf = count = 0; 234 234 return 1; … … 250 250 return 1; 251 251 default: 252 keybuffer_push (keybuffer, buf & 0xff);253 keybuffer_push (keybuffer, (buf >> 8) & 0xff);254 keybuffer_push (keybuffer, (buf >> 16) & 0xff);255 keybuffer_push (keybuffer, (buf >> 24) & 0xff);252 keybuffer_push0(keybuffer, buf & 0xff); 253 keybuffer_push0(keybuffer, (buf >> 8) & 0xff); 254 keybuffer_push0(keybuffer, (buf >> 16) & 0xff); 255 keybuffer_push0(keybuffer, (buf >> 24) & 0xff); 256 256 buf = count = 0; 257 257 return 1; … … 279 279 /* 280 280 // Please preserve this code (it can be used to determine scancodes) 281 keybuffer_push (keybuffer, to_hex((scan_code>>4)&0xf));282 keybuffer_push (keybuffer, to_hex(scan_code&0xf));283 keybuffer_push (keybuffer, ' ');284 keybuffer_push (keybuffer, ' ');281 keybuffer_push0(keybuffer, to_hex((scan_code>>4)&0xf)); 282 keybuffer_push0(keybuffer, to_hex(scan_code&0xf)); 283 keybuffer_push0(keybuffer, ' '); 284 keybuffer_push0(keybuffer, ' '); 285 285 return 1; 286 286 */ … … 295 295 296 296 if ((buf & 0xff) != (GXEMUL_FB_KEY_F1 & 0xff)) { 297 keybuffer_push (keybuffer, buf);297 keybuffer_push0(keybuffer, buf); 298 298 buf = count = 0; 299 299 return 1; … … 305 305 306 306 if ((buf & 0xffff) != (GXEMUL_FB_KEY_F1 & 0xffff)) { 307 keybuffer_push (keybuffer, buf & 0xff);308 keybuffer_push (keybuffer, (buf >> 8) &0xff);307 keybuffer_push0(keybuffer, buf & 0xff); 308 keybuffer_push0(keybuffer, (buf >> 8) &0xff); 309 309 buf = count = 0; 310 310 return 1; … … 319 319 && (buf & 0xffffff) != (GXEMUL_FB_KEY_F9 & 0xffffff)) { 320 320 321 keybuffer_push (keybuffer, buf & 0xff);322 keybuffer_push (keybuffer, (buf >> 8) & 0xff);323 keybuffer_push (keybuffer, (buf >> 16) & 0xff);321 keybuffer_push0(keybuffer, buf & 0xff); 322 keybuffer_push0(keybuffer, (buf >> 8) & 0xff); 323 keybuffer_push0(keybuffer, (buf >> 16) & 0xff); 324 324 buf = count = 0; 325 325 return 1; … … 332 332 switch (buf) { 333 333 case GXEMUL_FB_KEY_F1: 334 keybuffer_push (keybuffer,FUNCTION_KEYS | 1 );334 keybuffer_push0(keybuffer,FUNCTION_KEYS | 1 ); 335 335 buf = count = 0; 336 336 return 1; 337 337 case GXEMUL_FB_KEY_F2: 338 keybuffer_push (keybuffer,FUNCTION_KEYS | 2 );338 keybuffer_push0(keybuffer,FUNCTION_KEYS | 2 ); 339 339 buf = count = 0; 340 340 return 1; 341 341 case GXEMUL_FB_KEY_F3: 342 keybuffer_push (keybuffer,FUNCTION_KEYS | 3 );342 keybuffer_push0(keybuffer,FUNCTION_KEYS | 3 ); 343 343 buf = count = 0; 344 344 return 1; 345 345 case GXEMUL_FB_KEY_F4: 346 keybuffer_push (keybuffer,FUNCTION_KEYS | 4 );346 keybuffer_push0(keybuffer,FUNCTION_KEYS | 4 ); 347 347 buf = count = 0; 348 348 return 1; 349 349 case GXEMUL_FB_KEY_F5: 350 keybuffer_push (keybuffer,FUNCTION_KEYS | 5 );350 keybuffer_push0(keybuffer,FUNCTION_KEYS | 5 ); 351 351 buf = count = 0; 352 352 return 1; 353 353 case GXEMUL_FB_KEY_F6: 354 keybuffer_push (keybuffer,FUNCTION_KEYS | 6 );354 keybuffer_push0(keybuffer,FUNCTION_KEYS | 6 ); 355 355 buf = count = 0; 356 356 return 1; 357 357 case GXEMUL_FB_KEY_F7: 358 keybuffer_push (keybuffer,FUNCTION_KEYS | 7 );358 keybuffer_push0(keybuffer,FUNCTION_KEYS | 7 ); 359 359 buf = count = 0; 360 360 return 1; 361 361 case GXEMUL_FB_KEY_F8: 362 keybuffer_push (keybuffer,FUNCTION_KEYS | 8 );362 keybuffer_push0(keybuffer,FUNCTION_KEYS | 8 ); 363 363 buf = count = 0; 364 364 return 1; 365 365 case GXEMUL_FB_KEY_F9: 366 keybuffer_push (keybuffer,FUNCTION_KEYS | 9 );366 keybuffer_push0(keybuffer,FUNCTION_KEYS | 9 ); 367 367 buf = count = 0; 368 368 return 1; 369 369 case GXEMUL_FB_KEY_F10: 370 keybuffer_push (keybuffer,FUNCTION_KEYS | 10 );370 keybuffer_push0(keybuffer,FUNCTION_KEYS | 10 ); 371 371 buf = count = 0; 372 372 return 1; 373 373 case GXEMUL_FB_KEY_F11: 374 keybuffer_push (keybuffer,FUNCTION_KEYS | 11 );374 keybuffer_push0(keybuffer,FUNCTION_KEYS | 11 ); 375 375 buf = count = 0; 376 376 return 1; 377 377 case GXEMUL_FB_KEY_F12: 378 keybuffer_push (keybuffer,FUNCTION_KEYS | 12 );378 keybuffer_push0(keybuffer,FUNCTION_KEYS | 12 ); 379 379 buf = count = 0; 380 380 return 1; 381 381 default: 382 keybuffer_push (keybuffer, buf & 0xff );383 keybuffer_push (keybuffer, (buf >> 8) & 0xff);384 keybuffer_push (keybuffer, (buf >> 16) & 0xff);385 keybuffer_push (keybuffer, (buf >> 24) & 0xff);382 keybuffer_push0(keybuffer, buf & 0xff ); 383 keybuffer_push0(keybuffer, (buf >> 8) & 0xff); 384 keybuffer_push0(keybuffer, (buf >> 16) & 0xff); 385 keybuffer_push0(keybuffer, (buf >> 24) & 0xff); 386 386 buf = count = 0; 387 387 return 1; -
uspace/srv/kbd/arch/ia64/src/kbd.c
r76dd25b rfa09449 179 179 switch (buf) { 180 180 case NSKEY_F6: 181 keybuffer_push (keybuffer,FUNCTION_KEYS | 6);181 keybuffer_push0(keybuffer,FUNCTION_KEYS | 6); 182 182 buf = count = 0; 183 183 return 1; 184 184 case NSKEY_F7: 185 keybuffer_push (keybuffer,FUNCTION_KEYS | 7);185 keybuffer_push0(keybuffer,FUNCTION_KEYS | 7); 186 186 buf = count = 0; 187 187 return 1; 188 188 case NSKEY_F8: 189 keybuffer_push (keybuffer,FUNCTION_KEYS | 8);189 keybuffer_push0(keybuffer,FUNCTION_KEYS | 8); 190 190 buf = count = 0; 191 191 return 1; 192 192 case NSKEY_F9: 193 keybuffer_push (keybuffer,FUNCTION_KEYS | 9);193 keybuffer_push0(keybuffer,FUNCTION_KEYS | 9); 194 194 buf = count = 0; 195 195 return 1; 196 196 case NSKEY_F10: 197 keybuffer_push (keybuffer,FUNCTION_KEYS | 10);197 keybuffer_push0(keybuffer,FUNCTION_KEYS | 10); 198 198 buf = count = 0; 199 199 return 1; 200 200 case NSKEY_F11: 201 keybuffer_push (keybuffer,FUNCTION_KEYS | 11);201 keybuffer_push0(keybuffer,FUNCTION_KEYS | 11); 202 202 buf = count = 0; 203 203 return 1; 204 204 case NSKEY_F12: 205 keybuffer_push (keybuffer,FUNCTION_KEYS | 12);205 keybuffer_push0(keybuffer,FUNCTION_KEYS | 12); 206 206 buf = count = 0; 207 207 return 1; 208 208 default: 209 keybuffer_push (keybuffer, buf & 0xff);210 keybuffer_push (keybuffer, (buf >> 8) &0xff);211 keybuffer_push (keybuffer, (buf >> 16) &0xff);212 keybuffer_push (keybuffer, (buf >> 24) &0xff);213 keybuffer_push (keybuffer, scan_code);209 keybuffer_push0(keybuffer, buf & 0xff); 210 keybuffer_push0(keybuffer, (buf >> 8) &0xff); 211 keybuffer_push0(keybuffer, (buf >> 16) &0xff); 212 keybuffer_push0(keybuffer, (buf >> 24) &0xff); 213 keybuffer_push0(keybuffer, scan_code); 214 214 buf = count = 0; 215 215 return 1; … … 220 220 221 221 if((buf & 0xff) != (NSKEY_F1 & 0xff)) { 222 keybuffer_push (keybuffer, buf);222 keybuffer_push0(keybuffer, buf); 223 223 buf = count = 0; 224 224 return 1; … … 230 230 if ((buf & 0xffff) != (NSKEY_F1 & 0xffff)) { 231 231 232 keybuffer_push (keybuffer, buf & 0xff);233 keybuffer_push (keybuffer, (buf >> 8) &0xff);232 keybuffer_push0(keybuffer, buf & 0xff); 233 keybuffer_push0(keybuffer, (buf >> 8) &0xff); 234 234 buf = count = 0; 235 235 return 1; … … 244 244 && (buf & 0xffffff) != (NSKEY_F9 & 0xffffff) ) { 245 245 246 keybuffer_push (keybuffer, buf & 0xff);247 keybuffer_push (keybuffer, (buf >> 8) &0xff);248 keybuffer_push (keybuffer, (buf >> 16) &0xff);246 keybuffer_push0(keybuffer, buf & 0xff); 247 keybuffer_push0(keybuffer, (buf >> 8) &0xff); 248 keybuffer_push0(keybuffer, (buf >> 16) &0xff); 249 249 buf = count = 0; 250 250 return 1; … … 256 256 switch (buf) { 257 257 case NSKEY_F1: 258 keybuffer_push (keybuffer,FUNCTION_KEYS | 1);258 keybuffer_push0(keybuffer,FUNCTION_KEYS | 1); 259 259 buf = count = 0; 260 260 return 1; 261 261 case NSKEY_F2: 262 keybuffer_push (keybuffer,FUNCTION_KEYS | 2);262 keybuffer_push0(keybuffer,FUNCTION_KEYS | 2); 263 263 buf = count = 0; 264 264 return 1; 265 265 case NSKEY_F3: 266 keybuffer_push (keybuffer,FUNCTION_KEYS | 3);266 keybuffer_push0(keybuffer,FUNCTION_KEYS | 3); 267 267 buf = count = 0; 268 268 return 1; 269 269 case NSKEY_F4: 270 keybuffer_push (keybuffer,FUNCTION_KEYS | 4);270 keybuffer_push0(keybuffer,FUNCTION_KEYS | 4); 271 271 buf = count = 0; 272 272 return 1; 273 273 case NSKEY_F5: 274 keybuffer_push (keybuffer,FUNCTION_KEYS | 5);274 keybuffer_push0(keybuffer,FUNCTION_KEYS | 5); 275 275 buf = count = 0; 276 276 return 1; … … 289 289 return 1; 290 290 default: 291 keybuffer_push (keybuffer, buf & 0xff);292 keybuffer_push (keybuffer, (buf >> 8) &0xff);293 keybuffer_push (keybuffer, (buf >> 16) &0xff);294 keybuffer_push (keybuffer, (buf >> 24) &0xff);291 keybuffer_push0(keybuffer, buf & 0xff); 292 keybuffer_push0(keybuffer, (buf >> 8) &0xff); 293 keybuffer_push0(keybuffer, (buf >> 16) &0xff); 294 keybuffer_push0(keybuffer, (buf >> 24) &0xff); 295 295 buf = count = 0; 296 296 return 1; … … 309 309 * Please preserve this code (it can be used to determine scancodes) 310 310 */ 311 //keybuffer_push (keybuffer, to_hex((scan_code>>4)&0xf));312 //keybuffer_push (keybuffer, to_hex(scan_code&0xf));313 //keybuffer_push (keybuffer, ' ');314 //keybuffer_push (keybuffer, ' ');311 //keybuffer_push0(keybuffer, to_hex((scan_code>>4)&0xf)); 312 //keybuffer_push0(keybuffer, to_hex(scan_code&0xf)); 313 //keybuffer_push0(keybuffer, ' '); 314 //keybuffer_push0(keybuffer, ' '); 315 315 //*/ 316 316 … … 329 329 330 330 if (!(buf & 0xff00)) { 331 keybuffer_push (keybuffer, buf);331 keybuffer_push0(keybuffer, buf); 332 332 } else { 333 333 switch (buf) { 334 334 case KEY_F1: 335 keybuffer_push (keybuffer, FUNCTION_KEYS | 1);335 keybuffer_push0(keybuffer, FUNCTION_KEYS | 1); 336 336 break; 337 337 case KEY_F2: 338 keybuffer_push (keybuffer, FUNCTION_KEYS | 2);338 keybuffer_push0(keybuffer, FUNCTION_KEYS | 2); 339 339 break; 340 340 case KEY_F3: 341 keybuffer_push (keybuffer, FUNCTION_KEYS | 3);341 keybuffer_push0(keybuffer, FUNCTION_KEYS | 3); 342 342 break; 343 343 case KEY_F4: 344 keybuffer_push (keybuffer, FUNCTION_KEYS | 4);344 keybuffer_push0(keybuffer, FUNCTION_KEYS | 4); 345 345 break; 346 346 case KEY_F5: 347 keybuffer_push (keybuffer, FUNCTION_KEYS | 5);347 keybuffer_push0(keybuffer, FUNCTION_KEYS | 5); 348 348 break; 349 349 case KEY_F6: 350 keybuffer_push (keybuffer, FUNCTION_KEYS | 6);350 keybuffer_push0(keybuffer, FUNCTION_KEYS | 6); 351 351 break; 352 352 case KEY_F7: 353 keybuffer_push (keybuffer, FUNCTION_KEYS | 7);353 keybuffer_push0(keybuffer, FUNCTION_KEYS | 7); 354 354 break; 355 355 case KEY_F8: 356 keybuffer_push (keybuffer, FUNCTION_KEYS | 8);356 keybuffer_push0(keybuffer, FUNCTION_KEYS | 8); 357 357 break; 358 358 case KEY_F9: 359 keybuffer_push (keybuffer, FUNCTION_KEYS | 9);359 keybuffer_push0(keybuffer, FUNCTION_KEYS | 9); 360 360 break; 361 361 case KEY_F10: 362 keybuffer_push (keybuffer, FUNCTION_KEYS | 10);362 keybuffer_push0(keybuffer, FUNCTION_KEYS | 10); 363 363 break; 364 364 case KEY_F11: 365 keybuffer_push (keybuffer, FUNCTION_KEYS | 11);365 keybuffer_push0(keybuffer, FUNCTION_KEYS | 11); 366 366 break; 367 367 case KEY_F12: 368 keybuffer_push (keybuffer, FUNCTION_KEYS | 12);368 keybuffer_push0(keybuffer, FUNCTION_KEYS | 12); 369 369 break; 370 370 } -
uspace/srv/kbd/arch/mips32/src/kbd.c
r76dd25b rfa09449 108 108 /* Please preserve this code (it can be used to determine scancodes) 109 109 110 keybuffer_push (keybuffer, to_hex((scan_code>>4)&0xf));111 keybuffer_push (keybuffer, to_hex(scan_code&0xf));112 keybuffer_push (keybuffer, ' ');113 keybuffer_push (keybuffer, ' ');110 keybuffer_push0(keybuffer, to_hex((scan_code>>4)&0xf)); 111 keybuffer_push0(keybuffer, to_hex(scan_code&0xf)); 112 keybuffer_push0(keybuffer, ' '); 113 keybuffer_push0(keybuffer, ' '); 114 114 115 115 return 1; … … 123 123 124 124 if ((buf & 0xff) != (GXEMUL_KEY_F1 & 0xff)) { 125 keybuffer_push (keybuffer, buf);125 keybuffer_push0(keybuffer, buf); 126 126 buf = count = 0; 127 127 return 1; … … 132 132 133 133 if ((buf & 0xffff) != (GXEMUL_KEY_F1 & 0xffff)) { 134 keybuffer_push (keybuffer, buf & 0xff);135 keybuffer_push (keybuffer, (buf >> 8) &0xff);134 keybuffer_push0(keybuffer, buf & 0xff); 135 keybuffer_push0(keybuffer, (buf >> 8) &0xff); 136 136 buf = count = 0; 137 137 return 1; … … 146 146 && (buf & 0xffffff) != (GXEMUL_KEY_F9 & 0xffffff)) { 147 147 148 keybuffer_push (keybuffer, buf & 0xff);149 keybuffer_push (keybuffer, (buf >> 8) & 0xff);150 keybuffer_push (keybuffer, (buf >> 16) & 0xff);148 keybuffer_push0(keybuffer, buf & 0xff); 149 keybuffer_push0(keybuffer, (buf >> 8) & 0xff); 150 keybuffer_push0(keybuffer, (buf >> 16) & 0xff); 151 151 buf = count = 0; 152 152 return 1; … … 159 159 switch (buf) { 160 160 case GXEMUL_KEY_F1: 161 keybuffer_push (keybuffer,FUNCTION_KEYS | 1 );161 keybuffer_push0(keybuffer,FUNCTION_KEYS | 1 ); 162 162 buf=count=0; 163 163 return 1; 164 164 case GXEMUL_KEY_F2: 165 keybuffer_push (keybuffer,FUNCTION_KEYS | 2 );165 keybuffer_push0(keybuffer,FUNCTION_KEYS | 2 ); 166 166 buf=count=0; 167 167 return 1; 168 168 case GXEMUL_KEY_F3: 169 keybuffer_push (keybuffer,FUNCTION_KEYS | 3 );169 keybuffer_push0(keybuffer,FUNCTION_KEYS | 3 ); 170 170 buf=count=0; 171 171 return 1; 172 172 case GXEMUL_KEY_F4: 173 keybuffer_push (keybuffer,FUNCTION_KEYS | 4 );173 keybuffer_push0(keybuffer,FUNCTION_KEYS | 4 ); 174 174 buf=count=0; 175 175 return 1; 176 176 case GXEMUL_KEY_F5: 177 keybuffer_push (keybuffer,FUNCTION_KEYS | 5 );177 keybuffer_push0(keybuffer,FUNCTION_KEYS | 5 ); 178 178 buf=count=0; 179 179 return 1; 180 180 case GXEMUL_KEY_F6: 181 keybuffer_push (keybuffer,FUNCTION_KEYS | 6 );181 keybuffer_push0(keybuffer,FUNCTION_KEYS | 6 ); 182 182 buf=count=0; 183 183 return 1; 184 184 case GXEMUL_KEY_F7: 185 keybuffer_push (keybuffer,FUNCTION_KEYS | 7 );185 keybuffer_push0(keybuffer,FUNCTION_KEYS | 7 ); 186 186 buf=count=0; 187 187 return 1; 188 188 case GXEMUL_KEY_F8: 189 keybuffer_push (keybuffer,FUNCTION_KEYS | 8 );189 keybuffer_push0(keybuffer,FUNCTION_KEYS | 8 ); 190 190 buf=count=0; 191 191 return 1; 192 192 case GXEMUL_KEY_F9: 193 keybuffer_push (keybuffer,FUNCTION_KEYS | 9 );193 keybuffer_push0(keybuffer,FUNCTION_KEYS | 9 ); 194 194 buf=count=0; 195 195 return 1; 196 196 case GXEMUL_KEY_F10: 197 keybuffer_push (keybuffer,FUNCTION_KEYS | 10 );197 keybuffer_push0(keybuffer,FUNCTION_KEYS | 10 ); 198 198 buf=count=0; 199 199 return 1; 200 200 case GXEMUL_KEY_F11: 201 keybuffer_push (keybuffer,FUNCTION_KEYS | 11 );201 keybuffer_push0(keybuffer,FUNCTION_KEYS | 11 ); 202 202 buf=count=0; 203 203 return 1; 204 204 case GXEMUL_KEY_F12: 205 keybuffer_push (keybuffer,FUNCTION_KEYS | 12 );205 keybuffer_push0(keybuffer,FUNCTION_KEYS | 12 ); 206 206 buf=count=0; 207 207 return 1; 208 208 default: 209 keybuffer_push (keybuffer, buf & 0xff );210 keybuffer_push (keybuffer, (buf >> 8) &0xff );211 keybuffer_push (keybuffer, (buf >> 16) &0xff );212 keybuffer_push (keybuffer, (buf >> 24) &0xff );209 keybuffer_push0(keybuffer, buf & 0xff ); 210 keybuffer_push0(keybuffer, (buf >> 8) &0xff ); 211 keybuffer_push0(keybuffer, (buf >> 16) &0xff ); 212 keybuffer_push0(keybuffer, (buf >> 24) &0xff ); 213 213 buf=count=0; 214 214 return 1; -
uspace/srv/kbd/arch/ppc32/src/kbd.c
r76dd25b rfa09449 193 193 194 194 if (key != SPECIAL) 195 keybuffer_push (keybuffer, key);195 keybuffer_push0(keybuffer, key); 196 196 } 197 197 } -
uspace/srv/kbd/genarch/src/kbd.c
r76dd25b rfa09449 74 74 int shift, capslock; 75 75 int letter = 0; 76 kbd_event_t ev; 76 77 77 78 static int esc_count = 0; … … 103 104 if (shift) 104 105 map = sc_secondary_map; 105 if (map[key] != SPECIAL) 106 keybuffer_push(keybuffer, map[key]); 106 if (map[key] != SPECIAL) { 107 ev.key = map[key]; 108 ev.mods = 0; 109 ev.c = map[key]; 110 keybuffer_push(keybuffer, &ev); 111 } 107 112 break; 108 113 } -
uspace/srv/kbd/genarch/src/nofb.c
r76dd25b rfa09449 67 67 switch (buf) { 68 68 case KEY_F5: 69 keybuffer_push (keybuffer,FUNCTION_KEYS | 5);69 keybuffer_push0(keybuffer,FUNCTION_KEYS | 5); 70 70 buf = count = 0; 71 71 return 1; 72 72 case KEY_F6: 73 keybuffer_push (keybuffer,FUNCTION_KEYS | 6);73 keybuffer_push0(keybuffer,FUNCTION_KEYS | 6); 74 74 buf = count = 0; 75 75 return 1; 76 76 case KEY_F7: 77 keybuffer_push (keybuffer,FUNCTION_KEYS | 7);77 keybuffer_push0(keybuffer,FUNCTION_KEYS | 7); 78 78 buf = count = 0; 79 79 return 1; 80 80 case KEY_F8: 81 keybuffer_push (keybuffer,FUNCTION_KEYS | 8);81 keybuffer_push0(keybuffer,FUNCTION_KEYS | 8); 82 82 buf = count = 0; 83 83 return 1; 84 84 case KEY_F9: 85 keybuffer_push (keybuffer,FUNCTION_KEYS | 9);85 keybuffer_push0(keybuffer,FUNCTION_KEYS | 9); 86 86 buf = count = 0; 87 87 return 1; 88 88 case KEY_F10: 89 keybuffer_push (keybuffer,FUNCTION_KEYS | 10);89 keybuffer_push0(keybuffer,FUNCTION_KEYS | 10); 90 90 buf = count = 0; 91 91 return 1; 92 92 case KEY_F11: 93 keybuffer_push (keybuffer,FUNCTION_KEYS | 11);93 keybuffer_push0(keybuffer,FUNCTION_KEYS | 11); 94 94 buf = count = 0; 95 95 return 1; 96 96 case KEY_F12: 97 keybuffer_push (keybuffer,FUNCTION_KEYS | 12);97 keybuffer_push0(keybuffer,FUNCTION_KEYS | 12); 98 98 buf = count = 0; 99 99 return 1; 100 100 default: 101 keybuffer_push (keybuffer, buf & 0xff);102 keybuffer_push (keybuffer, (buf >> 8) &0xff);103 keybuffer_push (keybuffer, (buf >> 16) &0xff);104 keybuffer_push (keybuffer, (buf >> 24) &0xff);105 keybuffer_push (keybuffer, scan_code);101 keybuffer_push0(keybuffer, buf & 0xff); 102 keybuffer_push0(keybuffer, (buf >> 8) &0xff); 103 keybuffer_push0(keybuffer, (buf >> 16) &0xff); 104 keybuffer_push0(keybuffer, (buf >> 24) &0xff); 105 keybuffer_push0(keybuffer, scan_code); 106 106 buf = count = 0; 107 107 return 1; … … 112 112 113 113 if((buf & 0xff) != (KEY_F1 & 0xff)) { 114 keybuffer_push (keybuffer, buf);114 keybuffer_push0(keybuffer, buf); 115 115 buf = count = 0; 116 116 return 1; … … 123 123 && (buf & 0xffff) != (KEY_F5 & 0xffff) ) { 124 124 125 keybuffer_push (keybuffer, buf & 0xff);126 keybuffer_push (keybuffer, (buf >> 8) &0xff);125 keybuffer_push0(keybuffer, buf & 0xff); 126 keybuffer_push0(keybuffer, (buf >> 8) &0xff); 127 127 buf = count = 0; 128 128 return 1; … … 134 134 switch (buf) { 135 135 case KEY_F1: 136 keybuffer_push (keybuffer,FUNCTION_KEYS | 1);136 keybuffer_push0(keybuffer,FUNCTION_KEYS | 1); 137 137 buf = count = 0; 138 138 return 1; 139 139 case KEY_F2: 140 keybuffer_push (keybuffer,FUNCTION_KEYS | 2);140 keybuffer_push0(keybuffer,FUNCTION_KEYS | 2); 141 141 buf = count = 0; 142 142 return 1; 143 143 case KEY_F3: 144 keybuffer_push (keybuffer,FUNCTION_KEYS | 3);144 keybuffer_push0(keybuffer,FUNCTION_KEYS | 3); 145 145 buf = count = 0; 146 146 return 1; 147 147 case KEY_F4: 148 keybuffer_push (keybuffer,FUNCTION_KEYS | 4);148 keybuffer_push0(keybuffer,FUNCTION_KEYS | 4); 149 149 buf = count = 0; 150 150 return 1; … … 155 155 && (buf & 0xffffff) != (KEY_F9 & 0xffffff)) { 156 156 157 keybuffer_push (keybuffer, buf & 0xff);158 keybuffer_push (keybuffer, (buf >> 8) & 0xff);159 keybuffer_push (keybuffer, (buf >> 16) & 0xff);157 keybuffer_push0(keybuffer, buf & 0xff); 158 keybuffer_push0(keybuffer, (buf >> 8) & 0xff); 159 keybuffer_push0(keybuffer, (buf >> 16) & 0xff); 160 160 buf=count=0; 161 161 return 1; … … 176 176 return 1; 177 177 default: 178 keybuffer_push (keybuffer, buf & 0xff);179 keybuffer_push (keybuffer, (buf >> 8) &0xff);180 keybuffer_push (keybuffer, (buf >> 16) &0xff);181 keybuffer_push (keybuffer, (buf >> 24) &0xff);178 keybuffer_push0(keybuffer, buf & 0xff); 179 keybuffer_push0(keybuffer, (buf >> 8) &0xff); 180 keybuffer_push0(keybuffer, (buf >> 16) &0xff); 181 keybuffer_push0(keybuffer, (buf >> 24) &0xff); 182 182 buf = count = 0; 183 183 return 1; -
uspace/srv/kbd/generic/kbd.c
r76dd25b rfa09449 43 43 #include <stdio.h> 44 44 #include <ipc/ns.h> 45 #include <async.h> 45 46 #include <errno.h> 47 #include <libadt/fifo.h> 48 #include <kbd/kbd.h> 49 46 50 #include <arch/kbd.h> 47 51 #include <kbd.h> 48 #include <libadt/fifo.h>49 52 #include <key_buffer.h> 50 #include <async.h>51 53 #include <keys.h> 52 54 … … 59 61 static void irq_handler(ipc_callid_t iid, ipc_call_t *call) 60 62 { 61 int chr;63 kbd_event_t ev; 62 64 63 65 #ifdef MOUSE_ENABLED … … 70 72 if (cons_connected && phone2cons != -1) { 71 73 /* 72 * recode to ASCII - one interrupt can produce more than one73 * code so result is stored in fifo74 * One interrupt can produce more than one event so the result 75 * is stored in a FIFO. 74 76 */ 75 77 while (!keybuffer_empty(&keybuffer)) { 76 if (!keybuffer_pop(&keybuffer, (int *)&chr))78 if (!keybuffer_pop(&keybuffer, &ev)) 77 79 break; 78 80 79 async_msg_1(phone2cons, KBD_PUSHCHAR, chr); 81 async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key, 82 ev.mods, ev.c); 80 83 } 81 84 } -
uspace/srv/kbd/generic/key_buffer.c
r76dd25b rfa09449 41 41 /** Clear key buffer. 42 42 */ 43 void keybuffer_free(keybuffer_t *keybuffer) 43 void keybuffer_free(keybuffer_t *keybuffer) 44 44 { 45 45 futex_down(&keybuffer_futex); … … 76 76 } 77 77 78 /** Push key to key buffer. 79 * If buffer is full, character is ignored. 80 * @param key code of stored key 78 /** Push key event to key buffer. 79 * 80 * If the buffer is full, the event is ignored. 81 * 82 * @param keybuffer The keybuffer. 83 * @param ev The event to push. 81 84 */ 82 void keybuffer_push(keybuffer_t *keybuffer, int key)85 void keybuffer_push(keybuffer_t *keybuffer, const kbd_event_t *ev) 83 86 { 84 87 futex_down(&keybuffer_futex); 85 88 if (keybuffer->items < KEYBUFFER_SIZE) { 86 keybuffer->fifo[keybuffer->tail] = key;89 keybuffer->fifo[keybuffer->tail] = *ev; 87 90 keybuffer->tail = (keybuffer->tail + 1) % KEYBUFFER_SIZE; 88 91 keybuffer->items++; … … 91 94 } 92 95 93 /** Pop character from buffer. 94 * @param c pointer to space where to store character from buffer. 95 * @return zero on empty buffer, nonzero else 96 void keybuffer_push0(keybuffer_t *keybuffer, int c) 97 { 98 kbd_event_t ev; 99 100 ev.key = c; ev.mods = 0; ev.c = c; 101 keybuffer_push(keybuffer, &ev); 102 } 103 104 /** Pop event from buffer. 105 * 106 * @param edst Pointer to where the event should be saved. 107 * @return Zero on empty buffer, nonzero otherwise. 96 108 */ 97 int keybuffer_pop(keybuffer_t *keybuffer, int *c)109 int keybuffer_pop(keybuffer_t *keybuffer, kbd_event_t *edst) 98 110 { 99 111 futex_down(&keybuffer_futex); 100 112 if (keybuffer->items > 0) { 101 113 keybuffer->items--; 102 * c= (keybuffer->fifo[keybuffer->head]) ;114 *edst = (keybuffer->fifo[keybuffer->head]) ; 103 115 keybuffer->head = (keybuffer->head + 1) % KEYBUFFER_SIZE; 104 116 futex_up(&keybuffer_futex); -
uspace/srv/kbd/include/key_buffer.h
r76dd25b rfa09449 39 39 40 40 #include <sys/types.h> 41 #include <kbd/kbd.h> 41 42 42 43 /** Size of buffer for pressed keys */ … … 44 45 45 46 typedef struct { 46 int fifo[KEYBUFFER_SIZE];47 kbd_event_t fifo[KEYBUFFER_SIZE]; 47 48 unsigned long head; 48 49 unsigned long tail; … … 50 51 } keybuffer_t; 51 52 52 void keybuffer_free(keybuffer_t *keybuffer); 53 void keybuffer_init(keybuffer_t *keybuffer); 54 int keybuffer_available(keybuffer_t *keybuffer); 55 int keybuffer_empty(keybuffer_t *keybuffer); 56 void keybuffer_push(keybuffer_t *keybuffer, int key); 57 int keybuffer_pop(keybuffer_t *keybuffer, int *c); 53 extern void keybuffer_free(keybuffer_t *); 54 extern void keybuffer_init(keybuffer_t *); 55 extern int keybuffer_available(keybuffer_t *); 56 extern int keybuffer_empty(keybuffer_t *); 57 extern void keybuffer_push(keybuffer_t *, const kbd_event_t *); 58 extern void keybuffer_push0(keybuffer_t *, int c); 59 extern int keybuffer_pop(keybuffer_t *, kbd_event_t *); 58 60 59 61 #endif -
uspace/srv/kbd/include/keys.h
r76dd25b rfa09449 38 38 #define _KBD_KEYS_H_ 39 39 40 #define KBD_ PUSHCHAR102441 #define KBD_MS_LEFT 42 #define KBD_MS_RIGHT 43 #define KBD_MS_MIDDLE 44 #define KBD_MS_MOVE 40 #define KBD_EVENT 1024 41 #define KBD_MS_LEFT 1025 42 #define KBD_MS_RIGHT 1026 43 #define KBD_MS_MIDDLE 1027 44 #define KBD_MS_MOVE 1028 45 45 46 46 #define KBD_KEY_F1 0x3b
Note:
See TracChangeset
for help on using the changeset viewer.