Changeset ab5a43d1 in mainline


Ignore:
Timestamp:
2011-03-11T16:03:25Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
71b6e92
Parents:
3005db6
Message:

All debug output uses port.id_string

Location:
uspace/drv/uhci-rhd
Files:
2 edited

Legend:

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

    r3005db6 rab5a43d1  
    6767{
    6868        assert(port);
     69        asprintf(&port->id_string, "Port (%p - %d)", port, number);
     70        if (port->id_string == NULL) {
     71                return ENOMEM;
     72        }
    6973
    7074        port->address = address;
     
    116120        assert(instance);
    117121
    118         /* Iteration count, for debug purposes only */
    119         unsigned count = 0;
    120 
    121122        while (1) {
    122123                async_usleep(instance->wait_period_usec);
     
    125126                port_status_t port_status = uhci_port_read_status(instance);
    126127
    127                 /* debug print mutex */
    128                 static fibril_mutex_t dbg_mtx =
    129                     FIBRIL_MUTEX_INITIALIZER(dbg_mtx);
    130                 fibril_mutex_lock(&dbg_mtx);
    131                 usb_log_debug2("Port(%p - %d): Status: %#04x. === %u\n",
    132                   instance->address, instance->number, port_status, count++);
    133                 print_port_status("Port", port_status);
    134                 fibril_mutex_unlock(&dbg_mtx);
     128                print_port_status(instance->id_string, port_status);
    135129
    136130                if ((port_status & STATUS_CONNECTED_CHANGED) == 0)
    137131                        continue;
    138132
    139                 usb_log_debug("Port(%p - %d): Connected change detected: %x.\n",
    140                     instance->address, instance->number, port_status);
     133                usb_log_debug("%s: Connected change detected: %x.\n",
     134                    instance->id_string, port_status);
    141135
    142136                int rc =
    143137                    usb_hc_connection_open(&instance->hc_connection);
    144138                if (rc != EOK) {
    145                         usb_log_error("Port(%p - %d): Failed to connect to HC.",
    146                             instance->address, instance->number);
     139                        usb_log_error("%s: Failed to connect to HC.",
     140                            instance->id_string);
    147141                        continue;
    148142                }
     
    150144                /* Remove any old device */
    151145                if (instance->attached_device) {
    152                         usb_log_debug2("Port(%p - %d): Removing device.\n",
    153                             instance->address, instance->number);
     146                        usb_log_debug2("%s: Removing device.\n",
     147                            instance->id_string);
    154148                        uhci_port_remove_device(instance);
    155149                }
     
    164158                        /* Write one to WC bits, to ack changes */
    165159                        uhci_port_write_status(instance, port_status);
    166                         usb_log_debug("Port(%p - %d): Change status ACK.\n",
    167                             instance->address, instance->number);
     160                        usb_log_debug("%s: Change status ACK.\n",
     161                            instance->id_string);
    168162                }
    169163
    170164                rc = usb_hc_connection_close(&instance->hc_connection);
    171165                if (rc != EOK) {
    172                         usb_log_error("Port(%p - %d): Failed to disconnect.",
    173                             instance->address, instance->number);
     166                        usb_log_error("%s: Failed to disconnect.",
     167                            instance->id_string);
    174168                }
    175169        }
     
    187181        uhci_port_t *port = (uhci_port_t *) arg;
    188182
    189         usb_log_debug2("Port(%p - %d): new_device_enable_port.\n",
    190             port->address, port->number);
     183        usb_log_debug2("%s: new_device_enable_port.\n",
     184            port->id_string);
    191185
    192186        /*
     
    201195         */
    202196        {
    203                 usb_log_debug("Port(%p - %d): Reset Signal start.\n",
    204                     port->address, port->number);
     197                usb_log_debug("%s: Reset Signal start.\n",
     198                    port->id_string);
    205199                port_status_t port_status = uhci_port_read_status(port);
    206200                port_status |= STATUS_IN_RESET;
     
    210204                port_status &= ~STATUS_IN_RESET;
    211205                uhci_port_write_status(port, port_status);
    212                 usb_log_debug("Port(%p - %d): Reset Signal stop.\n",
    213                     port->address, port->number);
     206                usb_log_debug("%s: Reset Signal stop.\n",
     207                    port->id_string);
    214208        }
    215209
     
    232226        assert(usb_hc_connection_is_opened(&port->hc_connection));
    233227
    234         usb_log_info("Port(%p-%d): Detected new device.\n",
    235             port->address, port->number);
     228        usb_log_info("%s: Detected new device.\n",
     229            port->id_string);
    236230
    237231        usb_address_t dev_addr;
     
    241235
    242236        if (rc != EOK) {
    243                 usb_log_error("Port(%p-%d): Failed(%d) to add device: %s.\n",
    244                     port->address, port->number, rc, str_error(rc));
     237                usb_log_error("%s: Failed(%d) to add device: %s.\n",
     238                    port->id_string, rc, str_error(rc));
    245239                uhci_port_set_enabled(port, false);
    246240                return rc;
    247241        }
    248242
    249         usb_log_info("Port(%p-%d): New device has address %d (handle %zu).\n",
    250             port->address, port->number, dev_addr, port->attached_device);
     243        usb_log_info("%s: New device has address %d (handle %zu).\n",
     244            port->id_string, dev_addr, port->attached_device);
    251245
    252246        return EOK;
     
    262256int uhci_port_remove_device(uhci_port_t *port)
    263257{
    264         usb_log_error("Port(%p-%d): Don't know how to remove device %#x.\n",
    265             port->address, port->number, (unsigned int)port->attached_device);
     258        usb_log_error("%s: Don't know how to remove device %d.\n",
     259            port->id_string, (unsigned int)port->attached_device);
    266260        return EOK;
    267261}
     
    289283        uhci_port_write_status(port, port_status);
    290284
    291         usb_log_info("Port(%p-%d): %sabled port.\n",
    292                 port->address, port->number, enabled ? "En" : "Dis");
     285        usb_log_info("%s: %sabled port.\n",
     286                port->id_string, enabled ? "En" : "Dis");
    293287        return EOK;
    294288}
  • uspace/drv/uhci-rhd/port.h

    r3005db6 rab5a43d1  
    4444typedef struct uhci_port
    4545{
     46        char *id_string;
    4647        port_status_t *address;
    4748        unsigned number;
Note: See TracChangeset for help on using the changeset viewer.