Changeset 79ae36dd in mainline for uspace/srv/hid
- Timestamp:
- 2011-06-08T19:01:55Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0eff68e
- Parents:
- 764d71e
- Location:
- uspace/srv/hid
- Files:
-
- 25 edited
-
adb_mouse/adb_dev.c (modified) (3 diffs)
-
adb_mouse/adb_mouse.c (modified) (5 diffs)
-
char_mouse/char_mouse.c (modified) (5 diffs)
-
char_mouse/chardev.c (modified) (4 diffs)
-
console/console.c (modified) (37 diffs)
-
console/gcons.c (modified) (15 diffs)
-
console/keybuffer.c (modified) (2 diffs)
-
console/keybuffer.h (modified) (2 diffs)
-
fb/ega.c (modified) (3 diffs)
-
fb/fb.c (modified) (3 diffs)
-
fb/main.c (modified) (1 diff)
-
fb/serial_console.c (modified) (3 diffs)
-
kbd/ctl/apple.c (modified) (1 diff)
-
kbd/ctl/pc.c (modified) (1 diff)
-
kbd/ctl/sun.c (modified) (1 diff)
-
kbd/generic/kbd.c (modified) (7 diffs)
-
kbd/include/layout.h (modified) (1 diff)
-
kbd/layout/cz.c (modified) (5 diffs)
-
kbd/layout/us_dvorak.c (modified) (2 diffs)
-
kbd/layout/us_qwerty.c (modified) (2 diffs)
-
kbd/port/adb.c (modified) (5 diffs)
-
kbd/port/chardev.c (modified) (5 diffs)
-
kbd/port/ns16550.c (modified) (2 diffs)
-
kbd/port/z8530.c (modified) (2 diffs)
-
s3c24xx_ts/s3c24xx_ts.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/adb_mouse/adb_dev.c
r764d71e r79ae36dd 39 39 #include <fcntl.h> 40 40 #include <errno.h> 41 #include <devmap.h> 42 #include <devmap_obsolete.h> 43 #include <async.h> 44 #include <async_obsolete.h> 45 #include <kernel/ipc/ipc_methods.h> 41 46 42 47 #include "adb_mouse.h" … … 45 50 static void adb_dev_events(ipc_callid_t iid, ipc_call_t *icall); 46 51 47 static int dev_phone;48 49 52 int adb_dev_init(void) 50 53 { 51 const char *input = "/dev/adb/mouse"; 52 int input_fd; 53 54 printf(NAME ": open %s\n", input); 55 56 input_fd = open(input, O_RDONLY); 57 if (input_fd < 0) { 58 printf(NAME ": Failed opening %s (%d)\n", input, input_fd); 59 return false; 54 devmap_handle_t handle; 55 int rc = devmap_device_get_handle("adb/mouse", &handle, 56 IPC_FLAG_BLOCKING); 57 58 if (rc != EOK) { 59 printf("%s: Failed resolving ADB\n", NAME); 60 return rc; 60 61 } 61 62 dev_phone = fd_phone(input_fd);62 63 int dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING); 63 64 if (dev_phone < 0) { 64 printf( NAME ": Failed to connect to device\n");65 return false;65 printf("%s: Failed connecting to ADB\n", NAME); 66 return ENOENT; 66 67 } 67 68 68 69 /* NB: The callback connection is slotted for removal */ 69 if (async_ connect_to_me(dev_phone, 0, 0, 0, adb_dev_events) != 0) {70 if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, adb_dev_events) != 0) { 70 71 printf(NAME ": Failed to create callback from device\n"); 71 72 return false; … … 84 85 85 86 int retval; 87 88 if (!IPC_GET_IMETHOD(call)) { 89 /* TODO: Handle hangup */ 90 return; 91 } 86 92 87 93 switch (IPC_GET_IMETHOD(call)) { 88 case IPC_M_PHONE_HUNGUP:89 /* TODO: Handle hangup */90 return;91 94 case IPC_FIRST_USER_METHOD: 92 95 mouse_handle_data(IPC_GET_ARG1(call)); -
uspace/srv/hid/adb_mouse/adb_mouse.c
r764d71e r79ae36dd 43 43 #include <stdlib.h> 44 44 #include <async.h> 45 #include <async_obsolete.h> 45 46 #include <errno.h> 46 47 #include <devmap.h> 47 48 48 #include "adb_mouse.h" 49 49 #include "adb_dev.h" 50 51 // FIXME: remove this header 52 #include <kernel/ipc/ipc_methods.h> 50 53 51 54 static void client_connection(ipc_callid_t iid, ipc_call_t *icall); … … 101 104 while (1) { 102 105 callid = async_get_call(&call); 103 switch (IPC_GET_IMETHOD(call)) {104 case IPC_M_PHONE_HUNGUP:106 107 if (!IPC_GET_IMETHOD(call)) { 105 108 if (client_phone != -1) { 106 async_ hangup(client_phone);109 async_obsolete_hangup(client_phone); 107 110 client_phone = -1; 108 111 } … … 110 113 async_answer_0(callid, EOK); 111 114 return; 115 } 116 117 switch (IPC_GET_IMETHOD(call)) { 112 118 case IPC_M_CONNECT_TO_ME: 113 119 if (client_phone != -1) { … … 158 164 { 159 165 if (client_phone != -1) { 160 async_ msg_2(client_phone, MEVENT_BUTTON, button, press);166 async_obsolete_msg_2(client_phone, MEVENT_BUTTON, button, press); 161 167 } 162 168 } … … 165 171 { 166 172 if (client_phone != -1) 167 async_ msg_2(client_phone, MEVENT_MOVE, dx, dy);173 async_obsolete_msg_2(client_phone, MEVENT_MOVE, dx, dy); 168 174 } 169 175 -
uspace/srv/hid/char_mouse/char_mouse.c
r764d71e r79ae36dd 43 43 #include <stdlib.h> 44 44 #include <async.h> 45 #include <async_obsolete.h> 45 46 #include <errno.h> 46 47 #include <devmap.h> 47 48 48 #include <char_mouse.h> 49 49 #include <mouse_port.h> 50 50 #include <mouse_proto.h> 51 52 // FIXME: remove this header 53 #include <kernel/ipc/ipc_methods.h> 51 54 52 55 #define NAME "mouse" … … 65 68 /* printf("ev_btn: button %d, press %d\n", button, press);*/ 66 69 if (client_phone != -1) { 67 async_ msg_2(client_phone, MEVENT_BUTTON, button, press);70 async_obsolete_msg_2(client_phone, MEVENT_BUTTON, button, press); 68 71 } 69 72 } … … 73 76 /* printf("ev_move: dx %d, dy %d\n", dx, dy);*/ 74 77 if (client_phone != -1) 75 async_ msg_2(client_phone, MEVENT_MOVE, dx, dy);78 async_obsolete_msg_2(client_phone, MEVENT_MOVE, dx, dy); 76 79 } 77 80 … … 86 89 while (1) { 87 90 callid = async_get_call(&call); 88 switch (IPC_GET_IMETHOD(call)) {89 case IPC_M_PHONE_HUNGUP:91 92 if (!IPC_GET_IMETHOD(call)) { 90 93 if (client_phone != -1) { 91 async_ hangup(client_phone);94 async_obsolete_hangup(client_phone); 92 95 client_phone = -1; 93 96 } … … 95 98 async_answer_0(callid, EOK); 96 99 return; 100 } 101 102 switch (IPC_GET_IMETHOD(call)) { 97 103 case IPC_M_CONNECT_TO_ME: 98 104 if (client_phone != -1) { -
uspace/srv/hid/char_mouse/chardev.c
r764d71e r79ae36dd 36 36 #include <ipc/char.h> 37 37 #include <async.h> 38 #include <async_obsolete.h> 38 39 #include <vfs/vfs.h> 39 40 #include <fcntl.h> 40 41 #include <errno.h> 41 42 #include <devmap.h> 43 #include <devmap_obsolete.h> 42 44 #include <char_mouse.h> 43 45 #include <mouse_port.h> … … 51 53 int mouse_port_init(void) 52 54 { 53 const char *input = "/dev/char/ps2b"; 54 int input_fd; 55 56 printf(NAME ": open %s\n", input); 57 58 input_fd = open(input, O_RDONLY); 59 if (input_fd < 0) { 60 printf(NAME ": Failed opening %s (%d)\n", input, input_fd); 61 return false; 55 devmap_handle_t handle; 56 int rc = devmap_device_get_handle("char/ps2b", &handle, 57 IPC_FLAG_BLOCKING); 58 59 if (rc != EOK) { 60 printf("%s: Failed resolving PS/2\n", NAME); 61 return rc; 62 62 } 63 64 dev_phone = fd_phone(input_fd);63 64 dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING); 65 65 if (dev_phone < 0) { 66 printf( NAME ": Failed to connect to device\n");67 return false;66 printf("%s: Failed connecting to PS/2\n", NAME); 67 return ENOENT; 68 68 } 69 69 70 70 /* NB: The callback connection is slotted for removal */ 71 if (async_ connect_to_me(dev_phone, 0, 0, 0, chardev_events) != 0) {71 if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, chardev_events) != 0) { 72 72 printf(NAME ": Failed to create callback from device\n"); 73 73 return false; 74 74 } 75 75 76 76 return 0; 77 77 } … … 87 87 void mouse_port_write(uint8_t data) 88 88 { 89 async_ msg_1(dev_phone, CHAR_WRITE_BYTE, data);89 async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data); 90 90 } 91 91 … … 99 99 100 100 int retval; 101 102 if (!IPC_GET_IMETHOD(call)) { 103 /* TODO: Handle hangup */ 104 return; 105 } 101 106 102 107 switch (IPC_GET_IMETHOD(call)) { 103 case IPC_M_PHONE_HUNGUP:104 /* TODO: Handle hangup */105 return;106 108 case IPC_FIRST_USER_METHOD: 107 109 mouse_handle_byte(IPC_GET_ARG1(call)); -
uspace/srv/hid/console/console.c
r764d71e r79ae36dd 39 39 #include <ipc/fb.h> 40 40 #include <ipc/services.h> 41 #include <ipc/ns.h> 41 #include <ns.h> 42 #include <ns_obsolete.h> 42 43 #include <errno.h> 43 44 #include <str_error.h> … … 45 46 #include <unistd.h> 46 47 #include <async.h> 48 #include <async_obsolete.h> 47 49 #include <adt/fifo.h> 48 50 #include <sys/mman.h> … … 52 54 #include <event.h> 53 55 #include <devmap.h> 56 #include <devmap_obsolete.h> 54 57 #include <fcntl.h> 55 58 #include <vfs/vfs.h> … … 63 66 #include "keybuffer.h" 64 67 68 // FIXME: remove this header 69 #include <kernel/ipc/ipc_methods.h> 65 70 66 71 #define NAME "console" 67 72 #define NAMESPACE "term" 73 68 74 /** Interval for checking for new keyboard (1/4s). */ 69 75 #define HOTPLUG_WATCH_INTERVAL (1000 * 250) … … 71 77 /* Kernel defines 32 but does not export it. */ 72 78 #define MAX_IPC_OUTGOING_PHONES 128 79 73 80 /** To allow proper phone closing. */ 74 81 static ipc_callid_t driver_phones[MAX_IPC_OUTGOING_PHONES] = { 0 }; … … 97 104 } console_t; 98 105 99 100 101 106 /** Array of data for virtual consoles */ 102 107 static console_t consoles[CONSOLE_COUNT]; … … 122 127 static void curs_visibility(bool visible) 123 128 { 124 async_ msg_1(fb_info.phone, FB_CURSOR_VISIBILITY, visible);129 async_obsolete_msg_1(fb_info.phone, FB_CURSOR_VISIBILITY, visible); 125 130 } 126 131 127 132 static void curs_hide_sync(void) 128 133 { 129 async_ req_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false);134 async_obsolete_req_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false); 130 135 } 131 136 132 137 static void curs_goto(sysarg_t x, sysarg_t y) 133 138 { 134 async_ msg_2(fb_info.phone, FB_CURSOR_GOTO, x, y);139 async_obsolete_msg_2(fb_info.phone, FB_CURSOR_GOTO, x, y); 135 140 } 136 141 137 142 static void screen_clear(void) 138 143 { 139 async_ msg_0(fb_info.phone, FB_CLEAR);144 async_obsolete_msg_0(fb_info.phone, FB_CLEAR); 140 145 } 141 146 142 147 static void screen_yield(void) 143 148 { 144 async_ req_0_0(fb_info.phone, FB_SCREEN_YIELD);149 async_obsolete_req_0_0(fb_info.phone, FB_SCREEN_YIELD); 145 150 } 146 151 147 152 static void screen_reclaim(void) 148 153 { 149 async_ req_0_0(fb_info.phone, FB_SCREEN_RECLAIM);154 async_obsolete_req_0_0(fb_info.phone, FB_SCREEN_RECLAIM); 150 155 } 151 156 152 157 static void kbd_yield(void) 153 158 { 154 async_ req_0_0(kbd_phone, KBD_YIELD);159 async_obsolete_req_0_0(kbd_phone, KBD_YIELD); 155 160 } 156 161 157 162 static void kbd_reclaim(void) 158 163 { 159 async_ req_0_0(kbd_phone, KBD_RECLAIM);164 async_obsolete_req_0_0(kbd_phone, KBD_RECLAIM); 160 165 } 161 166 162 167 static void set_style(uint8_t style) 163 168 { 164 async_ msg_1(fb_info.phone, FB_SET_STYLE, style);169 async_obsolete_msg_1(fb_info.phone, FB_SET_STYLE, style); 165 170 } 166 171 167 172 static void set_color(uint8_t fgcolor, uint8_t bgcolor, uint8_t flags) 168 173 { 169 async_ msg_3(fb_info.phone, FB_SET_COLOR, fgcolor, bgcolor, flags);174 async_obsolete_msg_3(fb_info.phone, FB_SET_COLOR, fgcolor, bgcolor, flags); 170 175 } 171 176 172 177 static void set_rgb_color(uint32_t fgcolor, uint32_t bgcolor) 173 178 { 174 async_ msg_2(fb_info.phone, FB_SET_RGB_COLOR, fgcolor, bgcolor);179 async_obsolete_msg_2(fb_info.phone, FB_SET_RGB_COLOR, fgcolor, bgcolor); 175 180 } 176 181 … … 227 232 } 228 233 229 async_ req_4_0(fb_info.phone, FB_DRAW_TEXT_DATA,234 async_obsolete_req_4_0(fb_info.phone, FB_DRAW_TEXT_DATA, 230 235 x0, y0, width, height); 231 236 } … … 268 273 static void fb_putchar(wchar_t c, sysarg_t col, sysarg_t row) 269 274 { 270 async_ msg_3(fb_info.phone, FB_PUTCHAR, c, col, row);275 async_obsolete_msg_3(fb_info.phone, FB_PUTCHAR, c, col, row); 271 276 } 272 277 … … 317 322 318 323 if (cons == active_console) 319 async_ msg_1(fb_info.phone, FB_SCROLL, 1);324 async_obsolete_msg_1(fb_info.phone, FB_SCROLL, 1); 320 325 } 321 326 … … 328 333 static void change_console(console_t *cons) 329 334 { 330 if (cons == active_console) {335 if (cons == active_console) 331 336 return; 332 }333 337 334 338 fb_pending_flush(); 335 339 336 340 if (cons == kernel_console) { 337 async_ serialize_start();341 async_obsolete_serialize_start(); 338 342 curs_hide_sync(); 339 343 gcons_in_kernel(); 340 344 screen_yield(); 341 345 kbd_yield(); 342 async_ serialize_end();346 async_obsolete_serialize_end(); 343 347 344 348 if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) { … … 350 354 351 355 if (cons != kernel_console) { 352 async_ serialize_start();356 async_obsolete_serialize_start(); 353 357 354 358 if (active_console == kernel_console) { … … 377 381 378 382 /* This call can preempt, but we are already at the end */ 379 rc = async_ req_4_0(fb_info.phone, FB_DRAW_TEXT_DATA,383 rc = async_obsolete_req_4_0(fb_info.phone, FB_DRAW_TEXT_DATA, 380 384 0, 0, cons->scr.size_x, 381 385 cons->scr.size_y); … … 405 409 curs_visibility(cons->scr.is_cursor_visible); 406 410 407 async_ serialize_end();411 async_obsolete_serialize_end(); 408 412 } 409 413 } … … 416 420 printf("Device %" PRIxn " gone.\n", hash); 417 421 driver_phones[i] = 0; 418 async_ hangup(i);422 async_obsolete_hangup(i); 419 423 return; 420 424 } … … 431 435 432 436 int retval; 433 console_event_t ev; 434 435 switch (IPC_GET_IMETHOD(call)) { 436 case IPC_M_PHONE_HUNGUP: 437 kbd_event_t ev; 438 439 if (!IPC_GET_IMETHOD(call)) { 437 440 /* TODO: Handle hangup */ 438 441 close_driver_phone(iid); 439 442 return; 443 } 444 445 switch (IPC_GET_IMETHOD(call)) { 440 446 case KBD_EVENT: 441 447 /* Got event from keyboard driver. */ … … 477 483 int retval; 478 484 479 switch (IPC_GET_IMETHOD(call)) { 480 case IPC_M_PHONE_HUNGUP: 485 if (!IPC_GET_IMETHOD(call)) { 481 486 /* TODO: Handle hangup */ 482 487 close_driver_phone(iid); 483 488 return; 489 } 490 491 switch (IPC_GET_IMETHOD(call)) { 484 492 case MEVENT_BUTTON: 485 493 if (IPC_GET_ARG1(call) == 1) { 486 494 int newcon = gcons_mouse_btn((bool) IPC_GET_ARG2(call)); 487 if (newcon != -1) {495 if (newcon != -1) 488 496 change_console(&consoles[newcon]); 489 }490 497 } 491 498 retval = 0; … … 515 522 } 516 523 517 async_ serialize_start();524 async_obsolete_serialize_start(); 518 525 519 526 size_t off = 0; … … 523 530 } 524 531 525 async_ serialize_end();532 async_obsolete_serialize_end(); 526 533 527 534 gcons_notify_char(cons->index); … … 549 556 550 557 size_t pos = 0; 551 console_event_t ev;558 kbd_event_t ev; 552 559 fibril_mutex_lock(&input_mutex); 553 560 … … 574 581 static void cons_get_event(console_t *cons, ipc_callid_t rid, ipc_call_t *request) 575 582 { 576 console_event_t ev;583 kbd_event_t ev; 577 584 578 585 fibril_mutex_lock(&input_mutex); … … 618 625 int rc; 619 626 620 async_ serialize_start();627 async_obsolete_serialize_start(); 621 628 if (cons->refcount == 0) 622 629 gcons_notify_connect(cons->index); … … 628 635 629 636 while (true) { 630 async_ serialize_end();637 async_obsolete_serialize_end(); 631 638 callid = async_get_call(&call); 632 async_ serialize_start();639 async_obsolete_serialize_start(); 633 640 634 641 arg1 = 0; … … 636 643 arg3 = 0; 637 644 638 switch (IPC_GET_IMETHOD(call)) { 639 case IPC_M_PHONE_HUNGUP: 645 if (!IPC_GET_IMETHOD(call)) { 640 646 cons->refcount--; 641 647 if (cons->refcount == 0) 642 648 gcons_notify_disconnect(cons->index); 643 649 return; 650 } 651 652 switch (IPC_GET_IMETHOD(call)) { 644 653 case VFS_OUT_READ: 645 async_ serialize_end();654 async_obsolete_serialize_end(); 646 655 cons_read(cons, callid, &call); 647 async_ serialize_start();656 async_obsolete_serialize_start(); 648 657 continue; 649 658 case VFS_OUT_WRITE: 650 async_ serialize_end();659 async_obsolete_serialize_end(); 651 660 cons_write(cons, callid, &call); 652 async_ serialize_start();661 async_obsolete_serialize_start(); 653 662 continue; 654 663 case VFS_OUT_SYNC: 655 664 fb_pending_flush(); 656 665 if (cons == active_console) { 657 async_ req_0_0(fb_info.phone, FB_FLUSH);666 async_obsolete_req_0_0(fb_info.phone, FB_FLUSH); 658 667 curs_goto(cons->scr.position_x, cons->scr.position_y); 659 668 } … … 662 671 /* Send message to fb */ 663 672 if (cons == active_console) 664 async_ msg_0(fb_info.phone, FB_CLEAR);673 async_obsolete_msg_0(fb_info.phone, FB_CLEAR); 665 674 666 675 screenbuffer_clear(&cons->scr); … … 721 730 break; 722 731 case CONSOLE_GET_EVENT: 723 async_ serialize_end();732 async_obsolete_serialize_end(); 724 733 cons_get_event(cons, callid, &call); 725 async_ serialize_start();734 async_obsolete_serialize_start(); 726 735 continue; 727 736 case CONSOLE_KCON_ENABLE: … … 739 748 740 749 static int async_connect_to_me_hack(int phone, sysarg_t arg1, sysarg_t arg2, 741 sysarg_t arg3, async_client_conn_t client_receiver, ipc_callid_t *hash)750 sysarg_t arg3, async_client_conn_t client_receiver, ipc_callid_t *hash) 742 751 { 743 752 sysarg_t task_hash; 744 753 sysarg_t phone_hash; 745 int rc = async_ req_3_5(phone, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3,754 int rc = async_obsolete_req_3_5(phone, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3, 746 755 NULL, NULL, NULL, &task_hash, &phone_hash); 747 756 if (rc != EOK) 748 757 return rc; 749 758 750 759 if (client_receiver != NULL) 751 760 async_new_connection(task_hash, phone_hash, phone_hash, NULL, 752 761 client_receiver); 753 754 if (hash != NULL) {762 763 if (hash != NULL) 755 764 *hash = phone_hash; 756 } 757 765 758 766 return EOK; 759 767 } 760 768 761 769 static int connect_keyboard_or_mouse(const char *devname, 762 async_client_conn_t handler, const char *path) 763 { 764 int fd = open(path, O_RDONLY); 765 if (fd < 0) { 766 return fd; 767 } 768 769 int phone = fd_phone(fd); 770 close(fd); 771 if (phone < 0) { 772 printf(NAME ": Failed to connect to input device\n"); 773 return phone; 774 } 775 770 async_client_conn_t handler, const char *dev) 771 { 772 int phone; 773 devmap_handle_t handle; 774 775 int rc = devmap_device_get_handle(dev, &handle, 0); 776 if (rc == EOK) { 777 phone = devmap_obsolete_device_connect(handle, 0); 778 if (phone < 0) { 779 printf("%s: Failed to connect to input device\n", NAME); 780 return phone; 781 } 782 } else 783 return rc; 784 785 /* NB: The callback connection is slotted for removal */ 776 786 ipc_callid_t hash; 777 intrc = async_connect_to_me_hack(phone, SERVICE_CONSOLE, 0, phone,787 rc = async_connect_to_me_hack(phone, SERVICE_CONSOLE, 0, phone, 778 788 handler, &hash); 779 789 if (rc != EOK) { 780 async_hangup(phone); 781 printf(NAME ": " \ 782 "Failed to create callback from input device: %s.\n", 783 str_error(rc)); 790 async_obsolete_hangup(phone); 791 printf("%s: Failed to create callback from input device (%s).\n", 792 NAME, str_error(rc)); 784 793 return rc; 785 794 } 786 795 787 796 driver_phones[phone] = hash; 788 789 printf(NAME ": found %s \"%s\" (%" PRIxn ").\n", devname, path, hash); 790 797 printf("%s: found %s \"%s\" (%" PRIxn ").\n", NAME, devname, dev, hash); 791 798 return phone; 792 799 } 793 800 794 static int connect_keyboard(const char * path)795 { 796 return connect_keyboard_or_mouse("keyboard", keyboard_events, path);797 } 798 799 static int connect_mouse(const char * path)800 { 801 return connect_keyboard_or_mouse("mouse", mouse_events, path);801 static int connect_keyboard(const char *dev) 802 { 803 return connect_keyboard_or_mouse("keyboard", keyboard_events, dev); 804 } 805 806 static int connect_mouse(const char *dev) 807 { 808 return connect_keyboard_or_mouse("mouse", mouse_events, dev); 802 809 } 803 810 … … 810 817 * 811 818 * @param arg Class name. 819 * 812 820 * @return This function should never exit. 821 * 813 822 */ 814 823 static int check_new_device_fibril(void *arg) 815 824 { 816 struct hid_class_info *dev_info = arg;817 825 struct hid_class_info *dev_info = (struct hid_class_info *) arg; 826 818 827 size_t index = 1; 819 828 820 829 while (true) { 821 830 async_usleep(HOTPLUG_WATCH_INTERVAL); 822 char *path; 823 int rc = asprintf(&path, "/dev/class/%s\\%zu", 831 832 char *dev; 833 int rc = asprintf(&dev, "class/%s\\%zu", 824 834 dev_info->classname, index); 825 if (rc < 0) {835 if (rc < 0) 826 836 continue; 827 } 828 rc = 0; 829 rc = dev_info->connection_func(path); 837 838 rc = dev_info->connection_func(dev); 830 839 if (rc > 0) { 831 840 /* We do not allow unplug. */ 832 841 index++; 833 842 } 834 835 free( path);836 } 837 843 844 free(dev); 845 } 846 838 847 return EOK; 839 848 } 840 841 849 842 850 /** Start a fibril monitoring hot-plugged keyboards. … … 847 855 struct hid_class_info *dev_info = malloc(sizeof(struct hid_class_info)); 848 856 if (dev_info == NULL) { 849 printf(NAME ": " \ 850 "out of memory, will not start hot-plug-watch fibril.\n"); 857 printf("%s: Out of memory, no hot-plug support.\n", NAME); 851 858 return; 852 859 } 853 int rc; 854 855 rc = asprintf(&dev_info->classname, "%s", classname); 860 861 int rc = asprintf(&dev_info->classname, "%s", classname); 856 862 if (rc < 0) { 857 printf( NAME ": failed to format classname: %s.\n",863 printf("%s: Failed to format classname: %s.\n", NAME, 858 864 str_error(rc)); 859 865 return; 860 866 } 867 861 868 dev_info->connection_func = connection_func; 862 863 fid_t fid = fibril_create(check_new_device_fibril, (void *) dev_info);869 870 fid_t fid = fibril_create(check_new_device_fibril, (void *) dev_info); 864 871 if (!fid) { 865 printf(NAME 866 ": failed to create hot-plug-watch fibril for %s.\n", 872 printf("%s: Failed to create hot-plug fibril for %s.\n", NAME, 867 873 classname); 868 874 return; 869 875 } 876 870 877 fibril_add_ready(fid); 871 878 } 872 879 873 static bool console_ init(char *input)880 static bool console_srv_init(char *kdev) 874 881 { 875 882 /* Connect to input device */ 876 kbd_phone = connect_keyboard( input);877 if (kbd_phone < 0) {883 kbd_phone = connect_keyboard(kdev); 884 if (kbd_phone < 0) 878 885 return false; 879 } 880 881 mouse_phone = connect_mouse("/dev/hid_in/mouse"); 886 887 mouse_phone = connect_mouse("hid_in/mouse"); 882 888 if (mouse_phone < 0) { 883 printf( NAME ": Failed to connect to mouse device: %s.\n",889 printf("%s: Failed to connect to mouse device %s\n", NAME, 884 890 str_error(mouse_phone)); 885 891 } 886 892 887 893 /* Connect to framebuffer driver */ 888 fb_info.phone = service_ connect_blocking(SERVICE_VIDEO, 0, 0);894 fb_info.phone = service_obsolete_connect_blocking(SERVICE_VIDEO, 0, 0); 889 895 if (fb_info.phone < 0) { 890 printf( NAME ": Failed to connect to video service\n");891 return -1;896 printf("%s: Failed to connect to video service\n", NAME); 897 return false; 892 898 } 893 899 … … 895 901 int rc = devmap_driver_register(NAME, client_connection); 896 902 if (rc < 0) { 897 printf( NAME ": Unable to register driver (%d)\n", rc);903 printf("%s: Unable to register driver (%d)\n", NAME, rc); 898 904 return false; 899 905 } … … 903 909 904 910 /* Synchronize, the gcons could put something in queue */ 905 async_ req_0_0(fb_info.phone, FB_FLUSH);906 async_ req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.cols, &fb_info.rows);907 async_ req_0_1(fb_info.phone, FB_GET_COLOR_CAP, &fb_info.color_cap);911 async_obsolete_req_0_0(fb_info.phone, FB_FLUSH); 912 async_obsolete_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.cols, &fb_info.rows); 913 async_obsolete_req_0_1(fb_info.phone, FB_GET_COLOR_CAP, &fb_info.color_cap); 908 914 909 915 /* Set up shared memory buffer. */ … … 916 922 917 923 if (interbuffer) { 918 if (async_ share_out_start(fb_info.phone, interbuffer,924 if (async_obsolete_share_out_start(fb_info.phone, interbuffer, 919 925 AS_AREA_READ) != EOK) { 920 926 as_area_destroy(interbuffer); … … 931 937 if (screenbuffer_init(&consoles[i].scr, 932 938 fb_info.cols, fb_info.rows) == NULL) { 933 printf( NAME ": Unable to allocate screen buffer %zu\n", i);939 printf("%s: Unable to allocate screen buffer %zu\n", NAME, i); 934 940 return false; 935 941 } … … 943 949 944 950 if (devmap_device_register(vc, &consoles[i].devmap_handle) != EOK) { 945 printf( NAME ": Unable to register device %s\n", vc);951 printf("%s: Unable to register device %s\n", NAME, vc); 946 952 return false; 947 953 } … … 953 959 954 960 /* Initialize the screen */ 955 async_ serialize_start();961 async_obsolete_serialize_start(); 956 962 gcons_redraw_console(); 957 963 set_style(STYLE_NORMAL); … … 959 965 curs_goto(0, 0); 960 966 curs_visibility(active_console->scr.is_cursor_visible); 961 async_ serialize_end();967 async_obsolete_serialize_end(); 962 968 963 969 /* Receive kernel notifications */ 964 970 async_set_interrupt_received(interrupt_received); 965 971 if (event_subscribe(EVENT_KCONSOLE, 0) != EOK) 966 printf( NAME ": Error registering kconsole notifications\n");972 printf("%s: Error registering kconsole notifications\n", NAME); 967 973 968 974 /* Start fibril for checking on hot-plugged keyboards. */ 969 975 check_new_devices_in_background(connect_keyboard, "keyboard"); 970 976 check_new_devices_in_background(connect_mouse, "mouse"); 971 977 972 978 return true; 973 979 } … … 987 993 printf(NAME ": HelenOS Console service\n"); 988 994 989 if (!console_ init(argv[1]))995 if (!console_srv_init(argv[1])) 990 996 return -1; 991 997 992 998 printf(NAME ": Accepting connections\n"); 993 999 async_manager(); -
uspace/srv/hid/console/gcons.c
r764d71e r79ae36dd 35 35 #include <ipc/fb.h> 36 36 #include <async.h> 37 #include <async_obsolete.h> 37 38 #include <stdio.h> 38 39 #include <sys/mman.h> … … 115 116 static void vp_switch(int vp) 116 117 { 117 async_ msg_1(fbphone, FB_VIEWPORT_SWITCH, vp);118 async_obsolete_msg_1(fbphone, FB_VIEWPORT_SWITCH, vp); 118 119 } 119 120 … … 121 122 static int vp_create(sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height) 122 123 { 123 return async_ req_2_0(fbphone, FB_VIEWPORT_CREATE, (x << 16) | y,124 return async_obsolete_req_2_0(fbphone, FB_VIEWPORT_CREATE, (x << 16) | y, 124 125 (width << 16) | height); 125 126 } … … 127 128 static void clear(void) 128 129 { 129 async_ msg_0(fbphone, FB_CLEAR);130 async_obsolete_msg_0(fbphone, FB_CLEAR); 130 131 } 131 132 132 133 static void set_rgb_color(uint32_t fgcolor, uint32_t bgcolor) 133 134 { 134 async_ msg_2(fbphone, FB_SET_RGB_COLOR, fgcolor, bgcolor);135 async_obsolete_msg_2(fbphone, FB_SET_RGB_COLOR, fgcolor, bgcolor); 135 136 } 136 137 … … 138 139 static void tran_putch(wchar_t ch, sysarg_t col, sysarg_t row) 139 140 { 140 async_ msg_3(fbphone, FB_PUTCHAR, ch, col, row);141 async_obsolete_msg_3(fbphone, FB_PUTCHAR, ch, col, row); 141 142 } 142 143 … … 149 150 150 151 if (ic_pixmaps[state] != -1) 151 async_ msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[index],152 async_obsolete_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[index], 152 153 ic_pixmaps[state]); 153 154 … … 177 178 178 179 if (animation != -1) 179 async_ msg_1(fbphone, FB_ANIM_START, animation);180 async_obsolete_msg_1(fbphone, FB_ANIM_START, animation); 180 181 } else { 181 182 if (console_state[active_console] == CONS_DISCONNECTED_SEL) … … 258 259 { 259 260 if (animation != -1) 260 async_ msg_1(fbphone, FB_ANIM_STOP, animation);261 async_obsolete_msg_1(fbphone, FB_ANIM_STOP, animation); 261 262 262 263 active_console = KERNEL_CONSOLE; … … 294 295 295 296 if (active_console != KERNEL_CONSOLE) 296 async_ msg_2(fbphone, FB_POINTER_MOVE, mouse_x, mouse_y);297 async_obsolete_msg_2(fbphone, FB_POINTER_MOVE, mouse_x, mouse_y); 297 298 } 298 299 … … 374 375 375 376 /* Send area */ 376 int rc = async_ req_1_0(fbphone, FB_PREPARE_SHM, (sysarg_t) shm);377 int rc = async_obsolete_req_1_0(fbphone, FB_PREPARE_SHM, (sysarg_t) shm); 377 378 if (rc) 378 379 goto exit; 379 380 380 rc = async_ share_out_start(fbphone, shm, PROTO_READ);381 rc = async_obsolete_share_out_start(fbphone, shm, PROTO_READ); 381 382 if (rc) 382 383 goto drop; 383 384 384 385 /* Draw logo */ 385 async_ msg_2(fbphone, FB_DRAW_PPM, x, y);386 async_obsolete_msg_2(fbphone, FB_DRAW_PPM, x, y); 386 387 387 388 drop: 388 389 /* Drop area */ 389 async_ msg_0(fbphone, FB_DROP_SHM);390 async_obsolete_msg_0(fbphone, FB_DROP_SHM); 390 391 391 392 exit: … … 436 437 437 438 /* Send area */ 438 int rc = async_ req_1_0(fbphone, FB_PREPARE_SHM, (sysarg_t) shm);439 int rc = async_obsolete_req_1_0(fbphone, FB_PREPARE_SHM, (sysarg_t) shm); 439 440 if (rc) 440 441 goto exit; 441 442 442 rc = async_ share_out_start(fbphone, shm, PROTO_READ);443 rc = async_obsolete_share_out_start(fbphone, shm, PROTO_READ); 443 444 if (rc) 444 445 goto drop; 445 446 446 447 /* Obtain pixmap */ 447 rc = async_ req_0_0(fbphone, FB_SHM2PIXMAP);448 rc = async_obsolete_req_0_0(fbphone, FB_SHM2PIXMAP); 448 449 if (rc < 0) 449 450 goto drop; … … 453 454 drop: 454 455 /* Drop area */ 455 async_ msg_0(fbphone, FB_DROP_SHM);456 async_obsolete_msg_0(fbphone, FB_DROP_SHM); 456 457 457 458 exit: … … 464 465 static void make_anim(void) 465 466 { 466 int an = async_ req_1_0(fbphone, FB_ANIM_CREATE,467 int an = async_obsolete_req_1_0(fbphone, FB_ANIM_CREATE, 467 468 cstatus_vp[KERNEL_CONSOLE]); 468 469 if (an < 0) … … 471 472 int pm = make_pixmap(_binary_gfx_anim_1_ppm_start, 472 473 (size_t) &_binary_gfx_anim_1_ppm_size); 473 async_ msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);474 async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 474 475 475 476 pm = make_pixmap(_binary_gfx_anim_2_ppm_start, 476 477 (size_t) &_binary_gfx_anim_2_ppm_size); 477 async_ msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);478 async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 478 479 479 480 pm = make_pixmap(_binary_gfx_anim_3_ppm_start, 480 481 (size_t) &_binary_gfx_anim_3_ppm_size); 481 async_ msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);482 async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 482 483 483 484 pm = make_pixmap(_binary_gfx_anim_4_ppm_start, 484 485 (size_t) &_binary_gfx_anim_4_ppm_size); 485 async_ msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);486 487 async_ msg_1(fbphone, FB_ANIM_START, an);486 async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 487 488 async_obsolete_msg_1(fbphone, FB_ANIM_START, an); 488 489 489 490 animation = an; … … 495 496 fbphone = phone; 496 497 497 int rc = async_ req_0_2(phone, FB_GET_RESOLUTION, &xres, &yres);498 int rc = async_obsolete_req_0_2(phone, FB_GET_RESOLUTION, &xres, &yres); 498 499 if (rc) 499 500 return; -
uspace/srv/hid/console/keybuffer.c
r764d71e r79ae36dd 90 90 * 91 91 */ 92 void keybuffer_push(keybuffer_t *keybuffer, const console_event_t *ev)92 void keybuffer_push(keybuffer_t *keybuffer, const kbd_event_t *ev) 93 93 { 94 94 futex_down(&keybuffer_futex); … … 110 110 * 111 111 */ 112 bool keybuffer_pop(keybuffer_t *keybuffer, console_event_t *edst)112 bool keybuffer_pop(keybuffer_t *keybuffer, kbd_event_t *edst) 113 113 { 114 114 futex_down(&keybuffer_futex); -
uspace/srv/hid/console/keybuffer.h
r764d71e r79ae36dd 46 46 47 47 typedef struct { 48 console_event_t fifo[KEYBUFFER_SIZE];48 kbd_event_t fifo[KEYBUFFER_SIZE]; 49 49 size_t head; 50 50 size_t tail; … … 56 56 extern size_t keybuffer_available(keybuffer_t *); 57 57 extern bool keybuffer_empty(keybuffer_t *); 58 extern void keybuffer_push(keybuffer_t *, const console_event_t *);59 extern bool keybuffer_pop(keybuffer_t *, console_event_t *);58 extern void keybuffer_push(keybuffer_t *, const kbd_event_t *); 59 extern bool keybuffer_pop(keybuffer_t *, kbd_event_t *); 60 60 61 61 #endif -
uspace/srv/hid/fb/ega.c
r764d71e r79ae36dd 52 52 #include <io/screenbuffer.h> 53 53 #include <sys/types.h> 54 55 54 #include "ega.h" 56 55 #include "main.h" 56 57 // FIXME: remove this header 58 #include <kernel/ipc/ipc_methods.h> 57 59 58 60 #define MAX_SAVED_SCREENS 256 … … 291 293 int retval; 292 294 293 switch (IPC_GET_IMETHOD(call)) { 294 case IPC_M_PHONE_HUNGUP: 295 if (!IPC_GET_IMETHOD(call)) { 295 296 client_connected = 0; 296 297 async_answer_0(callid, EOK); … … 298 299 /* Exit thread */ 299 300 return; 301 } 302 303 switch (IPC_GET_IMETHOD(call)) { 300 304 case IPC_M_SHARE_OUT: 301 305 /* We accept one area for data interchange */ -
uspace/srv/hid/fb/fb.c
r764d71e r79ae36dd 59 59 #include <byteorder.h> 60 60 #include <io/screenbuffer.h> 61 62 61 #include "font-8x16.h" 63 62 #include "fb.h" 64 63 #include "main.h" 65 64 #include "ppm.h" 66 67 65 #include "pointer.xbm" 68 66 #include "pointer_mask.xbm" 67 68 // FIXME: remove this header 69 #include <kernel/ipc/ipc_methods.h> 69 70 70 71 #define DEFAULT_BGCOLOR 0xf0f0f0 … … 1620 1621 continue; 1621 1622 1622 switch (IPC_GET_IMETHOD(call)) { 1623 case IPC_M_PHONE_HUNGUP: 1623 if (!IPC_GET_IMETHOD(call)) { 1624 1624 client_connected = false; 1625 1625 … … 1630 1630 /* Exit thread */ 1631 1631 return; 1632 } 1632 1633 1634 switch (IPC_GET_IMETHOD(call)) { 1633 1635 case FB_PUTCHAR: 1634 1636 ch = IPC_GET_ARG1(call); -
uspace/srv/hid/fb/main.c
r764d71e r79ae36dd 28 28 29 29 #include <ipc/services.h> 30 #include < ipc/ns.h>30 #include <ns.h> 31 31 #include <sysinfo.h> 32 32 #include <async.h> -
uspace/srv/hid/fb/serial_console.c
r764d71e r79ae36dd 52 52 #include "serial_console.h" 53 53 54 // FIXME: remove this header 55 #include <kernel/ipc/ipc_methods.h> 56 54 57 #define MAX_CONTROL 20 55 58 … … 344 347 int retval; 345 348 346 switch (IPC_GET_IMETHOD(call)) { 347 case IPC_M_PHONE_HUNGUP: 349 if (!IPC_GET_IMETHOD(call)) { 348 350 client_connected = 0; 349 351 async_answer_0(callid, EOK); … … 351 353 /* Exit thread */ 352 354 return; 355 } 356 357 switch (IPC_GET_IMETHOD(call)) { 353 358 case IPC_M_SHARE_OUT: 354 359 /* We accept one area for data interchange */ -
uspace/srv/hid/kbd/ctl/apple.c
r764d71e r79ae36dd 52 52 void kbd_ctl_parse_scancode(int scancode) 53 53 { 54 console_ev_type_t type;54 kbd_event_type_t type; 55 55 unsigned int key; 56 56 -
uspace/srv/hid/kbd/ctl/pc.c
r764d71e r79ae36dd 205 205 void kbd_ctl_parse_scancode(int scancode) 206 206 { 207 console_ev_type_t type;207 kbd_event_type_t type; 208 208 unsigned int key; 209 209 int *map; -
uspace/srv/hid/kbd/ctl/sun.c
r764d71e r79ae36dd 53 53 void kbd_ctl_parse_scancode(int scancode) 54 54 { 55 console_ev_type_t type;55 kbd_event_type_t type; 56 56 unsigned int key; 57 57 -
uspace/srv/hid/kbd/generic/kbd.c
r764d71e r79ae36dd 43 43 #include <stdlib.h> 44 44 #include <stdio.h> 45 #include <ipc/ns.h> 45 #include <ns.h> 46 #include <ns_obsolete.h> 46 47 #include <async.h> 48 #include <async_obsolete.h> 47 49 #include <errno.h> 48 50 #include <adt/fifo.h> … … 50 52 #include <io/keycode.h> 51 53 #include <devmap.h> 52 53 54 #include <kbd.h> 54 55 #include <kbd_port.h> 55 56 #include <kbd_ctl.h> 56 57 #include <layout.h> 58 59 // FIXME: remove this header 60 #include <kernel/ipc/ipc_methods.h> 57 61 58 62 #define NAME "kbd" … … 88 92 void kbd_push_ev(int type, unsigned int key) 89 93 { 90 console_event_t ev;94 kbd_event_t ev; 91 95 unsigned mod_mask; 92 96 … … 163 167 ev.c = layout[active_layout]->parse_ev(&ev); 164 168 165 async_ msg_4(client_phone, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c);169 async_obsolete_msg_4(client_phone, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c); 166 170 } 167 171 … … 174 178 async_answer_0(iid, EOK); 175 179 176 while ( 1) {180 while (true) { 177 181 callid = async_get_call(&call); 178 switch (IPC_GET_IMETHOD(call)) {179 case IPC_M_PHONE_HUNGUP:182 183 if (!IPC_GET_IMETHOD(call)) { 180 184 if (client_phone != -1) { 181 async_ hangup(client_phone);185 async_obsolete_hangup(client_phone); 182 186 client_phone = -1; 183 187 } … … 185 189 async_answer_0(callid, EOK); 186 190 return; 191 } 192 193 switch (IPC_GET_IMETHOD(call)) { 187 194 case IPC_M_CONNECT_TO_ME: 188 195 if (client_phone != -1) { … … 222 229 if (irc_service) { 223 230 while (irc_phone < 0) 224 irc_phone = service_ connect_blocking(SERVICE_IRC, 0, 0);231 irc_phone = service_obsolete_connect_blocking(SERVICE_IRC, 0, 0); 225 232 } 226 233 -
uspace/srv/hid/kbd/include/layout.h
r764d71e r79ae36dd 43 43 typedef struct { 44 44 void (*reset)(void); 45 wchar_t (*parse_ev)( console_event_t *);45 wchar_t (*parse_ev)(kbd_event_t *); 46 46 } layout_op_t; 47 47 -
uspace/srv/hid/kbd/layout/cz.c
r764d71e r79ae36dd 39 39 40 40 static void layout_reset(void); 41 static wchar_t layout_parse_ev( console_event_t *ev);41 static wchar_t layout_parse_ev(kbd_event_t *ev); 42 42 43 43 enum m_state { … … 273 273 } 274 274 275 static wchar_t parse_ms_hacek( console_event_t *ev)275 static wchar_t parse_ms_hacek(kbd_event_t *ev) 276 276 { 277 277 wchar_t c; … … 291 291 } 292 292 293 static wchar_t parse_ms_carka( console_event_t *ev)293 static wchar_t parse_ms_carka(kbd_event_t *ev) 294 294 { 295 295 wchar_t c; … … 309 309 } 310 310 311 static wchar_t parse_ms_start( console_event_t *ev)311 static wchar_t parse_ms_start(kbd_event_t *ev) 312 312 { 313 313 wchar_t c; … … 384 384 } 385 385 386 static wchar_t layout_parse_ev( console_event_t *ev)386 static wchar_t layout_parse_ev(kbd_event_t *ev) 387 387 { 388 388 if (ev->type != KEY_PRESS) -
uspace/srv/hid/kbd/layout/us_dvorak.c
r764d71e r79ae36dd 38 38 39 39 static void layout_reset(void); 40 static wchar_t layout_parse_ev( console_event_t *ev);40 static wchar_t layout_parse_ev(kbd_event_t *ev); 41 41 42 42 layout_op_t us_dvorak_op = { … … 210 210 } 211 211 212 static wchar_t layout_parse_ev( console_event_t *ev)212 static wchar_t layout_parse_ev(kbd_event_t *ev) 213 213 { 214 214 wchar_t c; -
uspace/srv/hid/kbd/layout/us_qwerty.c
r764d71e r79ae36dd 38 38 39 39 static void layout_reset(void); 40 static wchar_t layout_parse_ev( console_event_t *ev);40 static wchar_t layout_parse_ev(kbd_event_t *ev); 41 41 42 42 layout_op_t us_qwerty_op = { … … 204 204 } 205 205 206 static wchar_t layout_parse_ev( console_event_t *ev)206 static wchar_t layout_parse_ev(kbd_event_t *ev) 207 207 { 208 208 wchar_t c; -
uspace/srv/hid/kbd/port/adb.c
r764d71e r79ae36dd 30 30 * @ingroup kbd 31 31 * @{ 32 */ 32 */ 33 33 /** @file 34 34 * @brief ADB keyboard port driver. … … 37 37 #include <ipc/adb.h> 38 38 #include <async.h> 39 #include <async_obsolete.h> 39 40 #include <kbd_port.h> 40 41 #include <kbd.h> … … 42 43 #include <fcntl.h> 43 44 #include <errno.h> 45 #include <devmap.h> 46 #include <devmap_obsolete.h> 44 47 45 48 static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall); … … 52 55 int kbd_port_init(void) 53 56 { 54 const char *input = "/dev/adb/kbd"; 55 int input_fd; 56 57 printf(NAME ": open %s\n", input); 58 59 input_fd = open(input, O_RDONLY); 60 if (input_fd < 0) { 61 printf(NAME ": Failed opening %s (%d)\n", input, input_fd); 62 return false; 57 const char *dev = "adb/kbd"; 58 devmap_handle_t handle; 59 60 int rc = devmap_device_get_handle(dev, &handle, 0); 61 if (rc == EOK) { 62 dev_phone = devmap_obsolete_device_connect(handle, 0); 63 if (dev_phone < 0) { 64 printf("%s: Failed to connect to device\n", NAME); 65 return dev_phone; 66 } 67 } else 68 return rc; 69 70 /* NB: The callback connection is slotted for removal */ 71 rc = async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events); 72 if (rc != EOK) { 73 printf(NAME ": Failed to create callback from device\n"); 74 return rc; 63 75 } 64 65 dev_phone = fd_phone(input_fd); 66 if (dev_phone < 0) { 67 printf(NAME ": Failed to connect to device\n"); 68 return false; 69 } 70 71 /* NB: The callback connection is slotted for removal */ 72 if (async_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) { 73 printf(NAME ": Failed to create callback from device\n"); 74 return false; 75 } 76 77 return 0; 76 77 return EOK; 78 78 } 79 79 … … 100 100 101 101 int retval; 102 103 switch (IPC_GET_IMETHOD(call)) { 104 case IPC_M_PHONE_HUNGUP: 102 103 if (!IPC_GET_IMETHOD(call)) { 105 104 /* TODO: Handle hangup */ 106 105 return; 106 } 107 108 switch (IPC_GET_IMETHOD(call)) { 107 109 case ADB_REG_NOTIF: 108 110 adb_kbd_reg0_data(IPC_GET_ARG1(call)); -
uspace/srv/hid/kbd/port/chardev.c
r764d71e r79ae36dd 30 30 * @ingroup kbd 31 31 * @{ 32 */ 32 */ 33 33 /** @file 34 34 * @brief Chardev keyboard port driver. … … 37 37 #include <ipc/char.h> 38 38 #include <async.h> 39 #include <async_obsolete.h> 39 40 #include <kbd_port.h> 40 41 #include <kbd.h> 41 #include <vfs/vfs.h> 42 #include <sys/stat.h> 43 #include <fcntl.h> 42 #include <devmap.h> 43 #include <devmap_obsolete.h> 44 44 #include <errno.h> 45 #include <stdio.h> 46 47 #define NAME "kbd/chardev" 45 48 46 49 static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall); … … 48 51 static int dev_phone; 49 52 50 #define NAME "kbd"51 52 53 /** List of devices to try connecting to. */ 53 54 static const char *in_devs[] = { 54 " /dev/char/ps2a",55 " /dev/char/s3c24ser"55 "char/ps2a", 56 "char/s3c24ser" 56 57 }; 57 58 58 static const int num_devs = sizeof(in_devs) / sizeof(in_devs[0]);59 static const unsigned int num_devs = sizeof(in_devs) / sizeof(in_devs[0]); 59 60 60 61 int kbd_port_init(void) 61 62 { 62 int input_fd;63 int i;64 65 input_fd = -1;63 devmap_handle_t handle; 64 unsigned int i; 65 int rc; 66 66 67 for (i = 0; i < num_devs; i++) { 67 struct stat s; 68 69 if (stat(in_devs[i], &s) == EOK) 68 rc = devmap_device_get_handle(in_devs[i], &handle, 0); 69 if (rc == EOK) 70 70 break; 71 71 } 72 72 73 73 if (i >= num_devs) { 74 printf( NAME ": Could not find any suitable input device.\n");74 printf("%s: Could not find any suitable input device\n", NAME); 75 75 return -1; 76 76 } 77 78 input_fd = open(in_devs[i], O_RDONLY); 79 if (input_fd < 0) { 80 printf(NAME ": failed opening device %s (%d).\n", in_devs[i], 81 input_fd); 82 return -1; 77 78 dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING); 79 if (dev_phone < 0) { 80 printf("%s: Failed connecting to device\n", NAME); 81 return ENOENT; 83 82 } 84 85 dev_phone = fd_phone(input_fd); 86 if (dev_phone < 0) { 87 printf(NAME ": Failed connecting to device\n"); 88 return -1; 89 } 90 83 91 84 /* NB: The callback connection is slotted for removal */ 92 if (async_ connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) {85 if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) { 93 86 printf(NAME ": Failed to create callback from device\n"); 94 87 return -1; … … 108 101 void kbd_port_write(uint8_t data) 109 102 { 110 async_ msg_1(dev_phone, CHAR_WRITE_BYTE, data);103 async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data); 111 104 } 112 105 … … 118 111 ipc_call_t call; 119 112 ipc_callid_t callid = async_get_call(&call); 113 114 if (!IPC_GET_IMETHOD(call)) { 115 /* TODO: Handle hangup */ 116 return; 117 } 120 118 121 119 int retval; 122 120 123 121 switch (IPC_GET_IMETHOD(call)) { 124 case IPC_M_PHONE_HUNGUP:125 /* TODO: Handle hangup */126 return;127 122 case CHAR_NOTIF_BYTE: 128 123 kbd_push_scancode(IPC_GET_ARG1(call)); -
uspace/srv/hid/kbd/port/ns16550.c
r764d71e r79ae36dd 37 37 #include <ipc/irc.h> 38 38 #include <async.h> 39 #include <async_obsolete.h> 39 40 #include <sysinfo.h> 40 41 #include <kbd.h> … … 121 122 122 123 if (irc_service) 123 async_ msg_1(irc_phone, IRC_CLEAR_INTERRUPT,124 async_obsolete_msg_1(irc_phone, IRC_CLEAR_INTERRUPT, 124 125 IPC_GET_IMETHOD(*call)); 125 126 } -
uspace/srv/hid/kbd/port/z8530.c
r764d71e r79ae36dd 37 37 #include <ipc/irc.h> 38 38 #include <async.h> 39 #include <async_obsolete.h> 39 40 #include <sysinfo.h> 40 41 #include <kbd.h> … … 109 110 110 111 if (irc_service) 111 async_ msg_1(irc_phone, IRC_CLEAR_INTERRUPT,112 async_obsolete_msg_1(irc_phone, IRC_CLEAR_INTERRUPT, 112 113 IPC_GET_IMETHOD(*call)); 113 114 } -
uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c
r764d71e r79ae36dd 44 44 #include <ipc/mouse.h> 45 45 #include <async.h> 46 #include <async_obsolete.h> 46 47 #include <unistd.h> 47 48 #include <stdio.h> … … 50 51 #include <errno.h> 51 52 #include <inttypes.h> 52 53 53 #include "s3c24xx_ts.h" 54 55 // FIXME: remove this header 56 #include <kernel/ipc/ipc_methods.h> 54 57 55 58 #define NAME "s3c24ser" … … 280 283 button = 1; 281 284 press = 0; 282 async_ msg_2(ts->client_phone, MEVENT_BUTTON, button, press);285 async_obsolete_msg_2(ts->client_phone, MEVENT_BUTTON, button, press); 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_obsolete_msg_2(ts->client_phone, MEVENT_MOVE, dx, dy); 327 async_obsolete_msg_2(ts->client_phone, MEVENT_BUTTON, button, press); 325 328 326 329 ts->last_x = x_pos; … … 380 383 while (1) { 381 384 callid = async_get_call(&call); 382 switch (IPC_GET_IMETHOD(call)) {383 case IPC_M_PHONE_HUNGUP:385 386 if (!IPC_GET_IMETHOD(call)) { 384 387 if (ts->client_phone != -1) { 385 async_ hangup(ts->client_phone);388 async_obsolete_hangup(ts->client_phone); 386 389 ts->client_phone = -1; 387 390 } … … 389 392 async_answer_0(callid, EOK); 390 393 return; 394 } 395 396 switch (IPC_GET_IMETHOD(call)) { 391 397 case IPC_M_CONNECT_TO_ME: 392 398 if (ts->client_phone != -1) {
Note:
See TracChangeset
for help on using the changeset viewer.
