Changeset 79ae36dd in mainline for uspace/srv/hid/adb_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/adb_mouse
- Files:
-
- 2 edited
-
adb_dev.c (modified) (3 diffs)
-
adb_mouse.c (modified) (5 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
Note:
See TracChangeset
for help on using the changeset viewer.
