Changes in uspace/drv/char/xtkbd/xtkbd.c [75751db6:56fd7cf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/xtkbd/xtkbd.c
r75751db6 r56fd7cf 36 36 #include <ddf/log.h> 37 37 #include <io/keycode.h> 38 #include <io/chardev.h>39 38 #include <io/console.h> 40 39 #include <ipc/kbdev.h> 41 40 #include <abi/ipc/methods.h> 42 41 42 #include "chardev.h" 43 43 #include "xtkbd.h" 44 44 … … 159 159 static const int scanmap_e0[] = { 160 160 [0x38] = KC_RALT, 161 [0x1d] = KC_R CTRL,161 [0x1d] = KC_RSHIFT, 162 162 163 163 [0x37] = KC_PRTSCR, … … 199 199 * @param dev DDF device structure. 200 200 * 201 * Connects to parent, creates keyboardfunction, starts polling fibril.201 * Connects to parent, creates mouse function, starts polling fibril. 202 202 */ 203 203 int xt_kbd_init(xt_kbd_t *kbd, ddf_dev_t *dev) … … 207 207 kbd->client_sess = NULL; 208 208 kbd->parent_sess = ddf_dev_parent_sess_create(dev, EXCHANGE_SERIALIZE); 209 if (!kbd->parent_sess) { 210 ddf_msg(LVL_ERROR, "Failed creating parent session."); 211 return EIO; 212 } 209 if (!kbd->parent_sess) 210 return ENOMEM; 213 211 214 212 kbd->kbd_fun = ddf_fun_create(dev, fun_exposed, "kbd"); 215 213 if (!kbd->kbd_fun) { 216 ddf_msg(LVL_ERROR, "Failed creating function 'kbd'.");217 214 return ENOMEM; 218 215 } … … 221 218 int ret = ddf_fun_bind(kbd->kbd_fun); 222 219 if (ret != EOK) { 223 ddf_msg(LVL_ERROR, "Failed binding function 'kbd'.");224 220 ddf_fun_destroy(kbd->kbd_fun); 225 return E EXIST;221 return ENOMEM; 226 222 } 227 223 228 224 ret = ddf_fun_add_to_category(kbd->kbd_fun, "keyboard"); 229 225 if (ret != EOK) { 230 ddf_msg(LVL_ERROR, "Failed adding function 'kbd' to category "231 "'keyboard'.");232 226 ddf_fun_unbind(kbd->kbd_fun); 233 227 ddf_fun_destroy(kbd->kbd_fun); … … 237 231 kbd->polling_fibril = fibril_create(polling, kbd); 238 232 if (!kbd->polling_fibril) { 239 ddf_msg(LVL_ERROR, "Failed creating polling fibril.");240 233 ddf_fun_unbind(kbd->kbd_fun); 241 234 ddf_fun_destroy(kbd->kbd_fun); 242 235 return ENOMEM; 243 236 } 244 245 237 fibril_add_ready(kbd->polling_fibril); 246 238 return EOK; … … 249 241 /** Get data and parse scancodes. 250 242 * @param arg Pointer to xt_kbd_t structure. 251 * @return EIO on error.243 * @return Never. 252 244 */ 253 245 int polling(void *arg) … … 267 259 uint8_t code = 0; 268 260 ssize_t size = chardev_read(parent_exch, &code, 1); 269 if (size != 1)270 return EIO;271 261 272 262 /** Ignore AT command reply */ … … 279 269 map_size = sizeof(scanmap_e0) / sizeof(int); 280 270 size = chardev_read(parent_exch, &code, 1); 281 if (size != 1)282 return EIO;283 284 271 // TODO handle print screen 285 272 } 273 274 /* Invalid read. */ 275 if (size != 1) { 276 continue; 277 } 278 286 279 287 280 /* Bit 7 indicates press/release */
Note:
See TracChangeset
for help on using the changeset viewer.