Changes in uspace/srv/hid/kbd/port/adb.c [79ae36dd:4f14e1f8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/kbd/port/adb.c
r79ae36dd r4f14e1f8 30 30 * @ingroup kbd 31 31 * @{ 32 */ 32 */ 33 33 /** @file 34 34 * @brief ADB keyboard port driver. … … 37 37 #include <ipc/adb.h> 38 38 #include <async.h> 39 #include <async_obsolete.h>40 39 #include <kbd_port.h> 41 40 #include <kbd.h> … … 43 42 #include <fcntl.h> 44 43 #include <errno.h> 45 #include <devmap.h>46 #include <devmap_obsolete.h>47 44 48 45 static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall); … … 55 52 int kbd_port_init(void) 56 53 { 57 const char *dev = "adb/kbd"; 58 devmap_handle_t handle; 59 60 int rc = devmap_device_get_handle(dev, &handle, 0); 61 if (rc == EOK) { 62 dev_phone = devmap_obsolete_device_connect(handle, 0); 63 if (dev_phone < 0) { 64 printf("%s: Failed to connect to device\n", NAME); 65 return dev_phone; 66 } 67 } else 68 return rc; 69 54 const char *input = "/dev/adb/kbd"; 55 int input_fd; 56 57 printf(NAME ": open %s\n", input); 58 59 input_fd = open(input, O_RDONLY); 60 if (input_fd < 0) { 61 printf(NAME ": Failed opening %s (%d)\n", input, input_fd); 62 return false; 63 } 64 65 dev_phone = fd_phone(input_fd); 66 if (dev_phone < 0) { 67 printf(NAME ": Failed to connect to device\n"); 68 return false; 69 } 70 70 71 /* NB: The callback connection is slotted for removal */ 71 rc = async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events); 72 if (rc != EOK) { 72 if (async_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) { 73 73 printf(NAME ": Failed to create callback from device\n"); 74 return rc;74 return false; 75 75 } 76 77 return EOK;76 77 return 0; 78 78 } 79 79 … … 100 100 101 101 int retval; 102 103 if (!IPC_GET_IMETHOD(call)) { 102 103 switch (IPC_GET_IMETHOD(call)) { 104 case IPC_M_PHONE_HUNGUP: 104 105 /* TODO: Handle hangup */ 105 106 return; 106 }107 108 switch (IPC_GET_IMETHOD(call)) {109 107 case ADB_REG_NOTIF: 110 108 adb_kbd_reg0_data(IPC_GET_ARG1(call));
Note:
See TracChangeset
for help on using the changeset viewer.