Changeset e1e4192 in mainline for uspace/srv/hid/input/ctl/kbdev.c
- Timestamp:
- 2012-06-03T20:45:58Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 90478727
- Parents:
- f7e69f5 (diff), 3123d2a (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/input/ctl/kbdev.c
rf7e69f5 re1e4192 68 68 /** Link to generic keyboard device */ 69 69 kbd_dev_t *kbd_dev; 70 70 71 71 /** Session with kbdev device */ 72 72 async_sess_t *sess; … … 75 75 static kbdev_t *kbdev_new(kbd_dev_t *kdev) 76 76 { 77 kbdev_t *kbdev; 78 79 kbdev = calloc(1, sizeof(kbdev_t)); 77 kbdev_t *kbdev = calloc(1, sizeof(kbdev_t)); 80 78 if (kbdev == NULL) 81 79 return NULL; 82 80 83 81 kbdev->kbd_dev = kdev; 84 82 … … 90 88 if (kbdev->sess != NULL) 91 89 async_hangup(kbdev->sess); 90 92 91 free(kbdev); 93 92 } … … 95 94 static int kbdev_ctl_init(kbd_dev_t *kdev) 96 95 { 97 async_sess_t *sess; 98 async_exch_t *exch; 99 kbdev_t *kbdev; 100 int rc; 101 102 sess = loc_service_connect(EXCHANGE_SERIALIZE, kdev->svc_id, 0); 96 async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, 97 kdev->svc_id, 0); 103 98 if (sess == NULL) { 104 99 printf("%s: Failed starting session with '%s.'\n", NAME, 105 100 kdev->svc_name); 106 return -1;101 return ENOENT; 107 102 } 108 109 kbdev = kbdev_new(kdev);103 104 kbdev_t *kbdev = kbdev_new(kdev); 110 105 if (kbdev == NULL) { 111 106 printf("%s: Failed allocating device structure for '%s'.\n", 112 107 NAME, kdev->svc_name); 113 108 async_hangup(sess); 114 return -1;109 return ENOMEM; 115 110 } 116 111 117 112 kbdev->sess = sess; 118 119 exch = async_exchange_begin(sess);113 114 async_exch_t *exch = async_exchange_begin(sess); 120 115 if (exch == NULL) { 121 116 printf("%s: Failed starting exchange with '%s'.\n", NAME, 122 117 kdev->svc_name); 123 118 kbdev_destroy(kbdev); 124 return -1;119 return ENOENT; 125 120 } 126 127 rc = async_connect_to_me(exch, 0, 0, 0, kbdev_callback_conn, kbdev);121 122 int rc = async_connect_to_me(exch, 0, 0, 0, kbdev_callback_conn, kbdev); 128 123 if (rc != EOK) { 129 124 printf("%s: Failed creating callback connection from '%s'.\n", … … 131 126 async_exchange_end(exch); 132 127 kbdev_destroy(kbdev); 133 return -1;128 return rc; 134 129 } 135 130 136 131 async_exchange_end(exch); 137 132 138 133 kdev->ctl_private = (void *) kbdev; 139 134 return 0; … … 142 137 static void kbdev_ctl_set_ind(kbd_dev_t *kdev, unsigned mods) 143 138 { 144 async_sess_t *sess; 145 async_exch_t *exch; 146 147 sess = ((kbdev_t *) kdev->ctl_private)->sess; 148 149 exch = async_exchange_begin(sess); 139 async_sess_t *sess = ((kbdev_t *) kdev->ctl_private)->sess; 140 async_exch_t *exch = async_exchange_begin(sess); 150 141 if (!exch) 151 142 return; 152 143 153 144 async_msg_1(exch, KBDEV_SET_IND, mods); 154 145 async_exchange_end(exch);
Note:
See TracChangeset
for help on using the changeset viewer.