Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/hid/usbhid/kbd/kbddev.c

    rb7fd2a0 r5a6cc679  
    185185                if (kbd_dev->client_sess == NULL) {
    186186                        kbd_dev->client_sess = sess;
    187                         usb_log_debug("%s: OK\n", __FUNCTION__);
     187                        usb_log_debug("%s: OK", __FUNCTION__);
    188188                        async_answer_0(icallid, EOK);
    189189                } else {
    190                         usb_log_error("%s: console session already set\n",
     190                        usb_log_error("%s: console session already set",
    191191                           __FUNCTION__);
    192192                        async_answer_0(icallid, ELIMIT);
     
    195195        }
    196196        default:
    197                         usb_log_error("%s: Unknown method: %d.\n",
     197                        usb_log_error("%s: Unknown method: %d.",
    198198                            __FUNCTION__, (int) method);
    199199                        async_answer_0(icallid, EINVAL);
     
    226226        /* Reset the LED data. */
    227227        memset(kbd_dev->led_data, 0, kbd_dev->led_output_size * sizeof(int32_t));
    228         usb_log_debug("Creating output report:\n");
     228        usb_log_debug("Creating output report:");
    229229
    230230        usb_hid_report_field_t *field = usb_hid_report_get_sibling(
     
    266266        }
    267267
    268         usb_log_debug("Output report buffer: %s\n",
     268        usb_log_debug("Output report buffer: %s",
    269269            usb_debug_str_buffer(kbd_dev->output_buffer, kbd_dev->output_size,
    270270                0));
     
    276276            kbd_dev->output_buffer, kbd_dev->output_size);
    277277        if (rc != EOK) {
    278                 usb_log_warning("Failed to set kbd indicators.\n");
     278                usb_log_warning("Failed to set kbd indicators.");
    279279        }
    280280}
     
    289289void usb_kbd_push_ev(usb_kbd_t *kbd_dev, int type, unsigned key)
    290290{
    291         usb_log_debug2("Sending kbdev event %d/%d to the console\n", type, key);
     291        usb_log_debug2("Sending kbdev event %d/%d to the console", type, key);
    292292        if (kbd_dev->client_sess == NULL) {
    293293                usb_log_warning(
     
    301301                async_exchange_end(exch);
    302302        } else {
    303                 usb_log_warning("Failed to send key to console.\n");
     303                usb_log_warning("Failed to send key to console.");
    304304        }
    305305}
     
    328328 * An event is created only when key is pressed or released. Besides handling
    329329 * the events (usb_kbd_push_ev()), the auto-repeat fibril is notified about
    330  * key presses and releases (see usb_kbd_repeat_start() and 
     330 * key presses and releases (see usb_kbd_repeat_start() and
    331331 * usb_kbd_repeat_stop()).
    332332 *
    333333 * @param kbd_dev Keyboard device structure.
    334  * @param key_codes Parsed keyboard report - codes of currently pressed keys 
     334 * @param key_codes Parsed keyboard report - codes of currently pressed keys
    335335 *                  according to HID Usage Tables.
    336336 * @param count Number of key codes in report (size of the report).
     
    353353            kbd_dev->key_count);
    354354        if (i != (size_t) -1) {
    355                 usb_log_error("Detected phantom state.\n");
     355                usb_log_error("Detected phantom state.");
    356356                return;
    357357        }
     
    403403        ddf_dump_buffer(key_buffer, 512,
    404404            kbd_dev->keys_old, 4, kbd_dev->key_count, 0);
    405         usb_log_debug2("Stored keys %s.\n", key_buffer);
     405        usb_log_debug2("Stored keys %s.", key_buffer);
    406406}
    407407
     
    431431        usb_hid_report_path_t *path = usb_hid_report_path();
    432432        if (path == NULL) {
    433                 usb_log_error("Failed to create hid/kbd report path.\n");
     433                usb_log_error("Failed to create hid/kbd report path.");
    434434                return;
    435435        }
     
    438438           usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
    439439        if (ret != EOK) {
    440                 usb_log_error("Failed to append to hid/kbd report path.\n");
     440                usb_log_error("Failed to append to hid/kbd report path.");
    441441                return;
    442442        }
     
    452452
    453453        while (field != NULL) {
    454                 usb_log_debug2("FIELD (%p) - VALUE(%d) USAGE(%u)\n",
     454                usb_log_debug2("FIELD (%p) - VALUE(%d) USAGE(%u)",
    455455                    field, field->value, field->usage);
    456456
     
    464464                        kbd_dev->keys[i] = 0;
    465465                }
    466                 usb_log_debug2("Saved %u. key usage %d\n", i, kbd_dev->keys[i]);
     466                usb_log_debug2("Saved %u. key usage %d", i, kbd_dev->keys[i]);
    467467
    468468                ++i;
     
    502502        usb_hid_report_path_t *path = usb_hid_report_path();
    503503        if (path == NULL) {
    504                 usb_log_error("Failed to create kbd report path.\n");
     504                usb_log_error("Failed to create kbd report path.");
    505505                usb_kbd_destroy(kbd_dev);
    506506                return ENOMEM;
     
    510510            usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
    511511        if (ret != EOK) {
    512                 usb_log_error("Failed to append item to kbd report path.\n");
     512                usb_log_error("Failed to append item to kbd report path.");
    513513                usb_hid_report_path_free(path);
    514514                usb_kbd_destroy(kbd_dev);
     
    523523        usb_hid_report_path_free(path);
    524524
    525         usb_log_debug("Size of the input report: %zu\n", kbd_dev->key_count);
     525        usb_log_debug("Size of the input report: %zu", kbd_dev->key_count);
    526526
    527527        kbd_dev->keys = calloc(kbd_dev->key_count, sizeof(int32_t));
    528528        if (kbd_dev->keys == NULL) {
    529                 usb_log_error("Failed to allocate key buffer.\n");
     529                usb_log_error("Failed to allocate key buffer.");
    530530                usb_kbd_destroy(kbd_dev);
    531531                return ENOMEM;
     
    534534        kbd_dev->keys_old = calloc(kbd_dev->key_count, sizeof(int32_t));
    535535        if (kbd_dev->keys_old == NULL) {
    536                 usb_log_error("Failed to allocate old_key buffer.\n");
     536                usb_log_error("Failed to allocate old_key buffer.");
    537537                usb_kbd_destroy(kbd_dev);
    538538                return ENOMEM;
     
    544544            &kbd_dev->output_size, 0);
    545545        if (kbd_dev->output_buffer == NULL) {
    546                 usb_log_error("Error creating output report buffer.\n");
     546                usb_log_error("Error creating output report buffer.");
    547547                usb_kbd_destroy(kbd_dev);
    548548                return ENOMEM;
    549549        }
    550550
    551         usb_log_debug("Output buffer size: %zu\n", kbd_dev->output_size);
     551        usb_log_debug("Output buffer size: %zu", kbd_dev->output_size);
    552552
    553553        kbd_dev->led_path = usb_hid_report_path();
    554554        if (kbd_dev->led_path == NULL) {
    555                 usb_log_error("Failed to create kbd led report path.\n");
     555                usb_log_error("Failed to create kbd led report path.");
    556556                usb_kbd_destroy(kbd_dev);
    557557                return ENOMEM;
     
    561561            kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0);
    562562        if (ret != EOK) {
    563                 usb_log_error("Failed to append to kbd/led report path.\n");
     563                usb_log_error("Failed to append to kbd/led report path.");
    564564                usb_kbd_destroy(kbd_dev);
    565565                return ret;
     
    569569            &hid_dev->report, 0, USB_HID_REPORT_TYPE_OUTPUT);
    570570
    571         usb_log_debug("Output report size (in items): %zu\n",
     571        usb_log_debug("Output report size (in items): %zu",
    572572            kbd_dev->led_output_size);
    573573
    574574        kbd_dev->led_data = calloc(kbd_dev->led_output_size, sizeof(int32_t));
    575575        if (kbd_dev->led_data == NULL) {
    576                 usb_log_error("Error creating buffer for LED output report.\n");
     576                usb_log_error("Error creating buffer for LED output report.");
    577577                usb_kbd_destroy(kbd_dev);
    578578                return ENOMEM;
     
    588588
    589589        kbd_dev->initialized = USB_KBD_STATUS_INITIALIZED;
    590         usb_log_debug("HID/KBD device structure initialized.\n");
     590        usb_log_debug("HID/KBD device structure initialized.");
    591591
    592592        return EOK;
     
    618618errno_t usb_kbd_init(usb_hid_dev_t *hid_dev, void **data)
    619619{
    620         usb_log_debug("Initializing HID/KBD structure...\n");
     620        usb_log_debug("Initializing HID/KBD structure...");
    621621
    622622        if (hid_dev == NULL) {
     
    627627
    628628        /* Create the exposed function. */
    629         usb_log_debug("Creating DDF function %s...\n", HID_KBD_FUN_NAME);
     629        usb_log_debug("Creating DDF function %s...", HID_KBD_FUN_NAME);
    630630        ddf_fun_t *fun = usb_device_ddf_fun_create(hid_dev->usb_dev,
    631631            fun_exposed, HID_KBD_FUN_NAME);
    632632        if (fun == NULL) {
    633                 usb_log_error("Could not create DDF function node.\n");
     633                usb_log_error("Could not create DDF function node.");
    634634                return ENOMEM;
    635635        }
     
    637637        usb_kbd_t *kbd_dev = ddf_fun_data_alloc(fun, sizeof(usb_kbd_t));
    638638        if (kbd_dev == NULL) {
    639                 usb_log_error("Failed to allocate KBD device structure.\n");
     639                usb_log_error("Failed to allocate KBD device structure.");
    640640                ddf_fun_destroy(fun);
    641641                return ENOMEM;
     
    644644        errno_t ret = kbd_dev_init(kbd_dev, hid_dev);
    645645        if (ret != EOK) {
    646                 usb_log_error("Failed to initialize KBD device  structure.\n");
     646                usb_log_error("Failed to initialize KBD device  structure.");
    647647                ddf_fun_destroy(fun);
    648648                return ret;
     
    655655        ret = ddf_fun_bind(fun);
    656656        if (ret != EOK) {
    657                 usb_log_error("Could not bind DDF function: %s.\n",
     657                usb_log_error("Could not bind DDF function: %s.",
    658658                    str_error(ret));
    659659                usb_kbd_destroy(kbd_dev);
     
    662662        }
    663663
    664         usb_log_debug("%s function created. Handle: %" PRIun "\n",
     664        usb_log_debug("%s function created. Handle: %" PRIun "",
    665665            HID_KBD_FUN_NAME, ddf_fun_get_handle(fun));
    666666
    667         usb_log_debug("Adding DDF function to category %s...\n",
     667        usb_log_debug("Adding DDF function to category %s...",
    668668            HID_KBD_CATEGORY_NAME);
    669669        ret = ddf_fun_add_to_category(fun, HID_KBD_CATEGORY_NAME);
     
    709709        usb_kbd_process_data(hid_dev, kbd_dev);
    710710
     711        /* Continue polling until the device is about to be removed. */
    711712        return true;
    712713}
     
    752753        if (kbd_dev->fun) {
    753754                if (ddf_fun_unbind(kbd_dev->fun) != EOK) {
    754                         usb_log_warning("Failed to unbind %s.\n",
     755                        usb_log_warning("Failed to unbind %s.",
    755756                            ddf_fun_get_name(kbd_dev->fun));
    756757                } else {
    757                         usb_log_debug2("%s unbound.\n",
     758                        usb_log_debug2("%s unbound.",
    758759                            ddf_fun_get_name(kbd_dev->fun));
    759760                        ddf_fun_destroy(kbd_dev->fun);
     
    783784
    784785        if (rc != EOK) {
    785                 usb_log_error("Failed to parse boot report descriptor: %s\n",
     786                usb_log_error("Failed to parse boot report descriptor: %s",
    786787                    str_error(rc));
    787788                return rc;
Note: See TracChangeset for help on using the changeset viewer.