Changeset 9c0f158 in mainline for uspace/app/usbinfo/info.c


Ignore:
Timestamp:
2011-03-25T15:21:01Z (13 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
57d9c05e
Parents:
96bfe76 (diff), f08c560 (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:

development merge

File:
1 edited

Legend:

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

    r96bfe76 r9c0f158  
    294294}
    295295
     296
     297void dump_status(usbinfo_device_t *dev)
     298{
     299        int rc;
     300        uint16_t device_status = 0;
     301        uint16_t ctrl_pipe_status = 0;
     302
     303        /* Device status first. */
     304        rc = usb_request_get_status(&dev->ctrl_pipe,
     305            USB_REQUEST_RECIPIENT_DEVICE, 0,
     306            &device_status);
     307        if (rc != EOK) {
     308                printf("%sFailed to get device status: %s.\n",
     309                    get_indent(0), str_error(rc));
     310                goto try_ctrl_pipe_status;
     311        }
     312
     313        printf("%sDevice status 0x%04x: power=%s, remote-wakeup=%s.\n",
     314            get_indent(0),
     315            device_status,
     316            device_status & USB_DEVICE_STATUS_SELF_POWERED ? "self" : "bus",
     317            device_status & USB_DEVICE_STATUS_REMOTE_WAKEUP ? "yes" : "no");
     318
     319        /* Interface is not interesting, skipping ;-). */
     320
     321        /* Control endpoint zero. */
     322try_ctrl_pipe_status:
     323        rc = usb_request_get_status(&dev->ctrl_pipe,
     324            USB_REQUEST_RECIPIENT_ENDPOINT, 0,
     325            &ctrl_pipe_status);
     326        if (rc != EOK) {
     327                printf("%sFailed to get control endpoint status: %s.\n",
     328                    get_indent(0), str_error(rc));
     329                goto leave;
     330        }
     331
     332        printf("%sControl endpoint zero status %04X: halted=%s.\n",
     333            get_indent(0),
     334            ctrl_pipe_status,
     335            ctrl_pipe_status & USB_ENDPOINT_STATUS_HALTED ? "yes" : "no");
     336
     337leave:
     338        return;
     339}
     340
    296341/** @}
    297342 */
Note: See TracChangeset for help on using the changeset viewer.