Changeset 79ae36dd in mainline for uspace/srv/hid/char_mouse
- 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/char_mouse
- Files:
-
- 2 edited
-
char_mouse.c (modified) (5 diffs)
-
chardev.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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));
Note:
See TracChangeset
for help on using the changeset viewer.
