Changes in uspace/srv/hid/char_mouse/chardev.c [9934f7d:ffa2c8ef] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/char_mouse/chardev.c
r9934f7d rffa2c8ef 36 36 #include <ipc/char.h> 37 37 #include <async.h> 38 #include <async_obsolete.h>39 38 #include <vfs/vfs.h> 40 39 #include <fcntl.h> 41 40 #include <errno.h> 42 #include <devmap.h> 43 #include <devmap_obsolete.h> 41 44 42 #include <char_mouse.h> 45 43 #include <mouse_port.h> 46 44 47 static void chardev_events(ipc_callid_t iid, ipc_call_t *icall , void *arg);45 static void chardev_events(ipc_callid_t iid, ipc_call_t *icall); 48 46 49 47 static int dev_phone; … … 53 51 int mouse_port_init(void) 54 52 { 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; 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; 62 62 } 63 64 dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING);63 64 dev_phone = fd_phone(input_fd); 65 65 if (dev_phone < 0) { 66 printf( "%s: Failed connecting to PS/2\n", NAME);67 return ENOENT;66 printf(NAME ": Failed to connect to device\n"); 67 return false; 68 68 } 69 69 70 70 /* NB: The callback connection is slotted for removal */ 71 if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, chardev_events, 72 NULL) != 0) { 71 if (async_connect_to_me(dev_phone, 0, 0, 0, chardev_events) != 0) { 73 72 printf(NAME ": Failed to create callback from device\n"); 74 73 return false; 75 74 } 76 75 77 76 return 0; 78 77 } … … 88 87 void mouse_port_write(uint8_t data) 89 88 { 90 async_ obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data);89 async_msg_1(dev_phone, CHAR_WRITE_BYTE, data); 91 90 } 92 91 93 static void chardev_events(ipc_callid_t iid, ipc_call_t *icall , void *arg)92 static void chardev_events(ipc_callid_t iid, ipc_call_t *icall) 94 93 { 95 94 /* Ignore parameters, the connection is already opened */ … … 100 99 101 100 int retval; 102 103 if (!IPC_GET_IMETHOD(call)) { 101 102 switch (IPC_GET_IMETHOD(call)) { 103 case IPC_M_PHONE_HUNGUP: 104 104 /* TODO: Handle hangup */ 105 105 return; 106 }107 108 switch (IPC_GET_IMETHOD(call)) {109 106 case IPC_FIRST_USER_METHOD: 110 107 mouse_handle_byte(IPC_GET_ARG1(call));
Note:
See TracChangeset
for help on using the changeset viewer.