r1922 - in trunk/src/host/qemu-neo1973: . hw
andrew at sita.openmoko.org
andrew at sita.openmoko.org
Mon May 7 19:22:33 CEST 2007
Author: andrew
Date: 2007-05-07 19:22:31 +0200 (Mon, 07 May 2007)
New Revision: 1922
Modified:
trunk/src/host/qemu-neo1973/hw/s3c24xx_udc.c
trunk/src/host/qemu-neo1973/usb-linux-gadget.c
Log:
Mask out all signals during gadgetfs writes to avoid interrupted calls (gadgtefs deficiency).
Modified: trunk/src/host/qemu-neo1973/hw/s3c24xx_udc.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/s3c24xx_udc.c 2007-05-07 16:05:49 UTC (rev 1921)
+++ trunk/src/host/qemu-neo1973/hw/s3c24xx_udc.c 2007-05-07 17:22:31 UTC (rev 1922)
@@ -637,6 +637,11 @@
}
/* TODO: DMA */
}
+ /* Perhaps it is a good idea to return USB_RET_ASYNC here and in
+ * USB_TOKEN_SETUP and trigger completion only after OUT_PKT_RDY
+ * condition is serviced by the guest to avoid potential overruns
+ * and so that the host can know about timeouts (seems there's no
+ * way to indicate other errors asynchronously). */
break;
default:
fail:
Modified: trunk/src/host/qemu-neo1973/usb-linux-gadget.c
===================================================================
--- trunk/src/host/qemu-neo1973/usb-linux-gadget.c 2007-05-07 16:05:49 UTC (rev 1921)
+++ trunk/src/host/qemu-neo1973/usb-linux-gadget.c 2007-05-07 17:22:31 UTC (rev 1922)
@@ -24,6 +24,7 @@
#include <linux/usb_ch9.h>
#include <linux/usb_gadgetfs.h>
#include <poll.h>
+#include <signal.h>
/* Must be after usb_ch9.h */
#include "vl.h"
@@ -142,7 +143,8 @@
} else if (ret == USB_RET_ASYNC) {
ep->busy = 1;
} else {
- fprintf(stderr, "%s: packet unhandled: %i\n", __FUNCTION__, ret);
+ fprintf(stderr, "%s: EP%i packet unhandled: %i\n", __FUNCTION__,
+ ep->num, ret);
if (ret != USB_RET_NAK)
gadget_detach(ep->state);
}
@@ -167,9 +169,16 @@
static void gadget_token_in(USBPacket *packet, void *opaque)
{
struct ep_s *ep = (struct ep_s *) opaque;
+ sigset_t new, old;
ep->busy = 0;
+ sigfillset(&new);
+ /* The packets reach 1.5 kB and the loop alone, with unblocked
+ * signals locks qemu up for ~10s until a 1.5 kB write succeeds
+ * uninterrupted. */
+ pthread_sigmask(SIG_BLOCK, &new, &old);
while (write(ep->fd, packet->data, packet->len) < packet->len &&
errno == EINTR);
+ pthread_sigmask(SIG_SETMASK, &old, 0);
}
#if 0
More information about the commitlog
mailing list