Changeset a1732929 in mainline for uspace/drv/bus/usb/uhci/uhci_rh.c


Ignore:
Timestamp:
2018-01-15T17:04:34Z (7 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/bus/usb/uhci/uhci_rh.c

    rc1a966e ra1732929  
    202202        data[0] = ((value & STATUS_LINE_D_MINUS) ? 1 : 0)
    203203            | ((value & STATUS_LINE_D_PLUS) ? 2 : 0);
    204         RH_DEBUG(hub, port, "Bus state %" PRIx8 "(source %" PRIx16")\n",
     204        RH_DEBUG(hub, port, "Bus state %" PRIx8 "(source %" PRIx16")",
    205205            data[0], value);
    206206        *act_size = 1;
     
    248248        );
    249249        RH_DEBUG(hub, port, "Port status %" PRIx32 " (source %" PRIx16
    250             "%s)\n", uint32_usb2host(status), val,
     250            "%s)", uint32_usb2host(status), val,
    251251            hub->reset_changed[port] ? "-reset" : "");
    252252        memcpy(data, &status, sizeof(status));
     
    276276        case USB_HUB_FEATURE_PORT_ENABLE:
    277277                RH_DEBUG(hub, port, "Clear port enable (status %"
    278                     PRIx16 ")\n", status);
     278                    PRIx16 ")", status);
    279279                pio_write_16(hub->ports[port], val & ~STATUS_ENABLED);
    280280                break;
    281281        case USB_HUB_FEATURE_PORT_SUSPEND:
    282282                RH_DEBUG(hub, port, "Clear port suspend (status %"
    283                     PRIx16 ")\n", status);
     283                    PRIx16 ")", status);
    284284                pio_write_16(hub->ports[port], val & ~STATUS_SUSPEND);
    285285                // TODO we should do resume magic
    286                 usb_log_warning("Resume is not implemented on port %u\n", port);
     286                usb_log_warning("Resume is not implemented on port %u", port);
    287287                break;
    288288        case USB_HUB_FEATURE_PORT_POWER:
    289                 RH_DEBUG(hub, port, "Clear port power (status %" PRIx16 ")\n",
     289                RH_DEBUG(hub, port, "Clear port power (status %" PRIx16 ")",
    290290                    status);
    291291                /* We are always powered */
    292                 usb_log_warning("Tried to power off port %u\n", port);
     292                usb_log_warning("Tried to power off port %u", port);
    293293                break;
    294294        case USB_HUB_FEATURE_C_PORT_CONNECTION:
    295295                RH_DEBUG(hub, port, "Clear port conn change (status %"
    296                     PRIx16 ")\n", status);
     296                    PRIx16 ")", status);
    297297                pio_write_16(hub->ports[port], val | STATUS_CONNECTED_CHANGED);
    298298                break;
    299299        case USB_HUB_FEATURE_C_PORT_RESET:
    300300                RH_DEBUG(hub, port, "Clear port reset change (status %"
    301                     PRIx16 ")\n", status);
     301                    PRIx16 ")", status);
    302302                hub->reset_changed[port] = false;
    303303                break;
    304304        case USB_HUB_FEATURE_C_PORT_ENABLE:
    305305                RH_DEBUG(hub, port, "Clear port enable change (status %"
    306                     PRIx16 ")\n", status);
     306                    PRIx16 ")", status);
    307307                pio_write_16(hub->ports[port], status | STATUS_ENABLED_CHANGED);
    308308                break;
    309309        case USB_HUB_FEATURE_C_PORT_SUSPEND:
    310310                RH_DEBUG(hub, port, "Clear port suspend change (status %"
    311                     PRIx16 ")\n", status);
     311                    PRIx16 ")", status);
    312312                //TODO
    313313                return ENOTSUP;
    314314        case USB_HUB_FEATURE_C_PORT_OVER_CURRENT:
    315315                RH_DEBUG(hub, port, "Clear port OC change (status %"
    316                     PRIx16 ")\n", status);
     316                    PRIx16 ")", status);
    317317                /* UHCI Does not report over current */
    318318                //TODO: newer chips do, but some have broken wiring
     
    320320        default:
    321321                RH_DEBUG(hub, port, "Clear unknown feature %d (status %"
    322                     PRIx16 ")\n", feature, status);
    323                 usb_log_warning("Clearing feature %d is unsupported\n",
     322                    PRIx16 ")", feature, status);
     323                usb_log_warning("Clearing feature %d is unsupported",
    324324                    feature);
    325325                return ESTALL;
     
    348348        case USB_HUB_FEATURE_PORT_RESET:
    349349                RH_DEBUG(hub, port, "Set port reset before (status %" PRIx16
    350                     ")\n", status);
     350                    ")", status);
    351351                uhci_port_reset_enable(hub->ports[port]);
    352352                hub->reset_changed[port] = true;
    353353                RH_DEBUG(hub, port, "Set port reset after (status %" PRIx16
    354                     ")\n", pio_read_16(hub->ports[port]));
     354                    ")", pio_read_16(hub->ports[port]));
    355355                break;
    356356        case USB_HUB_FEATURE_PORT_SUSPEND:
    357357                RH_DEBUG(hub, port, "Set port suspend (status %" PRIx16
    358                     ")\n", status);
     358                    ")", status);
    359359                pio_write_16(hub->ports[port],
    360360                    (status & ~STATUS_WC_BITS) | STATUS_SUSPEND);
    361                 usb_log_warning("Suspend is not implemented on port %u\n", port);
     361                usb_log_warning("Suspend is not implemented on port %u", port);
    362362                break;
    363363        case USB_HUB_FEATURE_PORT_POWER:
    364364                RH_DEBUG(hub, port, "Set port power (status %" PRIx16
    365                     ")\n", status);
     365                    ")", status);
    366366                /* We are always powered */
    367                 usb_log_warning("Tried to power port %u\n", port);
     367                usb_log_warning("Tried to power port %u", port);
    368368                break;
    369369        case USB_HUB_FEATURE_C_PORT_CONNECTION:
     
    372372        case USB_HUB_FEATURE_C_PORT_OVER_CURRENT:
    373373                RH_DEBUG(hub, port, "Set port change flag (status %" PRIx16
    374                     ")\n", status);
     374                    ")", status);
    375375                /* These are voluntary and don't have to be set
    376376                 * there is no way we could do it on UHCI anyway */
     
    378378        default:
    379379                RH_DEBUG(hub, port, "Set unknown feature %d (status %" PRIx16
    380                     ")\n", feature, status);
    381                 usb_log_warning("Setting feature %d is unsupported\n",
     380                    ")", feature, status);
     381                usb_log_warning("Setting feature %d is unsupported",
    382382                    feature);
    383383                return ESTALL;
     
    418418                RH_DEBUG(hub, -1, "Event mask %" PRIx8
    419419                    " (status_a %" PRIx16 "%s),"
    420                     " (status_b %" PRIx16 "%s)\n", status,
     420                    " (status_b %" PRIx16 "%s)", status,
    421421                    status_a, hub->reset_changed[0] ? "-reset" : "",
    422422                    status_b, hub->reset_changed[1] ? "-reset" : "" );
Note: See TracChangeset for help on using the changeset viewer.