Changeset 41811af in mainline for uspace/srv/hid/adb_mouse/adb_dev.c
- Timestamp:
- 2011-06-10T10:14:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab547063
- Parents:
- 9536e6e (diff), 390d80d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/adb_mouse/adb_dev.c
r9536e6e r41811af 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));
Note:
See TracChangeset
for help on using the changeset viewer.