diff options
| author | jmorse <jmorse@NetBSD.org> | 2008-11-28 17:20:02 +0000 |
|---|---|---|
| committer | jmorse <jmorse@NetBSD.org> | 2008-11-28 17:20:02 +0000 |
| commit | 4f7247f18505faa1c72890481e628cee835173df (patch) | |
| tree | 6b1f471b5b60a2ca0e2da562522b96e461369dfe /sys/dev | |
| parent | 3ce0341c47e8c097e3dbfc416fb19f26224f07a4 (diff) | |
Modified uvideo_stream_init_desc to correctly calculate max packet size for high speed endpoints.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/uvideo.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c index 9bcedec1d7d..eef8f01b20b 100644 --- a/sys/dev/usb/uvideo.c +++ b/sys/dev/usb/uvideo.c @@ -1,4 +1,4 @@ -/* $NetBSD: uvideo.c,v 1.21 2008/09/21 19:26:36 jmcneill Exp $ */ +/* $NetBSD: uvideo.c,v 1.22 2008/11/28 17:20:02 jmorse Exp $ */ /* * Copyright (c) 2008 Patrick Mahoney @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.21 2008/09/21 19:26:36 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.22 2008/11/28 17:20:02 jmorse Exp $"); #ifdef _MODULE #include <sys/module.h> @@ -1160,9 +1160,15 @@ uvideo_stream_init_desc(struct uvideo_stream *vs, alt->interval = GET(usb_endpoint_descriptor_t, desc, bInterval); - alt->max_packet_size = - UGETW(GET(usb_endpoint_descriptor_t, - desc, wMaxPacketSize)); + + alt->max_packet_size = + UE_GET_SIZE(UGETW(GET(usb_endpoint_descriptor_t, + desc, wMaxPacketSize))); + alt->max_packet_size *= + (UE_GET_TRANS(UGETW(GET( + usb_endpoint_descriptor_t, desc, + wMaxPacketSize)))) + 1; + SLIST_INSERT_HEAD(&ix->ix_altlist, alt, entries); } @@ -1476,6 +1482,7 @@ uvideo_stream_start_xfer(struct uvideo_stream *vs) DPRINTF(("uvideo: allocating %u byte buffer\n", bx->bx_buflen)); bx->bx_buffer = usbd_alloc_buffer(bx->bx_xfer, bx->bx_buflen); + if (bx->bx_buffer == NULL) { DPRINTF(("uvideo: couldn't allocate buffer\n")); return ENOMEM; @@ -1531,10 +1538,6 @@ uvideo_stream_start_xfer(struct uvideo_stream *vs) * call into question this method of selecting an * alternate interface... */ - /* XXXJDM don't allow packet size > 1024 for now */ - if (alt_maybe->max_packet_size > 1024) - continue; - if (alt == NULL || alt_maybe->max_packet_size >= alt->max_packet_size) alt = alt_maybe; @@ -1600,6 +1603,7 @@ uvideo_stream_start_xfer(struct uvideo_stream *vs) isoc->i_buf = usbd_alloc_buffer(isoc->i_xfer, nframes * uframe_len); + if (isoc->i_xfer == NULL) { DPRINTF(("uvideo: failed to alloc buf: %s" " (%d)\n", @@ -1823,6 +1827,7 @@ uvideo_stream_recv_isoc_complete(usbd_xfer_handle xfer, } next: + memset(isoc->i_buf, 0x41, ix->ix_nframes * ix->ix_uframe_len); uvideo_stream_recv_isoc_start1(isoc); } |
