Changeset 0cfc68f0 in mainline


Ignore:
Timestamp:
2011-01-23T23:18:21Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3b77628
Parents:
4a5e2f1
Message:

Hub driver: debugging messages clean-up

Removed duplicit prefix of the message.

Corrected some indentation issues.

Location:
uspace/drv/usbhub
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhub/main.c

    r4a5e2f1 r0cfc68f0  
    6060int main(int argc, char *argv[])
    6161{
    62         usb_dprintf_enable(NAME,1);
     62        usb_dprintf_enable(NAME, 0);
     63
    6364        futex_initialize(&usb_hub_list_lock, 0);
    6465        usb_lst_init(&usb_hub_list);
    6566        futex_up(&usb_hub_list_lock);
     67
    6668        fid_t fid = fibril_create(usb_hub_control_loop, NULL);
    6769        if (fid == 0) {
    68                 dprintf(1, "failed to start fibril for HUB devices");
    69                 //printf("%s: failed to start fibril for HUB devices\n", NAME);
     70                fprintf(stderr, NAME ": failed to start monitoring fibril," \
     71                    " driver aborting.\n");
    7072                return ENOMEM;
    7173        }
  • uspace/drv/usbhub/usbhub.c

    r4a5e2f1 r0cfc68f0  
    7676        //get some hub info
    7777        usb_address_t addr = usb_drv_get_my_address(hc, device);
    78         dprintf(1,"[usb_hub] address of newly created hub = %d", addr);
     78        dprintf(1, "address of newly created hub = %d", addr);
    7979        /*if(addr<0){
    8080                //return result;
     
    100100
    101101        if (opResult != EOK) {
    102                 dprintf(1,"[usb_hub] failed when receiving hub descriptor, badcode = %d",opResult);
     102                dprintf(1, "failed when receiving hub descriptor, badcode = %d",opResult);
    103103                free(serialized_descriptor);
    104104                return result;
     
    107107        descriptor = usb_deserialize_hub_desriptor(serialized_descriptor);
    108108        if(descriptor==NULL){
    109                 dprintf(1,"[usb_hub] could not deserialize descriptor ");
     109                dprintf(1, "could not deserialize descriptor ");
    110110                result->port_count = 1;///\TODO this code is only for debug!!!
    111111                return result;
     
    127127        //finish
    128128
    129         dprintf(1,"[usb_hub] hub info created");
     129        dprintf(1, "hub info created");
    130130
    131131        return result;
     
    134134int usb_add_hub_device(device_t *dev) {
    135135        dprintf(1, "add_hub_device(handle=%d)", (int) dev->handle);
    136         dprintf(1,"[usb_hub] hub device");
     136        dprintf(1, "hub device");
    137137
    138138        /*
     
    162162        usb_standard_device_descriptor_t std_descriptor;
    163163        opResult = usb_drv_req_get_device_descriptor(hc, target.address,
    164     &std_descriptor);
     164            &std_descriptor);
    165165        if(opResult!=EOK){
    166                 dprintf(1,"[usb_hub] could not get device descriptor, %d",opResult);
     166                dprintf(1, "could not get device descriptor, %d",opResult);
    167167                return opResult;
    168168        }
    169         dprintf(1,"[usb_hub] hub has %d configurations",std_descriptor.configuration_count);
     169        dprintf(1, "hub has %d configurations",std_descriptor.configuration_count);
    170170        if(std_descriptor.configuration_count<1){
    171                 dprintf(1,"[usb_hub] THERE ARE NO CONFIGURATIONS AVAILABLE");
     171                dprintf(1, "THERE ARE NO CONFIGURATIONS AVAILABLE");
    172172                //shouldn`t I return?
    173173        }
     
    178178        &config_descriptor);
    179179        if(opResult!=EOK){
    180                 dprintf(1,"[usb_hub] could not get configuration descriptor, %d",opResult);
     180                dprintf(1, "could not get configuration descriptor, %d",opResult);
    181181                return opResult;
    182182        }
     
    186186
    187187        if (opResult != EOK) {
    188                 dprintf(1,"[usb_hub]something went wrong when setting hub`s configuration, %d", opResult);
     188                dprintf(1, "something went wrong when setting hub`s configuration, %d", opResult);
    189189        }
    190190
     
    193193                usb_hub_set_power_port_request(&request, port);
    194194                opResult = usb_drv_sync_control_write(hc, target, &request, NULL, 0);
    195                 dprintf(1,"[usb_hub] powering port %d",port);
     195                dprintf(1, "powering port %d",port);
    196196                if (opResult != EOK) {
    197                         dprintf(1,"[usb_hub]something went wrong when setting hub`s %dth port", port);
     197                        dprintf(1, "something went wrong when setting hub`s %dth port", port);
    198198                }
    199199        }
     
    207207        futex_up(&usb_hub_list_lock);
    208208
    209         dprintf(1,"[usb_hub] hub info added to list");
     209        dprintf(1, "hub info added to list");
    210210        //(void)hub_info;
    211211        usb_hub_check_hub_changes();
     
    213213       
    214214
    215         dprintf(1,"[usb_hub] hub dev added");
    216         dprintf(1,"\taddress %d, has %d ports ",
     215        dprintf(1, "hub dev added");
     216        dprintf(1, "\taddress %d, has %d ports ",
    217217                        hub_info->usb_device->address,
    218218                        hub_info->port_count);
    219         dprintf(1,"\tused configuration %d",config_descriptor.configuration_number);
     219        dprintf(1, "\tused configuration %d",config_descriptor.configuration_number);
    220220
    221221        return EOK;
     
    238238inline static int usb_hub_release_default_address(int hc){
    239239        int opResult;
    240         dprintf(1,"[usb_hub] releasing default address");
     240        dprintf(1, "releasing default address");
    241241        opResult = usb_drv_release_default_address(hc);
    242242        if (opResult != EOK) {
    243                 dprintf(1,"[usb_hub] failed to release default address");
     243                dprintf(1, "failed to release default address");
    244244        }
    245245        return opResult;
     
    255255        usb_device_request_setup_packet_t request;
    256256        int opResult;
    257         dprintf(1,"[usb_hub] some connection changed");
     257        dprintf(1, "some connection changed");
    258258        //get default address
    259259        opResult = usb_drv_reserve_default_address(hc);
    260260        if (opResult != EOK) {
    261                 dprintf(1,"[usb_hub] cannot assign default address, it is probably used");
     261                dprintf(1, "cannot assign default address, it is probably used");
    262262                return;
    263263        }
     
    270270                        );
    271271        if (opResult != EOK) {
    272                 dprintf(1,"[usb_hub] something went wrong when reseting a port");
     272                dprintf(1, "something went wrong when reseting a port");
    273273                usb_hub_release_default_address(hc);
    274274        }
     
    285285
    286286        int opResult;
    287         dprintf(1,"[usb_hub] finalizing add device");
     287        dprintf(1, "finalizing add device");
    288288        opResult = usb_hub_clear_port_feature(hc, target.address,
    289289            port, USB_HUB_FEATURE_C_PORT_RESET);
    290290        if (opResult != EOK) {
    291                 dprintf(1,"[usb_hub] failed to clear port reset feature");
     291                dprintf(1, "failed to clear port reset feature");
    292292                usb_hub_release_default_address(hc);
    293293                return;
     
    297297        usb_address_t new_device_address = usb_drv_request_address(hc);
    298298        if (new_device_address < 0) {
    299                 dprintf(1,"[usb_hub] failed to get free USB address");
     299                dprintf(1, "failed to get free USB address");
    300300                opResult = new_device_address;
    301301                usb_hub_release_default_address(hc);
    302302                return;
    303303        }
    304         dprintf(1,"[usb_hub] setting new address");
     304        dprintf(1, "setting new address");
    305305        opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT,
    306306            new_device_address);
    307307
    308308        if (opResult != EOK) {
    309                 dprintf(1,"[usb_hub] could not set address for new device");
     309                dprintf(1, "could not set address for new device");
    310310                usb_hub_release_default_address(hc);
    311311                return;
     
    322322            new_device_address, &child_handle);
    323323        if (opResult != EOK) {
    324                 dprintf(1,"[usb_hub] could not start driver for new device");
     324                dprintf(1, "could not start driver for new device");
    325325                return;
    326326        }
     
    330330        opResult = usb_drv_bind_address(hc, new_device_address, child_handle);
    331331        if (opResult != EOK) {
    332                 dprintf(1,"[usb_hub] could not assign address of device in hcd");
    333                 return;
    334         }
    335         dprintf(1,"[usb_hub] new device address %d, handle %zu",
     332                dprintf(1, "could not assign address of device in hcd");
     333                return;
     334        }
     335        dprintf(1, "new device address %d, handle %zu",
    336336            new_device_address, child_handle);
    337337
     
    358358                opResult = usb_drv_release_address(hc,hub->attached_devs[port].address);
    359359                if(opResult != EOK) {
    360                         dprintf(1,
    361                                         "[usb_hub] could not release address of removed device: %d"
    362                                         ,opResult);
     360                        dprintf(1, "could not release address of " \
     361                            "removed device: %d", opResult);
    363362                }
    364363                hub->attached_devs[port].address = 0;
    365364        }else{
    366                 dprintf(1,
    367                                 "[usb_hub] this is strange, disconnected device had no address");
     365                dprintf(1, "this is strange, disconnected device had no address");
    368366                //device was disconnected before it`s port was reset - return default address
    369367                usb_drv_release_default_address(hc);
     
    379377static void usb_hub_process_interrupt(usb_hub_info_t * hub, int hc,
    380378        uint16_t port, usb_address_t address) {
    381         dprintf(1,"[usb_hub] interrupt at port %d", port);
     379        dprintf(1, "interrupt at port %d", port);
    382380        //determine type of change
    383381        usb_target_t target;
     
    397395                        );
    398396        if (opResult != EOK) {
    399                 dprintf(1,"[usb_hub] ERROR: could not get port status");
     397                dprintf(1, "ERROR: could not get port status");
    400398                return;
    401399        }
    402400        if (rcvd_size != sizeof (usb_port_status_t)) {
    403                 dprintf(1,"[usb_hub] ERROR: received status has incorrect size");
     401                dprintf(1, "ERROR: received status has incorrect size");
    404402                return;
    405403        }
     
    410408                // TODO: check opResult
    411409                if (usb_port_dev_connected(&status)) {
    412                         dprintf(1,"[usb_hub] some connection changed");
     410                        dprintf(1, "some connection changed");
    413411                        usb_hub_init_add_device(hc, port, target);
    414412                } else {
     
    418416        //port reset
    419417        if (usb_port_reset_completed(&status)) {
    420                 dprintf(1,"[usb_hub] port reset complete");
     418                dprintf(1, "port reset complete");
    421419                if (usb_port_enabled(&status)) {
    422420                        usb_hub_finalize_add_device(hub, hc, port, target);
    423421                } else {
    424                         dprintf(1,"[usb_hub] ERROR: port reset, but port still not enabled");
     422                        dprintf(1, "ERROR: port reset, but port still not enabled");
    425423                }
    426424        }
     
    431429        usb_port_set_dev_connected(&status, false);
    432430        if (status>>16) {
    433                 dprintf(1,"[usb_hub]there was some unsupported change on port %d: %X",port,status);
     431                dprintf(1, "there was some unsupported change on port %d: %X",port,status);
    434432
    435433        }
     
    460458                target.address = hub_info->usb_device->address;
    461459                target.endpoint = 1;/// \TODO get from endpoint descriptor
    462                 /*dprintf(1,"[usb_hub] checking changes for hub at addr %d",
    463                     target.address);*/
     460                dprintf(1, "checking changes for hub at addr %d",
     461                    target.address);
    464462
    465463                size_t port_count = hub_info->port_count;
     
    490488
    491489                if (opResult != EOK) {
    492                         dprintf(1,"[usb_hub] something went wrong while getting status of hub");
     490                        dprintf(1, "something went wrong while getting status of hub");
    493491                        continue;
    494492                }
Note: See TracChangeset for help on using the changeset viewer.