Changeset 7ce0fe3 in mainline for uspace/drv/uhci-rhd/port.c


Ignore:
Timestamp:
2011-02-01T22:02:23Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
afcd86e
Parents:
993a1e1
Message:

Root ub driver uses unified debug logging and some other polishing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-rhd/port.c

    r993a1e1 r7ce0fe3  
    11
    22#include <errno.h>
     3
    34#include <usb/usb.h>    /* usb_address_t */
    45#include <usb/usbdrv.h> /* usb_drv_*     */
     6#include <usb/debug.h>
    57
    6 #include "debug.h"
    78#include "port.h"
    89#include "port_status.h"
     
    2728        port->checker = fibril_create(uhci_port_check, port);
    2829        if (port->checker == 0) {
    29                 uhci_print_error(": failed to launch root hub fibril.");
     30                usb_log_error(": failed to launch root hub fibril.");
    3031                return ENOMEM;
    3132        }
    3233        fibril_add_ready(port->checker);
    33         uhci_print_verbose(
     34        usb_log_debug(
    3435          "Added fibril for port %d: %p.\n", number, port->checker);
    3536        return EOK;
     
    4950
    5051        while (1) {
    51                 uhci_print_verbose("Port(%d) status address %p:\n",
     52                usb_log_debug("Port(%d) status address %p:\n",
    5253                  port_instance->number, port_instance->address);
    5354
     
    5758
    5859                /* debug print */
    59                 uhci_print_info("Port(%d) status %#.4x\n",
     60                usb_log_info("Port(%d) status %#.4x\n",
    6061                  port_instance->number, port_status);
    6162                print_port_status(port_status);
     
    7980        assert(port->hc_phone);
    8081
    81         uhci_print_info("Adding new device on port %d.\n", port->number);
     82        usb_log_info("Adding new device on port %d.\n", port->number);
    8283
    8384
     
    8586        int ret = usb_drv_reserve_default_address(port->hc_phone);
    8687        if (ret != EOK) {
    87                 uhci_print_error("Failed to reserve default address.\n");
     88                usb_log_error("Failed to reserve default address.\n");
    8889                return ret;
    8990        }
     
    9293
    9394        if (usb_address <= 0) {
    94                 uhci_print_error("Recieved invalid address(%d).\n", usb_address);
     95                usb_log_error("Recieved invalid address(%d).\n", usb_address);
    9596                return usb_address;
    9697        }
     
    122123
    123124        if (ret != EOK) { /* address assigning went wrong */
    124                 uhci_print_error("Failed(%d) to assign address to the device.\n", ret);
     125                usb_log_error("Failed(%d) to assign address to the device.\n", ret);
    125126                uhci_port_set_enabled(port, false);
    126127                int release = usb_drv_release_default_address(port->hc_phone);
    127128                if (release != EOK) {
    128                         uhci_print_fatal("Failed to release default address.\n");
     129                        usb_log_error("Failed to release default address.\n");
    129130                        return release;
    130131                }
     
    135136        ret = usb_drv_release_default_address(port->hc_phone);
    136137        if (ret != EOK) {
    137                 uhci_print_fatal("Failed to release default address.\n");
     138                usb_log_error("Failed to release default address.\n");
    138139                return ret;
    139140        }
     
    146147
    147148        if (ret != EOK) { /* something went wrong */
    148                 uhci_print_error("Failed(%d) in usb_drv_register_child.\n", ret);
     149                usb_log_error("Failed(%d) in usb_drv_register_child.\n", ret);
    149150                uhci_port_set_enabled(port, false);
    150151                return ENOMEM;
    151152        }
    152         uhci_print_info("Sucessfully added device on port(%d) address(%d).\n",
     153        usb_log_info("Sucessfully added device on port(%d) address(%d).\n",
    153154                port->number, usb_address);
    154155
     
    160161static int uhci_port_remove_device(uhci_port_t *port)
    161162{
    162         uhci_print_error("Don't know how to remove device %#x.\n",
     163        usb_log_error("Don't know how to remove device %#x.\n",
    163164                (unsigned int)port->attached_device);
    164165        uhci_port_set_enabled(port, false);
     
    182183        port_status_write(port->address, port_status);
    183184
    184         uhci_print_info("%s port %d.\n",
     185        usb_log_info("%s port %d.\n",
    185186          enabled ? "Enabled" : "Disabled", port->number);
    186187        return EOK;
Note: See TracChangeset for help on using the changeset viewer.