Lines Matching defs:ctrl
131 struct ctrl_struct ctrl;
222 switch(s->ctrl.state) {
224 if (p->len < s->ctrl.len)
225 s->ctrl.len = p->len;
226 s->ctrl.state = CTRL_STATE_DATA;
231 s->ctrl.state = CTRL_STATE_IDLE;
354 struct usbdevfs_ioctl ctrl;
356 ctrl.ioctl_code = USBDEVFS_DISCONNECT;
357 ctrl.ifno = interface;
358 ret = ioctl(dev->fd, USBDEVFS_IOCTL, &ctrl);
511 dprintf("husb: ctrl set addr %u\n", addr);
522 dprintf("husb: ctrl set config %d ret %d errno %d\n", config, ret, errno);
540 dprintf("husb: ctrl set iface %d altset %d ret %d errno %d\n",
560 value = le16_to_cpu(s->ctrl.req.wValue);
561 index = le16_to_cpu(s->ctrl.req.wIndex);
563 dprintf("husb: ctrl type 0x%x req 0x%x val 0x%x index %u len %u\n",
564 s->ctrl.req.bRequestType, s->ctrl.req.bRequest, value, index,
565 s->ctrl.len);
567 if (s->ctrl.req.bRequestType == 0) {
568 switch (s->ctrl.req.bRequest) {
577 if (s->ctrl.req.bRequestType == 1 &&
578 s->ctrl.req.bRequest == USB_REQ_SET_INTERFACE)
588 * Setup ctrl transfer.
590 * s->ctrl is layed out such that data buffer immediately follows
598 urb->buffer = &s->ctrl.req;
599 urb->buffer_length = 8 + s->ctrl.len;
605 dprintf("husb: submit ctrl. len %u aurb %p\n", urb->buffer_length, aurb);
632 memcpy(&s->ctrl.req, p->data, 8);
633 s->ctrl.len = le16_to_cpu(s->ctrl.req.wLength);
634 s->ctrl.offset = 0;
635 s->ctrl.state = CTRL_STATE_SETUP;
637 if (s->ctrl.req.bRequestType & USB_DIR_IN) {
642 if (ret < s->ctrl.len)
643 s->ctrl.len = ret;
644 s->ctrl.state = CTRL_STATE_DATA;
646 if (s->ctrl.len == 0)
647 s->ctrl.state = CTRL_STATE_ACK;
649 s->ctrl.state = CTRL_STATE_DATA;
663 switch(s->ctrl.state) {
665 if (!(s->ctrl
670 s->ctrl.state = CTRL_STATE_IDLE;
677 if (s->ctrl.req.bRequestType & USB_DIR_IN) {
678 int len = s->ctrl.len - s->ctrl.offset;
681 memcpy(p->data, s->ctrl.buffer + s->ctrl.offset, len);
682 s->ctrl.offset += len;
683 if (s->ctrl.offset >= s->ctrl.len)
684 s->ctrl.state = CTRL_STATE_ACK;
688 s->ctrl.state = CTRL_STATE_IDLE;
703 switch(s->ctrl.state) {
705 if (s->ctrl.req.bRequestType & USB_DIR_IN) {
706 s->ctrl.state = CTRL_STATE_IDLE;
714 if (!(s->ctrl.req.bRequestType & USB_DIR_IN)) {
715 int len = s->ctrl.len - s->ctrl.offset;
718 memcpy(s->ctrl.buffer + s->ctrl.offset, p->data, len);
719 s->ctrl.offset += len;
720 if (s->ctrl.offset >= s->ctrl.len)
721 s->ctrl.state = CTRL_STATE_ACK;
725 s->ctrl.state = CTRL_STATE_IDLE;