Changeset a1732929 in mainline for uspace/lib/usbhid


Ignore:
Timestamp:
2018-01-15T17:04:34Z (8 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.

Location:
uspace/lib/usbhid/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhid/src/hiddescriptor.c

    rc1a966e ra1732929  
    881881{
    882882        if(list == NULL || list_empty(list)) {
    883             usb_log_debug("\tempty\n");
     883            usb_log_debug("\tempty");
    884884            return;
    885885        }
     
    887887        list_foreach(*list, ritems_link, usb_hid_report_field_t,
    888888            report_item) {
    889                 usb_log_debug("\t\tOFFSET: %u\n", report_item->offset);
    890                 usb_log_debug("\t\tSIZE: %zu\n", report_item->size);
    891                 usb_log_debug("\t\tLOGMIN: %d\n",
     889                usb_log_debug("\t\tOFFSET: %u", report_item->offset);
     890                usb_log_debug("\t\tSIZE: %zu", report_item->size);
     891                usb_log_debug("\t\tLOGMIN: %d",
    892892                        report_item->logical_minimum);
    893                 usb_log_debug("\t\tLOGMAX: %d\n",
     893                usb_log_debug("\t\tLOGMAX: %d",
    894894                        report_item->logical_maximum);
    895                 usb_log_debug("\t\tPHYMIN: %d\n",
     895                usb_log_debug("\t\tPHYMIN: %d",
    896896                        report_item->physical_minimum);
    897                 usb_log_debug("\t\tPHYMAX: %d\n",
     897                usb_log_debug("\t\tPHYMAX: %d",
    898898                        report_item->physical_maximum);
    899                 usb_log_debug("\t\ttUSAGEMIN: %X\n",
     899                usb_log_debug("\t\ttUSAGEMIN: %X",
    900900                        report_item->usage_minimum);
    901                 usb_log_debug("\t\tUSAGEMAX: %X\n",
     901                usb_log_debug("\t\tUSAGEMAX: %X",
    902902                               report_item->usage_maximum);
    903                 usb_log_debug("\t\tUSAGES COUNT: %zu\n",
     903                usb_log_debug("\t\tUSAGES COUNT: %zu",
    904904                        report_item->usages_count);
    905905
    906                 usb_log_debug("\t\tVALUE: %X\n", report_item->value);
    907                 usb_log_debug("\t\ttUSAGE: %X\n", report_item->usage);
    908                 usb_log_debug("\t\tUSAGE PAGE: %X\n", report_item->usage_page);
     906                usb_log_debug("\t\tVALUE: %X", report_item->value);
     907                usb_log_debug("\t\ttUSAGE: %X", report_item->usage);
     908                usb_log_debug("\t\tUSAGE PAGE: %X", report_item->usage_page);
    909909
    910910                usb_hid_print_usage_path(report_item->collection_path);
    911 
    912                 usb_log_debug("\n");
    913911        }
    914912}
     
    928926        list_foreach(report->reports, reports_link,
    929927            usb_hid_report_description_t, report_des) {
    930                 usb_log_debug("Report ID: %d\n", report_des->report_id);
    931                 usb_log_debug("\tType: %d\n", report_des->type);
    932                 usb_log_debug("\tLength: %zu\n", report_des->bit_length);
    933                 usb_log_debug("\tB Size: %zu\n",
     928                usb_log_debug("Report ID: %d", report_des->report_id);
     929                usb_log_debug("\tType: %d", report_des->type);
     930                usb_log_debug("\tLength: %zu", report_des->bit_length);
     931                usb_log_debug("\tB Size: %zu",
    934932                        usb_hid_report_byte_size(report,
    935933                                report_des->report_id,
    936934                                report_des->type));
    937                 usb_log_debug("\tItems: %zu\n", report_des->item_length);
     935                usb_log_debug("\tItems: %zu", report_des->item_length);
    938936
    939937                usb_hid_descriptor_print_list(&report_des->report_items);
  • uspace/lib/usbhid/src/hidparser.c

    rc1a966e ra1732929  
    353353                length = report_item->size;
    354354               
    355                 usb_log_debug("\ttranslated value: %x\n", value);
     355                usb_log_debug("\ttranslated value: %x", value);
    356356
    357357                if ((offset / 8) == ((offset + length - 1) / 8)) {
  • uspace/lib/usbhid/src/hidpath.c

    rc1a966e ra1732929  
    173173void usb_hid_print_usage_path(usb_hid_report_path_t *path)
    174174{
    175         usb_log_debug("USAGE_PATH FOR RId(%d):\n", path->report_id);
    176         usb_log_debug("\tLENGTH: %d\n", path->depth);
     175        usb_log_debug("USAGE_PATH FOR RId(%d):", path->report_id);
     176        usb_log_debug("\tLENGTH: %d", path->depth);
    177177
    178178        list_foreach(path->items, rpath_items_link,
    179179            usb_hid_report_usage_path_t, path_item) {
    180180
    181                 usb_log_debug("\tUSAGE_PAGE: %X\n", path_item->usage_page);
    182                 usb_log_debug("\tUSAGE: %X\n", path_item->usage);
    183                 usb_log_debug("\tFLAGS: %d\n", path_item->flags);
     181                usb_log_debug("\tUSAGE_PAGE: %X", path_item->usage_page);
     182                usb_log_debug("\tUSAGE: %X", path_item->usage);
     183                usb_log_debug("\tFLAGS: %d", path_item->flags);
    184184        }
    185185}
  • uspace/lib/usbhid/src/hidreport.c

    rc1a966e ra1732929  
    8484       
    8585        if (d == NULL) {
    86                 usb_log_error("The %d. interface descriptor not found!\n",
     86                usb_log_error("The %d. interface descriptor not found!",
    8787                    usb_device_get_iface_number(dev));
    8888                return ENOENT;
     
    104104       
    105105        if (d == NULL) {
    106                 usb_log_fatal("No HID descriptor found!\n");
     106                usb_log_fatal("No HID descriptor found!");
    107107                return ENOENT;
    108108        }
     
    130130        }
    131131       
    132         usb_log_debug("Getting Report descriptor, expected size: %u\n", length);
     132        usb_log_debug("Getting Report descriptor, expected size: %u", length);
    133133       
    134134        /*
     
    156156        *size = length;
    157157       
    158         usb_log_debug("Done.\n");
     158        usb_log_debug("Done.");
    159159       
    160160        return EOK;
     
    178178       
    179179        if (rc != EOK) {
    180                 usb_log_error("Problem with getting Report descriptor: %s.\n",
     180                usb_log_error("Problem with getting Report descriptor: %s.",
    181181                    str_error(rc));
    182182                if (*report_desc != NULL) {
     
    191191        rc = usb_hid_parse_report_descriptor(report, *report_desc, *report_size);
    192192        if (rc != EOK) {
    193                 usb_log_error("Problem parsing Report descriptor: %s.\n",
     193                usb_log_error("Problem parsing Report descriptor: %s.",
    194194                    str_error(rc));
    195195                free(*report_desc);
  • uspace/lib/usbhid/src/hidreq.c

    rc1a966e ra1732929  
    6262{
    6363        if (ctrl_pipe == NULL) {
    64                 usb_log_warning("usbhid_req_set_report(): no pipe given.\n");
     64                usb_log_warning("usbhid_req_set_report(): no pipe given.");
    6565                return EINVAL;
    6666        }
     
    8282        value |= (type << 8);
    8383
    84         usb_log_debug("Sending Set Report request to the device.\n");
     84        usb_log_debug("Sending Set Report request to the device.");
    8585       
    8686        rc = usb_control_request_set(ctrl_pipe,
     
    112112{
    113113        if (ctrl_pipe == NULL) {
    114                 usb_log_warning("usbhid_req_set_report(): no pipe given.\n");
     114                usb_log_warning("usbhid_req_set_report(): no pipe given.");
    115115                return EINVAL;
    116116        }
     
    160160{
    161161        if (ctrl_pipe == NULL) {
    162                 usb_log_warning("usbhid_req_set_report(): no pipe given.\n");
     162                usb_log_warning("usbhid_req_set_report(): no pipe given.");
    163163                return EINVAL;
    164164        }
     
    215215{
    216216        if (ctrl_pipe == NULL) {
    217                 usb_log_warning("usbhid_req_set_report(): no pipe given.\n");
     217                usb_log_warning("usbhid_req_set_report(): no pipe given.");
    218218                return EINVAL;
    219219        }
     
    235235        value |= (type << 8);
    236236       
    237         usb_log_debug("Sending Get Report request to the device.\n");
     237        usb_log_debug("Sending Get Report request to the device.");
    238238       
    239239        rc = usb_control_request_get(ctrl_pipe,
     
    266266{
    267267        if (ctrl_pipe == NULL) {
    268                 usb_log_warning("usbhid_req_set_report(): no pipe given.\n");
     268                usb_log_warning("usbhid_req_set_report(): no pipe given.");
    269269                return EINVAL;
    270270        }
     
    300300       
    301301        if (actual_size != 1) {
    302                 usb_log_warning("Wrong data size: %zu, expected: 1.\n",
     302                usb_log_warning("Wrong data size: %zu, expected: 1.",
    303303                        actual_size);
    304304                return ELIMIT;
     
    327327{
    328328        if (ctrl_pipe == NULL) {
    329                 usb_log_warning("usbhid_req_set_report(): no pipe given.\n");
     329                usb_log_warning("usbhid_req_set_report(): no pipe given.");
    330330                return EINVAL;
    331331        }
     
    363363       
    364364        if (actual_size != 1) {
    365                 usb_log_warning("Wrong data size: %zu, expected: 1.\n",
     365                usb_log_warning("Wrong data size: %zu, expected: 1.",
    366366                        actual_size);
    367367                return ELIMIT;
Note: See TracChangeset for help on using the changeset viewer.