| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: uvideo.c,v 1.14 2008/09/20 15:55:38 jmcneill Exp $ */ | | 1 | /* $NetBSD: uvideo.c,v 1.15 2008/09/20 18:17:56 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2008 Patrick Mahoney | | 4 | * Copyright (c) 2008 Patrick Mahoney |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code was written by Patrick Mahoney (pat@polycrystal.org) as | | 7 | * This code was written by Patrick Mahoney (pat@polycrystal.org) as |
8 | * part of Google Summer of Code 2008. | | 8 | * part of Google Summer of Code 2008. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -32,27 +32,27 @@ | | | @@ -32,27 +32,27 @@ |
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
36 | * POSSIBILITY OF SUCH DAMAGE. | | 36 | * POSSIBILITY OF SUCH DAMAGE. |
37 | */ | | 37 | */ |
38 | | | 38 | |
39 | /* | | 39 | /* |
40 | * USB video specs: | | 40 | * USB video specs: |
41 | * http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip | | 41 | * http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip |
42 | */ | | 42 | */ |
43 | | | 43 | |
44 | #include <sys/cdefs.h> | | 44 | #include <sys/cdefs.h> |
45 | __KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.14 2008/09/20 15:55:38 jmcneill Exp $"); | | 45 | __KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.15 2008/09/20 18:17:56 jmcneill Exp $"); |
46 | | | 46 | |
47 | #ifdef _MODULE | | 47 | #ifdef _MODULE |
48 | #include <sys/module.h> | | 48 | #include <sys/module.h> |
49 | #endif | | 49 | #endif |
50 | | | 50 | |
51 | #include <sys/param.h> | | 51 | #include <sys/param.h> |
52 | #include <sys/systm.h> | | 52 | #include <sys/systm.h> |
53 | #include <sys/kernel.h> | | 53 | #include <sys/kernel.h> |
54 | /* #include <sys/malloc.h> */ | | 54 | /* #include <sys/malloc.h> */ |
55 | #include <sys/kmem.h> | | 55 | #include <sys/kmem.h> |
56 | #include <sys/device.h> | | 56 | #include <sys/device.h> |
57 | #include <sys/ioctl.h> | | 57 | #include <sys/ioctl.h> |
58 | #include <sys/uio.h> | | 58 | #include <sys/uio.h> |
| @@ -1245,26 +1245,28 @@ uvideo_stream_init_frame_based_format(st | | | @@ -1245,26 +1245,28 @@ uvideo_stream_init_frame_based_format(st |
1245 | switch (format_desc->bDescriptorSubtype) { | | 1245 | switch (format_desc->bDescriptorSubtype) { |
1246 | case UDESC_VS_FORMAT_UNCOMPRESSED: | | 1246 | case UDESC_VS_FORMAT_UNCOMPRESSED: |
1247 | subtype = UDESC_VS_FRAME_UNCOMPRESSED; | | 1247 | subtype = UDESC_VS_FRAME_UNCOMPRESSED; |
1248 | default_index = GET(uvideo_vs_format_uncompressed_descriptor_t, | | 1248 | default_index = GET(uvideo_vs_format_uncompressed_descriptor_t, |
1249 | format_desc, | | 1249 | format_desc, |
1250 | bDefaultFrameIndex); | | 1250 | bDefaultFrameIndex); |
1251 | guid = GETP(uvideo_vs_format_uncompressed_descriptor_t, | | 1251 | guid = GETP(uvideo_vs_format_uncompressed_descriptor_t, |
1252 | format_desc, | | 1252 | format_desc, |
1253 | guidFormat); | | 1253 | guidFormat); |
1254 | if (usb_guid_cmp(guid, &uvideo_guid_format_yuy2) == 0) | | 1254 | if (usb_guid_cmp(guid, &uvideo_guid_format_yuy2) == 0) |
1255 | pixel_format = VIDEO_FORMAT_YUY2; | | 1255 | pixel_format = VIDEO_FORMAT_YUY2; |
1256 | else if (usb_guid_cmp(guid, &uvideo_guid_format_nv12) == 0) | | 1256 | else if (usb_guid_cmp(guid, &uvideo_guid_format_nv12) == 0) |
1257 | pixel_format = VIDEO_FORMAT_NV12; | | 1257 | pixel_format = VIDEO_FORMAT_NV12; |
| | | 1258 | else if (usb_guid_cmp(guid, &uvideo_guid_format_uyvy) == 0) |
| | | 1259 | pixel_format = VIDEO_FORMAT_UYVY; |
1258 | break; | | 1260 | break; |
1259 | case UDESC_VS_FORMAT_FRAME_BASED: | | 1261 | case UDESC_VS_FORMAT_FRAME_BASED: |
1260 | subtype = UDESC_VS_FRAME_FRAME_BASED; | | 1262 | subtype = UDESC_VS_FRAME_FRAME_BASED; |
1261 | default_index = GET(uvideo_format_frame_based_descriptor_t, | | 1263 | default_index = GET(uvideo_format_frame_based_descriptor_t, |
1262 | format_desc, | | 1264 | format_desc, |
1263 | bDefaultFrameIndex); | | 1265 | bDefaultFrameIndex); |
1264 | break; | | 1266 | break; |
1265 | case UDESC_VS_FORMAT_MJPEG: | | 1267 | case UDESC_VS_FORMAT_MJPEG: |
1266 | subtype = UDESC_VS_FRAME_MJPEG; | | 1268 | subtype = UDESC_VS_FRAME_MJPEG; |
1267 | default_index = GET(uvideo_vs_format_mjpeg_descriptor_t, | | 1269 | default_index = GET(uvideo_vs_format_mjpeg_descriptor_t, |
1268 | format_desc, | | 1270 | format_desc, |
1269 | bDefaultFrameIndex); | | 1271 | bDefaultFrameIndex); |
1270 | pixel_format = VIDEO_FORMAT_MJPEG; | | 1272 | pixel_format = VIDEO_FORMAT_MJPEG; |