Changeset 7d20461 in mainline


Ignore:
Timestamp:
2013-01-27T12:05:00Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
25effe2
Parents:
7363fc1
Message:

usbinfo: style

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/usbinfo/info.c

    r7363fc1 r7d20461  
    354354{
    355355        int rc;
    356         uint16_t device_status = 0;
    357         uint16_t ctrl_pipe_status = 0;
     356        uint16_t status = 0;
    358357
    359358        /* Device status first. */
    360359        rc = usb_request_get_status(&dev->ctrl_pipe,
    361             USB_REQUEST_RECIPIENT_DEVICE, 0,
    362             &device_status);
     360            USB_REQUEST_RECIPIENT_DEVICE, 0, &status);
    363361        if (rc != EOK) {
    364362                printf("%sFailed to get device status: %s.\n",
    365363                    get_indent(0), str_error(rc));
    366                 goto try_ctrl_pipe_status;
    367         }
    368 
    369         printf("%sDevice status 0x%04x: power=%s, remote-wakeup=%s.\n",
    370             get_indent(0),
    371             device_status,
    372             device_status & USB_DEVICE_STATUS_SELF_POWERED ? "self" : "bus",
    373             device_status & USB_DEVICE_STATUS_REMOTE_WAKEUP ? "yes" : "no");
     364        } else {
     365                printf("%sDevice status 0x%04x: power=%s, remote-wakeup=%s.\n",
     366                    get_indent(0), status,
     367                    status & USB_DEVICE_STATUS_SELF_POWERED ? "self" : "bus",
     368                    status & USB_DEVICE_STATUS_REMOTE_WAKEUP ? "yes" : "no");
     369        }
    374370
    375371        /* Interface is not interesting, skipping ;-). */
    376372
    377373        /* Control endpoint zero. */
    378 try_ctrl_pipe_status:
     374        status = 0;
    379375        rc = usb_request_get_status(&dev->ctrl_pipe,
    380             USB_REQUEST_RECIPIENT_ENDPOINT, 0,
    381             &ctrl_pipe_status);
     376            USB_REQUEST_RECIPIENT_ENDPOINT, 0, &status);
    382377        if (rc != EOK) {
    383378                printf("%sFailed to get control endpoint status: %s.\n",
    384379                    get_indent(0), str_error(rc));
    385                 goto leave;
    386         }
    387 
    388         printf("%sControl endpoint zero status %04X: halted=%s.\n",
    389             get_indent(0),
    390             ctrl_pipe_status,
    391             ctrl_pipe_status & USB_ENDPOINT_STATUS_HALTED ? "yes" : "no");
    392 
    393 leave:
    394         return;
     380        } else {
     381                printf("%sControl endpoint zero status %04X: halted=%s.\n",
     382                    get_indent(0), status,
     383                    status & USB_ENDPOINT_STATUS_HALTED ? "yes" : "no");
     384        }
    395385}
    396386
Note: See TracChangeset for help on using the changeset viewer.