summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/serial
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2014-09-12 22:40:12 +0000
committerhselasky <hselasky@FreeBSD.org>2014-09-12 22:40:12 +0000
commit9bf7e49bfc27b3ec422834dbed634445004aa420 (patch)
treeb52406708f13c8787b13c0caff9fb59eda5fe024 /sys/dev/usb/serial
parent59fee6caf1f5c4be4c57cebb3b4c69af28bc2f00 (diff)
downloadFreeBSD-src-9bf7e49bfc27b3ec422834dbed634445004aa420.zip
FreeBSD-src-9bf7e49bfc27b3ec422834dbed634445004aa420.tar.gz
Workaround for receiving Voice Calls using the E1750 dongle from
Huawei. It might appear as if the firmware is allocating memory blocks according to the USB transfer size and if there is initially a lot of data, like at the answering machine prompt, it simply dies without any apparent reason. The simple workaround for this is to force a zero length packet at hardware level after every 512 bytes of data. This will force the other side to use smaller memory blocks aswell. MFC after: 1 week
Diffstat (limited to 'sys/dev/usb/serial')
-rw-r--r--sys/dev/usb/serial/u3g.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c
index bbf5351..59215e4 100644
--- a/sys/dev/usb/serial/u3g.c
+++ b/sys/dev/usb/serial/u3g.c
@@ -75,6 +75,8 @@ SYSCTL_INT(_hw_usb_u3g, OID_AUTO, debug, CTLFLAG_RW,
#define U3G_MAXPORTS 12
#define U3G_CONFIG_INDEX 0
#define U3G_BSIZE 2048
+#define U3G_TXSIZE (U3G_BSIZE / U3G_TXFRAMES)
+#define U3G_TXFRAMES 4
/* Eject methods; See also usb_quirks.h:UQ_MSC_EJECT_* */
#define U3GINIT_HUAWEI 1 /* Requires Huawei init command */
@@ -145,6 +147,7 @@ static const struct usb_config u3g_config[U3G_N_TRANSFER] = {
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
.bufsize = U3G_BSIZE,/* bytes */
+ .frames = U3G_TXFRAMES,
.flags = {.pipe_bof = 1,.force_short_xfer = 1,},
.callback = &u3g_write_callback,
},
@@ -1011,14 +1014,22 @@ u3g_write_callback(struct usb_xfer *xfer, usb_error_t error)
struct ucom_softc *ucom = usbd_xfer_softc(xfer);
struct usb_page_cache *pc;
uint32_t actlen;
+ uint32_t frame;
switch (USB_GET_STATE(xfer)) {
case USB_ST_TRANSFERRED:
case USB_ST_SETUP:
tr_setup:
- pc = usbd_xfer_get_frame(xfer, 0);
- if (ucom_get_data(ucom, pc, 0, U3G_BSIZE, &actlen)) {
- usbd_xfer_set_frame_len(xfer, 0, actlen);
+ for (frame = 0; frame != U3G_TXFRAMES; frame++) {
+ usbd_xfer_set_frame_offset(xfer, frame * U3G_TXSIZE, frame);
+
+ pc = usbd_xfer_get_frame(xfer, frame);
+ if (ucom_get_data(ucom, pc, 0, U3G_TXSIZE, &actlen) == 0)
+ break;
+ usbd_xfer_set_frame_len(xfer, frame, actlen);
+ }
+ if (frame != 0) {
+ usbd_xfer_set_frames(xfer, frame);
usbd_transfer_submit(xfer);
}
break;
OpenPOWER on IntegriCloud