Changeset a40dea3 in mainline for uspace/srv/hid/input/port/adb.c
- Timestamp:
- 2011-06-20T20:04:39Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6a0ff7f4
- Parents:
- 5203e256
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/input/port/adb.c
r5203e256 ra40dea3 37 37 #include <ipc/adb.h> 38 38 #include <async.h> 39 #include <async_obsolete.h>40 39 #include <input.h> 41 40 #include <kbd_port.h> … … 45 44 #include <errno.h> 46 45 #include <devmap.h> 47 #include <devmap_obsolete.h>48 46 49 47 static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall, void *arg); … … 63 61 64 62 static kbd_dev_t *kbd_dev; 65 static int dev_phone;63 static async_sess_t *dev_sess; 66 64 67 65 static int adb_port_init(kbd_dev_t *kdev) … … 69 67 const char *dev = "adb/kbd"; 70 68 devmap_handle_t handle; 71 69 async_exch_t *exch; 70 int rc; 71 72 72 kbd_dev = kdev; 73 73 74 int rc = devmap_device_get_handle(dev, &handle, 0); 75 if (rc == EOK) { 76 dev_phone = devmap_obsolete_device_connect(handle, 0); 77 if (dev_phone < 0) { 78 printf("%s: Failed to connect to device\n", NAME); 79 return dev_phone; 80 } 81 } else 74 rc = devmap_device_get_handle(dev, &handle, 0); 75 if (rc != EOK) 82 76 return rc; 83 77 78 dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 0); 79 if (dev_sess == NULL) { 80 printf("%s: Failed to connect to device\n", NAME); 81 return ENOENT; 82 } 83 84 exch = async_exchange_begin(dev_sess); 85 if (exch == NULL) { 86 printf("%s: Failed starting exchange with device\n", NAME); 87 async_hangup(dev_sess); 88 return ENOMEM; 89 } 90 84 91 /* NB: The callback connection is slotted for removal */ 85 rc = async_ obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events,86 NULL);92 rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL); 93 async_exchange_end(exch); 87 94 if (rc != EOK) { 88 95 printf(NAME ": Failed to create callback from device\n"); 96 async_hangup(dev_sess); 89 97 return rc; 90 98 }
Note:
See TracChangeset
for help on using the changeset viewer.