Changes in uspace/srv/hid/adb_mouse/adb_dev.c [79ae36dd:ffa2c8ef] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/adb_mouse/adb_dev.c
r79ae36dd rffa2c8ef 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>46 41 47 42 #include "adb_mouse.h" … … 50 45 static void adb_dev_events(ipc_callid_t iid, ipc_call_t *icall); 51 46 47 static int dev_phone; 48 52 49 int adb_dev_init(void) 53 50 { 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; 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; 61 60 } 62 63 int dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING);61 62 dev_phone = fd_phone(input_fd); 64 63 if (dev_phone < 0) { 65 printf( "%s: Failed connecting to ADB\n", NAME);66 return ENOENT;64 printf(NAME ": Failed to connect to device\n"); 65 return false; 67 66 } 68 67 69 68 /* NB: The callback connection is slotted for removal */ 70 if (async_ obsolete_connect_to_me(dev_phone, 0, 0, 0, adb_dev_events) != 0) {69 if (async_connect_to_me(dev_phone, 0, 0, 0, adb_dev_events) != 0) { 71 70 printf(NAME ": Failed to create callback from device\n"); 72 71 return false; … … 85 84 86 85 int retval; 87 88 if (!IPC_GET_IMETHOD(call)) { 86 87 switch (IPC_GET_IMETHOD(call)) { 88 case IPC_M_PHONE_HUNGUP: 89 89 /* TODO: Handle hangup */ 90 90 return; 91 }92 93 switch (IPC_GET_IMETHOD(call)) {94 91 case IPC_FIRST_USER_METHOD: 95 92 mouse_handle_data(IPC_GET_ARG1(call));
Note:
See TracChangeset
for help on using the changeset viewer.