source: mainline/uspace/drv/usbhid/main.c@ dde2c90

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since dde2c90 was eb1a2f4, checked in by Vojtech Horky <vojtechhorky@…>, 15 years ago

Merge mainline changes (DDF refactoring)

This merge includes DDF refactoring that brought multifunctional devices
(i.e. ddf_dev_t and ddf_fun_t). Please, see ticket #295 at HelenOS
upstream Trac.

The conflicts themselves were easy to solve (merely several renamings).

Changes to USB subsystem:

  • drivers uses ddf_dev_t and ddf_fun_t
  • different signatures of many library functions
  • several hacks around communication with parent device (now the communication is clearer and somehow what we have now is hack about other hacks)
    • will repair and clean later
  • maybe added some extra debugging messages (the diff has about 240K, and I admit I have no energy to double check that)

WARNING:

  • the diff is VERY long, recommended is viewing partial diffs of the merge (i.e. merges in mainline branch that lead to the parent one)
  • merging with your branches might involve huge renamings, sorry, no other way is possible

BUGS:

  • hub driver will not work (no function created)

GOOD NEWS:

  • QEMU keyboard seems to work with QEMU 0.13 and 0.14
  • we are up-to-date with mainline again
  • Property mode set to 100644
File size: 15.1 KB
RevLine 
[c7137738]1/*
2 * Copyright (c) 2010 Vojtech Horky
[1c13dac]3 * Copyright (c) 2011 Lubos Slovak
[c7137738]4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
[1c13dac]29
[ba54451]30/** @addtogroup drvusbhid
31 * @{
32 */
[1c13dac]33/**
34 * @file
35 * Main routines of USB HID driver.
36 */
37
[eb1a2f4]38#include <ddf/driver.h>
[2e15ac40]39#include <ipc/driver.h>
[700af62]40#include <ipc/kbd.h>
41#include <io/keycode.h>
42#include <io/console.h>
[c7137738]43#include <errno.h>
[707ffcf]44#include <str_error.h>
[2e15ac40]45#include <fibril.h>
[b43bcf1]46#include <usb/debug.h>
47#include <usb/classes/classes.h>
[2e15ac40]48#include <usb/classes/hid.h>
[243cb86]49#include <usb/classes/hidparser.h>
[03197ffc]50#include <usb/request.h>
[dafab9e0]51#include <usb/descriptor.h>
[6336b6e]52#include <io/console.h>
[54b5625]53#include "hid.h"
[ca038b4]54#include "descparser.h"
[45019865]55#include "descdump.h"
[6336b6e]56#include "conv.h"
[7c169ce]57#include "layout.h"
[c7137738]58
[2899980]59#define BUFFER_SIZE 8
[66d5062]60#define NAME "usbhid"
[2e15ac40]61
[1b29d6fa]62#define GUESSED_POLL_ENDPOINT 1
[2e15ac40]63
[b43bcf1]64/** Keyboard polling endpoint description for boot protocol class. */
65static usb_endpoint_description_t poll_endpoint_description = {
66 .transfer_type = USB_TRANSFER_INTERRUPT,
67 .direction = USB_DIRECTION_IN,
68 .interface_class = USB_CLASS_HID,
69 .interface_subclass = USB_HID_SUBCLASS_BOOT,
70 .interface_protocol = USB_HID_PROTOCOL_KEYBOARD,
71 .flags = 0
72};
73
[eb1a2f4]74static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
75static ddf_dev_ops_t keyboard_ops = {
[700af62]76 .default_handler = default_connection_handler
77};
78
79static int console_callback_phone = -1;
80
81/** Default handler for IPC methods not handled by DDF.
82 *
83 * @param dev Device handling the call.
84 * @param icallid Call id.
85 * @param icall Call data.
86 */
[eb1a2f4]87void default_connection_handler(ddf_fun_t *fun,
[700af62]88 ipc_callid_t icallid, ipc_call_t *icall)
89{
90 sysarg_t method = IPC_GET_IMETHOD(*icall);
91
92 if (method == IPC_M_CONNECT_TO_ME) {
93 int callback = IPC_GET_ARG5(*icall);
94
95 if (console_callback_phone != -1) {
[17aca1c]96 async_answer_0(icallid, ELIMIT);
[700af62]97 return;
98 }
99
100 console_callback_phone = callback;
[17aca1c]101 async_answer_0(icallid, EOK);
[700af62]102 return;
103 }
104
[17aca1c]105 async_answer_0(icallid, EINVAL);
[700af62]106}
107
[38c5dfa]108#if 0
[700af62]109static void send_key(int key, int type, wchar_t c) {
110 async_msg_4(console_callback_phone, KBD_EVENT, type, key,
111 KM_NUM_LOCK, c);
112}
[38c5dfa]113#endif
[700af62]114
[6336b6e]115/*
116 * TODO: Move somewhere else
117 */
118/*
119#define BYTES_PER_LINE 12
120
121static void dump_buffer(const char *msg, const uint8_t *buffer, size_t length)
122{
123 printf("%s\n", msg);
124
125 size_t i;
126 for (i = 0; i < length; i++) {
127 printf(" 0x%02X", buffer[i]);
128 if (((i > 0) && (((i+1) % BYTES_PER_LINE) == 0))
129 || (i + 1 == length)) {
130 printf("\n");
131 }
132 }
133}
134*/
135/*
136 * Copy-paste from srv/hid/kbd/generic/kbd.c
137 */
138
139/** Currently active modifiers.
140 *
141 * TODO: put to device?
142 */
143static unsigned mods = KM_NUM_LOCK;
144
145/** Currently pressed lock keys. We track these to tackle autorepeat.
146 *
147 * TODO: put to device?
148 */
149static unsigned lock_keys;
150
[7c169ce]151#define NUM_LAYOUTS 3
152
153static layout_op_t *layout[NUM_LAYOUTS] = {
154 &us_qwerty_op,
155 &us_dvorak_op,
156 &cz_op
157};
158
159static int active_layout = 0;
[6336b6e]160
161static void kbd_push_ev(int type, unsigned int key)
162{
163 console_event_t ev;
164 unsigned mod_mask;
165
166 // TODO: replace by our own parsing?? or are the key codes identical??
167 switch (key) {
168 case KC_LCTRL: mod_mask = KM_LCTRL; break;
169 case KC_RCTRL: mod_mask = KM_RCTRL; break;
170 case KC_LSHIFT: mod_mask = KM_LSHIFT; break;
171 case KC_RSHIFT: mod_mask = KM_RSHIFT; break;
172 case KC_LALT: mod_mask = KM_LALT; break;
173 case KC_RALT: mod_mask = KM_RALT; break;
174 default: mod_mask = 0; break;
175 }
176
177 if (mod_mask != 0) {
178 if (type == KEY_PRESS)
179 mods = mods | mod_mask;
180 else
181 mods = mods & ~mod_mask;
182 }
183
184 switch (key) {
185 case KC_CAPS_LOCK: mod_mask = KM_CAPS_LOCK; break;
186 case KC_NUM_LOCK: mod_mask = KM_NUM_LOCK; break;
187 case KC_SCROLL_LOCK: mod_mask = KM_SCROLL_LOCK; break;
188 default: mod_mask = 0; break;
189 }
190
191 if (mod_mask != 0) {
192 if (type == KEY_PRESS) {
193 /*
194 * Only change lock state on transition from released
195 * to pressed. This prevents autorepeat from messing
196 * up the lock state.
197 */
198 mods = mods ^ (mod_mask & ~lock_keys);
199 lock_keys = lock_keys | mod_mask;
200
201 /* Update keyboard lock indicator lights. */
202 // TODO
203 //kbd_ctl_set_ind(mods);
204 } else {
205 lock_keys = lock_keys & ~mod_mask;
206 }
207 }
208/*
209 printf("type: %d\n", type);
210 printf("mods: 0x%x\n", mods);
211 printf("keycode: %u\n", key);
212*/
[11797d5]213
[6336b6e]214 if (type == KEY_PRESS && (mods & KM_LCTRL) &&
215 key == KC_F1) {
216 active_layout = 0;
217 layout[active_layout]->reset();
218 return;
219 }
220
221 if (type == KEY_PRESS && (mods & KM_LCTRL) &&
222 key == KC_F2) {
223 active_layout = 1;
224 layout[active_layout]->reset();
225 return;
226 }
227
228 if (type == KEY_PRESS && (mods & KM_LCTRL) &&
229 key == KC_F3) {
230 active_layout = 2;
231 layout[active_layout]->reset();
232 return;
233 }
[11797d5]234
[6336b6e]235 ev.type = type;
236 ev.key = key;
237 ev.mods = mods;
238
[7c169ce]239 ev.c = layout[active_layout]->parse_ev(&ev);
[6336b6e]240
241 printf("Sending key %d to the console\n", ev.key);
242 assert(console_callback_phone != -1);
[7c169ce]243 async_msg_4(console_callback_phone, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c);
[6336b6e]244}
245/*
246 * End of copy-paste
247 */
248
249 /*
250 * TODO:
251 * 1) key press / key release - how does the keyboard notify about release?
252 * 2) layouts (use the already defined), not important now
253 * 3)
254 */
255
[243cb86]256/*
257 * Callbacks for parser
258 */
[0a9ea4a]259static void usbkbd_process_keycodes(const uint8_t *key_codes, size_t count,
[11797d5]260 uint8_t modifiers, void *arg)
[91db50ac]261{
[692f13e4]262 printf("Got keys: ");
263 unsigned i;
264 for (i = 0; i < count; ++i) {
265 printf("%d ", key_codes[i]);
[c20da9f]266 }
267 printf("\n");
268
269 for (i = 0; i < count; ++i) {
[6336b6e]270 // TODO: Key press / release
271
272 // TODO: NOT WORKING
273 unsigned int key = usbkbd_parse_scancode(key_codes[i]);
[c20da9f]274
275 if (key == 0) {
276 continue;
277 }
[6336b6e]278 kbd_push_ev(KEY_PRESS, key);
[692f13e4]279 }
280 printf("\n");
[243cb86]281}
[0e126be7]282
[243cb86]283/*
284 * Kbd functions
285 */
[6986418]286static int usbkbd_get_report_descriptor(usb_hid_dev_kbd_t *kbd_dev)
287{
288 // iterate over all configurations and interfaces
289 // TODO: more configurations!!
290 unsigned i;
291 for (i = 0; i < kbd_dev->conf->config_descriptor.interface_count; ++i) {
292 // TODO: endianness
293 uint16_t length =
294 kbd_dev->conf->interfaces[i].hid_desc.report_desc_info.length;
[45019865]295 size_t actual_size = 0;
[6986418]296
297 // allocate space for the report descriptor
298 kbd_dev->conf->interfaces[i].report_desc = (uint8_t *)malloc(length);
299
[45019865]300 // get the descriptor from the device
[03197ffc]301 int rc = usb_request_get_descriptor(&kbd_dev->ctrl_pipe,
302 USB_REQUEST_TYPE_CLASS, USB_DESCTYPE_HID_REPORT,
303 i, 0,
304 kbd_dev->conf->interfaces[i].report_desc, length,
[45019865]305 &actual_size);
306
307 if (rc != EOK) {
308 return rc;
309 }
310
311 assert(actual_size == length);
312
[fbddf94]313 //dump_hid_class_descriptor(0, USB_DESCTYPE_HID_REPORT,
314 // kbd_dev->conf->interfaces[i].report_desc, length);
[6986418]315 }
[45019865]316
317 return EOK;
[6986418]318}
[ca038b4]319static int usbkbd_process_descriptors(usb_hid_dev_kbd_t *kbd_dev)
[243cb86]320{
[ca038b4]321 // get the first configuration descriptor (TODO: parse also other!)
[dafab9e0]322 usb_standard_configuration_descriptor_t config_desc;
323
[03197ffc]324 int rc;
325 rc = usb_request_get_bare_configuration_descriptor(&kbd_dev->ctrl_pipe,
326 0, &config_desc);
[dafab9e0]327
328 if (rc != EOK) {
329 return rc;
330 }
331
332 // prepare space for all underlying descriptors
333 uint8_t *descriptors = (uint8_t *)malloc(config_desc.total_length);
334 if (descriptors == NULL) {
335 return ENOMEM;
336 }
337
338 size_t transferred = 0;
339 // get full configuration descriptor
[03197ffc]340 rc = usb_request_get_full_configuration_descriptor(&kbd_dev->ctrl_pipe,
341 0, descriptors,
[dafab9e0]342 config_desc.total_length, &transferred);
343
[91db50ac]344 if (rc != EOK) {
[243cb86]345 return rc;
[91db50ac]346 }
[dafab9e0]347 if (transferred != config_desc.total_length) {
348 return ELIMIT;
349 }
350
[b43bcf1]351 /*
352 * Initialize the interrupt in endpoint.
353 */
354 usb_endpoint_mapping_t endpoint_mapping[1] = {
355 {
356 .pipe = &kbd_dev->poll_pipe,
[5c3ace2]357 .description = &poll_endpoint_description,
358 .interface_no =
359 usb_device_get_assigned_interface(kbd_dev->device)
[b43bcf1]360 }
361 };
362 rc = usb_endpoint_pipe_initialize_from_configuration(
363 endpoint_mapping, 1,
364 descriptors, config_desc.total_length,
365 &kbd_dev->wire);
366 if (rc != EOK) {
367 usb_log_error("Failed to initialize poll pipe: %s.\n",
368 str_error(rc));
369 return rc;
370 }
371 if (!endpoint_mapping[0].present) {
372 usb_log_warning("Not accepting device, " \
373 "not boot-protocol keyboard.\n");
374 return EREFUSED;
375 }
376
377
378
379
[ca038b4]380 kbd_dev->conf = (usb_hid_configuration_t *)calloc(1,
381 sizeof(usb_hid_configuration_t));
382 if (kbd_dev->conf == NULL) {
383 free(descriptors);
384 return ENOMEM;
385 }
386
[b43bcf1]387 /*rc = usbkbd_parse_descriptors(descriptors, transferred, kbd_dev->conf);
[dafab9e0]388 free(descriptors);
[45019865]389 if (rc != EOK) {
390 printf("Problem with parsing standard descriptors.\n");
391 return rc;
392 }
[6986418]393
[b43bcf1]394 // get and report descriptors*/
[6986418]395 rc = usbkbd_get_report_descriptor(kbd_dev);
[45019865]396 if (rc != EOK) {
397 printf("Problem with parsing HID REPORT descriptor.\n");
398 return rc;
399 }
[243cb86]400
[76cb03c]401 //usbkbd_print_config(kbd_dev->conf);
[0a9ea4a]402
403 /*
404 * TODO:
405 * 1) select one configuration (lets say the first)
406 * 2) how many interfaces?? how to select one??
407 * ("The default setting for an interface is always alternate setting zero.")
408 * 3) find endpoint which is IN and INTERRUPT (parse), save its number
409 * as the endpoint for polling
410 */
[b43bcf1]411
[45019865]412 return EOK;
[243cb86]413}
[03197ffc]414
[eb1a2f4]415static usb_hid_dev_kbd_t *usbkbd_init_device(ddf_dev_t *dev)
[2e15ac40]416{
[03197ffc]417 int rc;
418
[ca038b4]419 usb_hid_dev_kbd_t *kbd_dev = (usb_hid_dev_kbd_t *)calloc(1,
420 sizeof(usb_hid_dev_kbd_t));
[2e15ac40]421
422 if (kbd_dev == NULL) {
423 fprintf(stderr, NAME ": No memory!\n");
424 return NULL;
425 }
426
427 kbd_dev->device = dev;
428
[707ffcf]429 /*
430 * Initialize the backing connection to the host controller.
431 */
[23c7f4d]432 rc = usb_device_connection_initialize_from_device(&kbd_dev->wire, dev);
[707ffcf]433 if (rc != EOK) {
434 printf("Problem initializing connection to device: %s.\n",
435 str_error(rc));
436 goto error_leave;
437 }
438
439 /*
440 * Initialize device pipes.
441 */
[03197ffc]442 rc = usb_endpoint_pipe_initialize_default_control(&kbd_dev->ctrl_pipe,
443 &kbd_dev->wire);
444 if (rc != EOK) {
445 printf("Failed to initialize default control pipe: %s.\n",
446 str_error(rc));
447 goto error_leave;
448 }
449
450 /*
451 * will need all descriptors:
452 * 1) choose one configuration from configuration descriptors
453 * (set it to the device)
454 * 2) set endpoints from endpoint descriptors
455 */
456
457 // TODO: get descriptors, parse descriptors and save endpoints
458 usb_endpoint_pipe_start_session(&kbd_dev->ctrl_pipe);
459 //usb_request_set_configuration(&kbd_dev->ctrl_pipe, 1);
[b43bcf1]460 rc = usbkbd_process_descriptors(kbd_dev);
[03197ffc]461 usb_endpoint_pipe_end_session(&kbd_dev->ctrl_pipe);
[b43bcf1]462 if (rc != EOK) {
463 goto error_leave;
464 }
[707ffcf]465
[2e15ac40]466 return kbd_dev;
[707ffcf]467
468error_leave:
469 free(kbd_dev);
470 return NULL;
[2e15ac40]471}
[91db50ac]472
[101ef25c]473static void usbkbd_process_interrupt_in(usb_hid_dev_kbd_t *kbd_dev,
[243cb86]474 uint8_t *buffer, size_t actual_size)
[101ef25c]475{
[243cb86]476 usb_hid_report_in_callbacks_t *callbacks =
477 (usb_hid_report_in_callbacks_t *)malloc(
478 sizeof(usb_hid_report_in_callbacks_t));
479 callbacks->keyboard = usbkbd_process_keycodes;
480
[0a9ea4a]481 //usb_hid_parse_report(kbd_dev->parser, buffer, actual_size, callbacks,
482 // NULL);
[c113056]483 printf("Calling usb_hid_boot_keyboard_input_report() with size %zu\n",
[7c169ce]484 actual_size);
485 //dump_buffer("bufffer: ", buffer, actual_size);
[6336b6e]486 int rc = usb_hid_boot_keyboard_input_report(buffer, actual_size, callbacks,
487 NULL);
488 if (rc != EOK) {
489 printf("Error in usb_hid_boot_keyboard_input_report(): %d\n", rc);
490 }
[101ef25c]491}
492
[2e15ac40]493static void usbkbd_poll_keyboard(usb_hid_dev_kbd_t *kbd_dev)
[91db50ac]494{
[707ffcf]495 int rc, sess_rc;
[243cb86]496 uint8_t buffer[BUFFER_SIZE];
[91db50ac]497 size_t actual_size;
[0e126be7]498
[6336b6e]499 printf("Polling keyboard...\n");
500
[101ef25c]501 while (true) {
[2899980]502 async_usleep(1000 * 10);
[101ef25c]503
[707ffcf]504 sess_rc = usb_endpoint_pipe_start_session(&kbd_dev->poll_pipe);
505 if (sess_rc != EOK) {
506 printf("Failed to start a session: %s.\n",
507 str_error(sess_rc));
[101ef25c]508 continue;
509 }
510
[707ffcf]511 rc = usb_endpoint_pipe_read(&kbd_dev->poll_pipe, buffer,
512 BUFFER_SIZE, &actual_size);
513 sess_rc = usb_endpoint_pipe_end_session(&kbd_dev->poll_pipe);
514
[101ef25c]515 if (rc != EOK) {
[707ffcf]516 printf("Error polling the keyboard: %s.\n",
517 str_error(rc));
518 continue;
519 }
520
521 if (sess_rc != EOK) {
522 printf("Error closing session: %s.\n",
523 str_error(sess_rc));
[101ef25c]524 continue;
525 }
526
527 /*
528 * If the keyboard answered with NAK, it returned no data.
529 * This implies that no change happened since last query.
530 */
531 if (actual_size == 0) {
[7c169ce]532 printf("Keyboard returned NAK\n");
[101ef25c]533 continue;
534 }
535
536 /*
537 * TODO: Process pressed keys.
538 */
[6336b6e]539 printf("Calling usbkbd_process_interrupt_in()\n");
[101ef25c]540 usbkbd_process_interrupt_in(kbd_dev, buffer, actual_size);
[91db50ac]541 }
542
[101ef25c]543 // not reached
544 assert(0);
[91db50ac]545}
546
[2e15ac40]547static int usbkbd_fibril_device(void *arg)
548{
549 printf("!!! USB device fibril\n");
550
551 if (arg == NULL) {
552 printf("No device!\n");
553 return -1;
554 }
555
[eb1a2f4]556 ddf_dev_t *dev = (ddf_dev_t *)arg;
[2e15ac40]557
558 // initialize device (get and process descriptors, get address, etc.)
559 usb_hid_dev_kbd_t *kbd_dev = usbkbd_init_device(dev);
[6336b6e]560 if (kbd_dev == NULL) {
561 printf("Error while initializing device.\n");
562 return -1;
563 }
[2e15ac40]564
565 usbkbd_poll_keyboard(kbd_dev);
566
567 return EOK;
568}
569
[eb1a2f4]570static int usbkbd_add_device(ddf_dev_t *dev)
[c7137738]571{
572 /* For now, fail immediately. */
[101ef25c]573 //return ENOTSUP;
[c7137738]574
575 /*
576 * When everything is okay, connect to "our" HC.
[2e15ac40]577 *
578 * Not supported yet, skip..
[c7137738]579 */
[71ed4849]580// int phone = usb_drv_hc_connect_auto(dev, 0);
[2e15ac40]581// if (phone < 0) {
582// /*
583// * Connecting to HC failed, roll-back and announce
584// * failure.
585// */
586// return phone;
587// }
[c7137738]588
[2e15ac40]589// dev->parent_phone = phone;
[91db50ac]590
[eb1a2f4]591 /*
592 * Create default function.
593 */
594 // FIXME - check for errors
595 ddf_fun_t *kbd_fun = ddf_fun_create(dev, fun_exposed, "keyboard");
596 assert(kbd_fun != NULL);
597 kbd_fun->ops = &keyboard_ops;
598
599 int rc = ddf_fun_bind(kbd_fun);
600 assert(rc == EOK);
601 rc = ddf_fun_add_to_class(kbd_fun, "keyboard");
602 assert(rc == EOK);
603
[91db50ac]604 /*
[2e15ac40]605 * Create new fibril for handling this keyboard
[91db50ac]606 */
[2e15ac40]607 fid_t fid = fibril_create(usbkbd_fibril_device, dev);
608 if (fid == 0) {
609 printf("%s: failed to start fibril for HID device\n", NAME);
610 return ENOMEM;
611 }
612 fibril_add_ready(fid);
[91db50ac]613
[eb1a2f4]614 //dev->ops = &keyboard_ops;
615 (void)keyboard_ops;
[700af62]616
[eb1a2f4]617 //add_device_to_class(dev, "keyboard");
[700af62]618
[c7137738]619 /*
620 * Hurrah, device is initialized.
621 */
622 return EOK;
623}
624
625static driver_ops_t kbd_driver_ops = {
[2e15ac40]626 .add_device = usbkbd_add_device,
[c7137738]627};
628
629static driver_t kbd_driver = {
[2e15ac40]630 .name = NAME,
[c7137738]631 .driver_ops = &kbd_driver_ops
632};
633
634int main(int argc, char *argv[])
635{
[b43bcf1]636 usb_log_enable(USB_LOG_LEVEL_INFO, "usbhid");
[eb1a2f4]637 return ddf_driver_main(&kbd_driver);
[c7137738]638}
[ba54451]639
640/**
641 * @}
642 */
Note: See TracBrowser for help on using the repository browser.