Deleted Added
full compact
18c18
< * $FreeBSD: head/sys/dev/usb2/serial/uark2.c 187970 2009-02-01 00:51:25Z thompsa $
---
> * $FreeBSD: head/sys/dev/usb2/serial/uark2.c 188413 2009-02-09 22:05:25Z thompsa $
67,69c67
< UARK_BULK_CS_WR,
< UARK_BULK_CS_RD,
< UARK_N_TRANSFER = 4,
---
> UARK_N_TRANSFER,
79,81d76
< uint8_t sc_flags;
< #define UARK_FLAG_BULK_READ_STALL 0x01
< #define UARK_FLAG_BULK_WRITE_STALL 0x02
93d87
< static usb2_callback_t uark_bulk_write_clear_stall_callback;
95d88
< static usb2_callback_t uark_bulk_read_clear_stall_callback;
128,149d120
<
< [UARK_BULK_CS_WR] = {
< .type = UE_CONTROL,
< .endpoint = 0x00, /* Control pipe */
< .direction = UE_DIR_ANY,
< .mh.bufsize = sizeof(struct usb2_device_request),
< .mh.flags = {},
< .mh.callback = &uark_bulk_write_clear_stall_callback,
< .mh.timeout = 1000, /* 1 second */
< .mh.interval = 50, /* 50ms */
< },
<
< [UARK_BULK_CS_RD] = {
< .type = UE_CONTROL,
< .endpoint = 0x00, /* Control pipe */
< .direction = UE_DIR_ANY,
< .mh.bufsize = sizeof(struct usb2_device_request),
< .mh.flags = {},
< .mh.callback = &uark_bulk_read_clear_stall_callback,
< .mh.timeout = 1000, /* 1 second */
< .mh.interval = 50, /* 50ms */
< },
227,228c198,199
< sc->sc_flags |= (UARK_FLAG_BULK_WRITE_STALL |
< UARK_FLAG_BULK_READ_STALL);
---
> usb2_transfer_set_stall(sc->sc_xfer[UARK_BULK_DT_WR]);
> usb2_transfer_set_stall(sc->sc_xfer[UARK_BULK_DT_RD]);
264,267c235
< if (sc->sc_flags & UARK_FLAG_BULK_WRITE_STALL) {
< usb2_transfer_start(sc->sc_xfer[UARK_BULK_CS_WR]);
< return;
< }
---
> tr_setup:
277,278c245,247
< sc->sc_flags |= UARK_FLAG_BULK_WRITE_STALL;
< usb2_transfer_start(sc->sc_xfer[UARK_BULK_CS_WR]);
---
> /* try to clear stall first */
> xfer->flags.stall_pipe = 1;
> goto tr_setup;
286,298d254
< uark_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
< {
< struct uark_softc *sc = xfer->priv_sc;
< struct usb2_xfer *xfer_other = sc->sc_xfer[UARK_BULK_DT_WR];
<
< if (usb2_clear_stall_callback(xfer, xfer_other)) {
< DPRINTF("stall cleared\n");
< sc->sc_flags &= ~UARK_FLAG_BULK_WRITE_STALL;
< usb2_transfer_start(xfer_other);
< }
< }
<
< static void
309,314c265,267
< if (sc->sc_flags & UARK_FLAG_BULK_READ_STALL) {
< usb2_transfer_start(sc->sc_xfer[UARK_BULK_CS_RD]);
< } else {
< xfer->frlengths[0] = xfer->max_data_length;
< usb2_start_hardware(xfer);
< }
---
> tr_setup:
> xfer->frlengths[0] = xfer->max_data_length;
> usb2_start_hardware(xfer);
319,320c272,274
< sc->sc_flags |= UARK_FLAG_BULK_READ_STALL;
< usb2_transfer_start(sc->sc_xfer[UARK_BULK_CS_RD]);
---
> /* try to clear stall first */
> xfer->flags.stall_pipe = 1;
> goto tr_setup;
323d276
<
328,340d280
< uark_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
< {
< struct uark_softc *sc = xfer->priv_sc;
< struct usb2_xfer *xfer_other = sc->sc_xfer[UARK_BULK_DT_RD];
<
< if (usb2_clear_stall_callback(xfer, xfer_other)) {
< DPRINTF("stall cleared\n");
< sc->sc_flags &= ~UARK_FLAG_BULK_READ_STALL;
< usb2_transfer_start(xfer_other);
< }
< }
<
< static void
353d292
< usb2_transfer_stop(sc->sc_xfer[UARK_BULK_CS_RD]);
370d308
< usb2_transfer_stop(sc->sc_xfer[UARK_BULK_CS_WR]);
457,459d394
< if (usb2_com_cfg_is_gone(&sc->sc_ucom)) {
< return;
< }
466,468c401,402
< err = usb2_do_request_flags
< (sc->sc_udev, &Giant, &req, NULL, 0, NULL, 1000);
<
---
> err = usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
> &req, NULL, 0, 1000);