Changeset 41811af in mainline for uspace/srv/hid/kbd/port/adb.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/kbd/port/adb.c
r9536e6e r41811af 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> 39 40 #include <kbd_port.h> 40 41 #include <kbd.h> … … 42 43 #include <fcntl.h> 43 44 #include <errno.h> 45 #include <devmap.h> 46 #include <devmap_obsolete.h> 44 47 45 48 static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall); … … 52 55 int kbd_port_init(void) 53 56 { 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; 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 70 /* 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) { 73 printf(NAME ": Failed to create callback from device\n"); 74 return rc; 63 75 } 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 71 /* NB: The callback connection is slotted for removal */ 72 if (async_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) { 73 printf(NAME ": Failed to create callback from device\n"); 74 return false; 75 } 76 77 return 0; 76 77 return EOK; 78 78 } 79 79 … … 100 100 101 101 int retval; 102 103 switch (IPC_GET_IMETHOD(call)) { 104 case IPC_M_PHONE_HUNGUP: 102 103 if (!IPC_GET_IMETHOD(call)) { 105 104 /* TODO: Handle hangup */ 106 105 return; 106 } 107 108 switch (IPC_GET_IMETHOD(call)) { 107 109 case ADB_REG_NOTIF: 108 110 adb_kbd_reg0_data(IPC_GET_ARG1(call));
Note:
See TracChangeset
for help on using the changeset viewer.