67d66
< /* Request types */
71d69
< /* Request codes */
77,78d74
< #define USLCOM_RCTRL		0x08
< #define USLCOM_SET_FLOWCTRL	0x13
80d75
< /* USLCOM_UART values */
84d78
< /* USLCOM_CTRL/USLCOM_RCTRL values */
91d84
< #define USLCOM_CTRL_RI		0x0040
94d86
< /* USLCOM_BAUD_RATE values */
97d88
< /* USLCOM_DATA values */
99a91
> 
106d97
< /* USLCOM_BREAK values */
110,117d100
< /* USLCOM_SET_FLOWCTRL values - 1st word */
< #define USLCOM_FLOW_DTR_ON	0x00000001
< #define USLCOM_FLOW_CTS_HS	0x00000008 /* CTS handshake */
< #define USLCOM_FLOW_RESERVED	0xFFFFFF80
< /* USLCOM_SET_FLOWCTRL values - 2nd word */
< #define USLCOM_FLOW_RTS_ON	0x00000040
< #define USLCOM_FLOW_RTS_HS	0x00000080 /* RTS handshake */
< 
121d103
< 	USLCOM_CTRL_DT_RD,
143d124
< static usb_callback_t uslcom_control_callback;
166c147
< 		.flags = {.pipe_bof = 1,/*.force_short_xfer = 1,*/},
---
> 		.flags = {.pipe_bof = 1,.force_short_xfer = 1,},
178,186d158
< 	[USLCOM_CTRL_DT_RD] = {
< 		.type = UE_CONTROL,
< 		.endpoint = 0x00,
< 		.direction = UE_DIR_ANY,
< 		.interval = 250, /* poll status every 250 ms */
< 		.bufsize = USLCOM_BULK_BUF_SIZE,
< 		.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
< 		.callback = &uslcom_control_callback,
< 	},
293d264
< 	usbd_xfer_set_stall(sc->sc_xfer[USLCOM_CTRL_DT_RD]);
338,339d308
< 	/* Start polling status */
< 	usbd_transfer_start(sc->sc_xfer[USLCOM_CTRL_DT_RD]);
348,350d316
< 	/* Stop polling status */
< 	usbd_transfer_stop(sc->sc_xfer[USLCOM_CTRL_DT_RD]);
< 
425d390
< 	uint32_t flowctrl[4];
476,495d440
< 	
< 	if (t->c_cflag & CRTSCTS) {
< 		flowctrl[0] = USLCOM_FLOW_RESERVED | USLCOM_FLOW_DTR_ON | 
< 			USLCOM_FLOW_CTS_HS;
< 		flowctrl[1] = USLCOM_FLOW_RTS_HS;
< 	} else {
< 		flowctrl[0] = USLCOM_FLOW_RESERVED | USLCOM_FLOW_DTR_ON;
< 		flowctrl[1] = USLCOM_FLOW_RTS_ON;
< 	}
< 	req.bmRequestType = USLCOM_WRITE;
< 	req.bRequest = USLCOM_SET_FLOWCTRL;
< 	USETW(req.wValue, 0);
< 	USETW(req.wIndex, USLCOM_PORT_NO);
< 	USETW(req.wLength, sizeof(flowctrl));
< 
<         if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, 
< 	    &req, flowctrl, 0, 1000)) {
< 		DPRINTF("Set flowcontrol failed (ignored)\n");
< 	}
< 	
592,646d536
< uslcom_control_callback(struct usb_xfer *xfer, usb_error_t error)
< {
< 	struct uslcom_softc *sc = usbd_xfer_softc(xfer);
< 	struct usb_page_cache *pc;
< 	uint8_t buf;
< 	struct usb_device_request req;
< 	uint8_t msr = 0;
< 
< 	switch (USB_GET_STATE(xfer)) {
< 	case USB_ST_TRANSFERRED:
< 		pc = usbd_xfer_get_frame(xfer, 1);
< 		usbd_copy_out(pc, 0, &buf, sizeof(buf));
< 		if (buf & USLCOM_CTRL_CTS)
< 			msr |= SER_CTS;
< 		if (buf & USLCOM_CTRL_DSR)
< 			msr |= SER_DSR;
< 		if (buf & USLCOM_CTRL_RI)
< 			msr |= SER_RI;
< 		if (buf & USLCOM_CTRL_DCD)
< 			msr |= SER_DCD;
< 
< 		if (msr != sc->sc_msr) {
< 			DPRINTF("status change msr=0x%02x (was 0x%02x)\n", msr, sc->sc_msr);
< 			sc->sc_msr = msr;
< 			ucom_status_change(&sc->sc_ucom);
< 		}
< 		/* no break */
< 	case USB_ST_SETUP:
< tr_setup:		
< 		req.bmRequestType = USLCOM_READ;
< 		req.bRequest = USLCOM_RCTRL;
< 		USETW(req.wValue, 0);
< 		USETW(req.wIndex, 0);
< 		USETW(req.wLength, sizeof(buf));
< 		
< 		usbd_xfer_set_frames(xfer, 2);
< 		usbd_xfer_set_frame_len(xfer, 0, sizeof(req));
< 		usbd_xfer_set_frame_len(xfer, 1, sizeof(buf));
< 
< 		pc = usbd_xfer_get_frame(xfer, 0);
< 		usbd_copy_in(pc, 0, &req, sizeof(req));
< 		usbd_transfer_submit(xfer);
< 		return;
< 
< 	default:			/* Error */
< 		if (error != USB_ERR_CANCELLED) {
< 			/* try to clear stall first */
< 			usbd_xfer_set_stall(xfer);
< 			goto tr_setup;
< 		}
< 		return;
< 	}
< }
< 
< static void
