Changeset ce794342 in mainline


Ignore:
Timestamp:
2011-03-21T18:21:46Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
31b568e
Parents:
434ef65 (diff), fbefd0e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Logging refactoring

Location:
uspace
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ehci-hcd/main.c

    r434ef65 rce794342  
    119119int main(int argc, char *argv[])
    120120{
    121         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     121        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
    122122        return ddf_driver_main(&ehci_driver);
    123123}
  • uspace/drv/ohci/main.c

    r434ef65 rce794342  
    199199int main(int argc, char *argv[])
    200200{
    201         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     201        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
    202202        sleep(5);
    203203        return ddf_driver_main(&ohci_driver);
  • uspace/drv/uhci-hcd/main.c

    r434ef65 rce794342  
    6262int uhci_add_device(ddf_dev_t *device)
    6363{
    64         usb_log_info("uhci_add_device() called\n");
     64        usb_log_debug("uhci_add_device() called\n");
    6565        assert(device);
    6666        uhci_t *uhci = malloc(sizeof(uhci_t));
     
    7272        int ret = uhci_init(uhci, device);
    7373        if (ret != EOK) {
    74                 usb_log_error("Failed to initialzie UHCI driver.\n");
     74                usb_log_error("Failed to initialize UHCI driver: %s.\n",
     75                    str_error(ret));
    7576                return ret;
    7677        }
    7778        device->driver_data = uhci;
     79
     80        usb_log_info("Controlling new UHCI device `%s'.\n", device->name);
     81
    7882        return EOK;
    7983}
     
    8993int main(int argc, char *argv[])
    9094{
     95        printf(NAME ": HelenOS UHCI driver.\n");
     96
    9197        sleep(3); /* TODO: remove in final version */
    92         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     98        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
    9399
    94100        return ddf_driver_main(&uhci_driver);
  • uspace/drv/uhci-hcd/uhci.c

    r434ef65 rce794342  
    167167        CHECK_RET_DEST_FUN_RETURN(ret,
    168168            "Failed(%d) to get I/O addresses:.\n", ret, device->handle);
    169         usb_log_info("I/O regs at 0x%X (size %zu), IRQ %d.\n",
     169        usb_log_debug("I/O regs at 0x%X (size %zu), IRQ %d.\n",
    170170            io_reg_base, io_reg_size, irq);
    171171
  • uspace/drv/uhci-hcd/uhci_hc.c

    r434ef65 rce794342  
    128128        fibril_add_ready(instance->debug_checker);
    129129
    130         usb_log_info("Started UHCI driver.\n");
    131130        return EOK;
    132131#undef CHECK_RET_DEST_FUN_RETURN
  • uspace/drv/uhci-rhd/main.c

    r434ef65 rce794342  
    3636#include <device/hw_res.h>
    3737#include <errno.h>
     38#include <str_error.h>
    3839#include <usb_iface.h>
    3940#include <usb/ddfiface.h>
     
    8687        int ret = hc_get_my_registers(device, &io_regs, &io_size);
    8788        if (ret != EOK) {
    88                 usb_log_error("Failed(%d) to get registers from parent hc.",
    89                     ret);
    90         }
    91         usb_log_info("I/O regs at %#X (size %zu).\n", io_regs, io_size);
     89                usb_log_error("Failed to get registers from parent HC: %s.\n",
     90                    str_error(ret));
     91        }
     92        usb_log_debug("I/O regs at %#X (size %zu).\n", io_regs, io_size);
    9293
    9394        uhci_root_hub_t *rh = malloc(sizeof(uhci_root_hub_t));
     
    99100        ret = uhci_root_hub_init(rh, (void*)io_regs, io_size, device);
    100101        if (ret != EOK) {
    101                 usb_log_error("Failed(%d) to initialize driver instance.\n", ret);
     102                usb_log_error("Failed to initialize driver instance: %s.\n",
     103                    str_error(ret));
    102104                free(rh);
    103105                return ret;
     
    105107
    106108        device->driver_data = rh;
    107         usb_log_info("Sucessfully initialized driver instance for device:%d.\n",
    108             device->handle);
     109        usb_log_info("Controlling root hub `%s' (%llu).\n",
     110            device->name, device->handle);
    109111        return EOK;
    110112}
     
    129131int main(int argc, char *argv[])
    130132{
    131         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     133        printf(NAME ": HelenOS UHCI root hub driver.\n");
     134
     135        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
     136
    132137        return ddf_driver_main(&uhci_rh_driver);
    133138}
  • uspace/drv/uhci-rhd/port.c

    r434ef65 rce794342  
    256256        assert(usb_hc_connection_is_opened(&port->hc_connection));
    257257
    258         usb_log_info("%s: Detected new device.\n", port->id_string);
     258        usb_log_debug("%s: Detected new device.\n", port->id_string);
    259259
    260260        usb_address_t dev_addr;
     
    270270        }
    271271
    272         usb_log_info("%s: New device has address %d (handle %zu).\n",
    273             port->id_string, dev_addr, port->attached_device);
     272        usb_log_info("New device at port %u, address %d (handle %llu).\n",
     273            port->number, dev_addr, port->attached_device);
    274274
    275275        return EOK;
     
    315315        uhci_port_write_status(port, port_status);
    316316
    317         usb_log_info("%s: %sabled port.\n",
     317        usb_log_debug("%s: %sabled port.\n",
    318318                port->id_string, enabled ? "En" : "Dis");
    319319        return EOK;
  • uspace/drv/usbflbk/main.c

    r434ef65 rce794342  
    8686int main(int argc, char *argv[])
    8787{
    88         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     88        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
    8989
    9090        return usb_driver_main(&usbfallback_driver);
  • uspace/drv/usbhid/hiddev.c

    r434ef65 rce794342  
    192192        assert(hid_dev != NULL);
    193193       
    194         usb_log_info("Processing descriptors...\n");
     194        usb_log_debug("Processing descriptors...\n");
    195195       
    196196        int rc;
     
    368368    usb_endpoint_description_t *poll_ep_desc)
    369369{
    370         usb_log_info("Initializing HID device structure.\n");
     370        usb_log_debug("Initializing HID device structure.\n");
    371371       
    372372        if (hid_dev == NULL) {
     
    454454       
    455455        hid_dev->initialized = 1;
    456         usb_log_info("HID device structure initialized.\n");
     456        usb_log_debug("HID device structure initialized.\n");
    457457       
    458458        return EOK;
  • uspace/drv/usbhid/kbddev.c

    r434ef65 rce794342  
    662662        int rc;
    663663       
    664         usb_log_info("Initializing HID/KBD structure...\n");
     664        usb_log_debug("Initializing HID/KBD structure...\n");
    665665       
    666666        if (kbd_dev == NULL) {
     
    742742       
    743743        kbd_dev->initialized = USBHID_KBD_STATUS_INITIALIZED;
    744         usb_log_info("HID/KBD device structure initialized.\n");
     744        usb_log_debug("HID/KBD device structure initialized.\n");
    745745       
    746746        return EOK;
     
    769769        size_t actual_size;
    770770       
    771         usb_log_info("Polling keyboard...\n");
     771        usb_log_debug("Polling keyboard...\n");
    772772       
    773773        if (!kbd_dev->initialized) {
     
    907907         * Initialize device (get and process descriptors, get address, etc.)
    908908         */
    909         usb_log_info("Initializing USB/HID KBD device...\n");
     909        usb_log_debug("Initializing USB/HID KBD device...\n");
    910910       
    911911        usbhid_kbd_t *kbd_dev = usbhid_kbd_new();
     
    926926        }       
    927927       
    928         usb_log_info("USB/HID KBD device structure initialized.\n");
     928        usb_log_debug("USB/HID KBD device structure initialized.\n");
    929929       
    930930        /*
     
    937937        rc = ddf_fun_bind(kbd_fun);
    938938        if (rc != EOK) {
    939                 usb_log_error("Could not bind DDF function.\n");
     939                usb_log_error("Could not bind DDF function: %s.\n",
     940                    str_error(rc));
    940941                // TODO: Can / should I destroy the DDF function?
    941942                ddf_fun_destroy(kbd_fun);
     
    946947        rc = ddf_fun_add_to_class(kbd_fun, "keyboard");
    947948        if (rc != EOK) {
    948                 usb_log_error("Could not add DDF function to class 'keyboard'"
    949                     "\n");
     949                usb_log_error(
     950                    "Could not add DDF function to class 'keyboard': %s.\n",
     951                    str_error(rc));
    950952                // TODO: Can / should I destroy the DDF function?
    951953                ddf_fun_destroy(kbd_fun);
     
    959961        fid_t fid = fibril_create(usbhid_kbd_fibril, kbd_dev);
    960962        if (fid == 0) {
    961                 usb_log_error("Failed to start fibril for KBD device\n");
     963                usb_log_error("Failed to start fibril for `%s' device.\n",
     964                    dev->name);
    962965                return ENOMEM;
    963966        }
  • uspace/drv/usbhid/main.c

    r434ef65 rce794342  
    3939#include <usb/debug.h>
    4040#include <errno.h>
     41#include <str_error.h>
    4142
    4243#include "kbddev.h"
     
    6465       
    6566        if (rc != EOK) {
    66                 usb_log_info("Device is not a supported keyboard.\n");
    67                 usb_log_error("Failed to add HID device.\n");
    68                 return EREFUSED;
     67                usb_log_warning("Device is not a supported keyboard.\n");
     68                usb_log_error("Failed to add HID device: %s.\n",
     69                    str_error(rc));
     70                return rc;
    6971        }
    7072       
     73        usb_log_info("Keyboard `%s' ready to use.\n", dev->name);
     74
    7175        return EOK;
    7276}
     
    8993int main(int argc, char *argv[])
    9094{
    91         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     95        printf(NAME ": HelenOS USB HID driver.\n");
     96
     97        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
     98
    9299        return ddf_driver_main(&kbd_driver);
    93100}
  • uspace/drv/usbhub/main.c

    r434ef65 rce794342  
    7676        printf(NAME ": HelenOS USB hub driver.\n");
    7777
    78         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     78        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
    7979       
    8080        return usb_driver_main(&usb_hub_driver);
  • uspace/drv/usbhub/usbhub.c

    r434ef65 rce794342  
    132132                return opResult;
    133133        }
    134         usb_log_info("setting port count to %d\n",descriptor->ports_count);
     134        usb_log_debug("setting port count to %d\n",descriptor->ports_count);
    135135        hub_info->port_count = descriptor->ports_count;
    136136        hub_info->attached_devs = (usb_hc_attached_device_t*)
     
    159159        usb_standard_device_descriptor_t *std_descriptor
    160160            = &hub_info->usb_device->descriptors.device;
    161         usb_log_info("hub has %d configurations\n",
     161        usb_log_debug("hub has %d configurations\n",
    162162            std_descriptor->configuration_count);
    163163        if(std_descriptor->configuration_count<1){
     
    290290        //if this hub already uses default address, it cannot request it once more
    291291        if(hub->is_default_address_used) return;
    292         usb_log_info("some connection changed\n");
     292        usb_log_debug("some connection changed\n");
    293293        assert(hub->control_pipe->hc_phone);
    294294        int opResult = usb_hub_clear_port_feature(hub->control_pipe,
     
    333333
    334334        int opResult;
    335         usb_log_info("finalizing add device\n");
     335        usb_log_debug("finalizing add device\n");
    336336        opResult = usb_hub_clear_port_feature(hub->control_pipe,
    337337            port, USB_HUB_FEATURE_C_PORT_RESET);
     
    365365                return;
    366366        }
    367         usb_log_info("setting new address %d\n",new_device_address);
     367        usb_log_debug("setting new address %d\n",new_device_address);
    368368        //opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT,
    369369        //    new_device_address);
     
    405405                return;
    406406        }
    407         usb_log_info("new device address %d, handle %zu\n",
     407        usb_log_info("Detected new device on `%s' (port %d), " \
     408            "address %d (handle %llu).\n",
     409            hub->usb_device->ddf_dev->name, (int) port,
    408410            new_device_address, child_handle);
    409 
    410411}
    411412
     
    504505        if (usb_port_connect_change(&status)) {
    505506                if (usb_port_dev_connected(&status)) {
    506                         usb_log_info("some connection changed\n");
     507                        usb_log_debug("some connection changed\n");
    507508                        usb_hub_init_add_device(hub, port, usb_port_speed(&status));
    508509                } else {
     
    516517                        usb_hub_over_current(hub,port);
    517518                }else{
    518                         usb_log_info("over current condition was auto-resolved on port %d\n",
     519                        usb_log_debug("over current condition was auto-resolved on port %d\n",
    519520                                        port);
    520521                }
     
    522523        //port reset
    523524        if (usb_port_reset_completed(&status)) {
    524                 usb_log_info("port reset complete\n");
     525                usb_log_debug("port reset complete\n");
    525526                if (usb_port_enabled(&status)) {
    526527                        usb_hub_finalize_add_device(hub, port, usb_port_speed(&status));
  • uspace/drv/usbmid/main.c

    r434ef65 rce794342  
    106106        printf(NAME ": USB multi interface device driver.\n");
    107107
    108         usb_log_enable(USB_LOG_LEVEL_INFO, NAME);
     108        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
    109109        return ddf_driver_main(&mid_driver);
    110110}
  • uspace/drv/usbmouse/main.c

    r434ef65 rce794342  
    9090int main(int argc, char *argv[])
    9191{
    92         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     92        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
    9393
    9494        return usb_driver_main(&mouse_driver);
  • uspace/drv/vhc/hcd.c

    r434ef65 rce794342  
    122122        //sleep(5);
    123123
    124         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     124        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
    125125
    126126        printf(NAME ": virtual USB host controller driver.\n");
  • uspace/lib/usb/include/usb/debug.h

    r434ef65 rce794342  
    7979} usb_log_level_t;
    8080
     81/** Default log level. */
     82#define USB_LOG_LEVEL_DEFAULT USB_LOG_LEVEL_DEBUG
     83
    8184
    8285void usb_log_enable(usb_log_level_t, const char *);
Note: See TracChangeset for help on using the changeset viewer.