Ignore:
Timestamp:
2018-01-15T17:04:34Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9ff99e8
Parents:
c1a966e
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-15 17:04:32)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-15 17:04:34)
Message:

usb: unified logging

Use logger instead of printf. Logger adds newlines automatically.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/hid/usbhid/mouse/mousedev.c

    rc1a966e ra1732929  
    118118
    119119        if (mouse_dev == NULL) {
    120                 usb_log_debug("%s: Missing parameters.\n", __FUNCTION__);
     120                usb_log_debug("%s: Missing parameters.", __FUNCTION__);
    121121                async_answer_0(icallid, EINVAL);
    122122                return;
    123123        }
    124124
    125         usb_log_debug("%s: fun->name: %s\n", __FUNCTION__, ddf_fun_get_name(fun));
    126         usb_log_debug("%s: mouse_sess: %p\n",
     125        usb_log_debug("%s: fun->name: %s", __FUNCTION__, ddf_fun_get_name(fun));
     126        usb_log_debug("%s: mouse_sess: %p",
    127127            __FUNCTION__, mouse_dev->mouse_sess);
    128128
     
    132132                if (mouse_dev->mouse_sess == NULL) {
    133133                        mouse_dev->mouse_sess = sess;
    134                         usb_log_debug("Console session to %s set ok (%p).\n",
     134                        usb_log_debug("Console session to %s set ok (%p).",
    135135                            ddf_fun_get_name(fun), sess);
    136136                        async_answer_0(icallid, EOK);
    137137                } else {
    138                         usb_log_error("Console session to %s already set.\n",
     138                        usb_log_error("Console session to %s already set.",
    139139                            ddf_fun_get_name(fun));
    140140                        async_answer_0(icallid, ELIMIT);
     
    142142                }
    143143        } else {
    144                 usb_log_debug("%s: Invalid function.\n", __FUNCTION__);
     144                usb_log_debug("%s: Invalid function.", __FUNCTION__);
    145145                async_answer_0(icallid, EINVAL);
    146146        }
     
    171171
    172172        if (mouse_dev->mouse_sess == NULL) {
    173                 usb_log_warning(NAME " No console session.\n");
     173                usb_log_warning(NAME " No console session.");
    174174                return;
    175175        }
     
    225225        usb_hid_report_path_t *path = usb_hid_report_path();
    226226        if (path == NULL) {
    227                 usb_log_warning("Failed to create USB HID report path.\n");
     227                usb_log_warning("Failed to create USB HID report path.");
    228228                return;
    229229        }
     
    232232        if (ret != EOK) {
    233233                usb_hid_report_path_free(path);
    234                 usb_log_warning("Failed to add buttons to report path.\n");
     234                usb_log_warning("Failed to add buttons to report path.");
    235235                return;
    236236        }
     
    242242
    243243        while (field != NULL) {
    244                 usb_log_debug2(NAME " VALUE(%X) USAGE(%X)\n", field->value,
     244                usb_log_debug2(NAME " VALUE(%X) USAGE(%X)", field->value,
    245245                    field->usage);
    246246                assert(field->usage > field->usage_minimum);
     
    331331
    332332        if (mouse_dev->buttons == NULL) {
    333                 usb_log_error(NAME ": out of memory, giving up on device!\n");
     333                usb_log_error(NAME ": out of memory, giving up on device!");
    334334                free(mouse_dev);
    335335                return ENOMEM;
     
    344344int usb_mouse_init(usb_hid_dev_t *hid_dev, void **data)
    345345{
    346         usb_log_debug("Initializing HID/Mouse structure...\n");
     346        usb_log_debug("Initializing HID/Mouse structure...");
    347347
    348348        if (hid_dev == NULL) {
     
    353353
    354354        /* Create the exposed function. */
    355         usb_log_debug("Creating DDF function %s...\n", HID_MOUSE_FUN_NAME);
     355        usb_log_debug("Creating DDF function %s...", HID_MOUSE_FUN_NAME);
    356356        ddf_fun_t *fun = usb_device_ddf_fun_create(hid_dev->usb_dev,
    357357            fun_exposed, HID_MOUSE_FUN_NAME);
    358358        if (fun == NULL) {
    359                 usb_log_error("Could not create DDF function node `%s'.\n",
     359                usb_log_error("Could not create DDF function node `%s'.",
    360360                    HID_MOUSE_FUN_NAME);
    361361                return ENOMEM;
     
    364364        usb_mouse_t *mouse_dev = ddf_fun_data_alloc(fun, sizeof(usb_mouse_t));
    365365        if (mouse_dev == NULL) {
    366                 usb_log_error("Failed to alloc HID mouse device structure.\n");
     366                usb_log_error("Failed to alloc HID mouse device structure.");
    367367                ddf_fun_destroy(fun);
    368368                return ENOMEM;
     
    371371        int ret = mouse_dev_init(mouse_dev, hid_dev);
    372372        if (ret != EOK) {
    373                 usb_log_error("Failed to init HID mouse device structure.\n");
     373                usb_log_error("Failed to init HID mouse device structure.");
    374374                return ret;
    375375        }
     
    379379        ret = ddf_fun_bind(fun);
    380380        if (ret != EOK) {
    381                 usb_log_error("Could not bind DDF function `%s': %s.\n",
     381                usb_log_error("Could not bind DDF function `%s': %s.",
    382382                    ddf_fun_get_name(fun), str_error(ret));
    383383                ddf_fun_destroy(fun);
     
    385385        }
    386386
    387         usb_log_debug("Adding DDF function `%s' to category %s...\n",
     387        usb_log_debug("Adding DDF function `%s' to category %s...",
    388388            ddf_fun_get_name(fun), HID_MOUSE_CATEGORY);
    389389        ret = ddf_fun_add_to_category(fun, HID_MOUSE_CATEGORY);
     
    444444
    445445        if (rc != EOK) {
    446                 usb_log_error("Failed to parse boot report descriptor: %s\n",
     446                usb_log_error("Failed to parse boot report descriptor: %s",
    447447                    str_error(rc));
    448448                return rc;
Note: See TracChangeset for help on using the changeset viewer.