.. | .. |
---|
102 | 102 | /* supported video standards */ |
---|
103 | 103 | static struct em28xx_fmt format[] = { |
---|
104 | 104 | { |
---|
105 | | - .name = "16 bpp YUY2, 4:2:2, packed", |
---|
106 | 105 | .fourcc = V4L2_PIX_FMT_YUYV, |
---|
107 | 106 | .depth = 16, |
---|
108 | 107 | .reg = EM28XX_OUTFMT_YUV422_Y0UY1V, |
---|
109 | 108 | }, { |
---|
110 | | - .name = "16 bpp RGB 565, LE", |
---|
111 | 109 | .fourcc = V4L2_PIX_FMT_RGB565, |
---|
112 | 110 | .depth = 16, |
---|
113 | 111 | .reg = EM28XX_OUTFMT_RGB_16_656, |
---|
114 | 112 | }, { |
---|
115 | | - .name = "8 bpp Bayer RGRG..GBGB", |
---|
116 | 113 | .fourcc = V4L2_PIX_FMT_SRGGB8, |
---|
117 | 114 | .depth = 8, |
---|
118 | 115 | .reg = EM28XX_OUTFMT_RGB_8_RGRG, |
---|
119 | 116 | }, { |
---|
120 | | - .name = "8 bpp Bayer BGBG..GRGR", |
---|
121 | 117 | .fourcc = V4L2_PIX_FMT_SBGGR8, |
---|
122 | 118 | .depth = 8, |
---|
123 | 119 | .reg = EM28XX_OUTFMT_RGB_8_BGBG, |
---|
124 | 120 | }, { |
---|
125 | | - .name = "8 bpp Bayer GRGR..BGBG", |
---|
126 | 121 | .fourcc = V4L2_PIX_FMT_SGRBG8, |
---|
127 | 122 | .depth = 8, |
---|
128 | 123 | .reg = EM28XX_OUTFMT_RGB_8_GRGR, |
---|
129 | 124 | }, { |
---|
130 | | - .name = "8 bpp Bayer GBGB..RGRG", |
---|
131 | 125 | .fourcc = V4L2_PIX_FMT_SGBRG8, |
---|
132 | 126 | .depth = 8, |
---|
133 | 127 | .reg = EM28XX_OUTFMT_RGB_8_GBGB, |
---|
134 | 128 | }, { |
---|
135 | | - .name = "12 bpp YUV411", |
---|
136 | 129 | .fourcc = V4L2_PIX_FMT_YUV411P, |
---|
137 | 130 | .depth = 12, |
---|
138 | 131 | .reg = EM28XX_OUTFMT_YUV411, |
---|
.. | .. |
---|
1517 | 1510 | else |
---|
1518 | 1511 | f->fmt.pix.field = v4l2->interlaced_fieldmode ? |
---|
1519 | 1512 | V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; |
---|
1520 | | - f->fmt.pix.priv = 0; |
---|
1521 | 1513 | |
---|
1522 | 1514 | return 0; |
---|
1523 | 1515 | } |
---|
.. | .. |
---|
1678 | 1670 | |
---|
1679 | 1671 | i->type = V4L2_INPUT_TYPE_CAMERA; |
---|
1680 | 1672 | |
---|
1681 | | - strcpy(i->name, iname[INPUT(n)->type]); |
---|
| 1673 | + strscpy(i->name, iname[INPUT(n)->type], sizeof(i->name)); |
---|
1682 | 1674 | |
---|
1683 | 1675 | if (INPUT(n)->type == EM28XX_VMUX_TELEVISION) |
---|
1684 | 1676 | i->type = V4L2_INPUT_TYPE_TUNER; |
---|
.. | .. |
---|
1738 | 1730 | |
---|
1739 | 1731 | switch (idx) { |
---|
1740 | 1732 | case EM28XX_AMUX_VIDEO: |
---|
1741 | | - strcpy(a->name, "Television"); |
---|
| 1733 | + strscpy(a->name, "Television", sizeof(a->name)); |
---|
1742 | 1734 | break; |
---|
1743 | 1735 | case EM28XX_AMUX_LINE_IN: |
---|
1744 | | - strcpy(a->name, "Line In"); |
---|
| 1736 | + strscpy(a->name, "Line In", sizeof(a->name)); |
---|
1745 | 1737 | break; |
---|
1746 | 1738 | case EM28XX_AMUX_VIDEO2: |
---|
1747 | | - strcpy(a->name, "Television alt"); |
---|
| 1739 | + strscpy(a->name, "Television alt", sizeof(a->name)); |
---|
1748 | 1740 | break; |
---|
1749 | 1741 | case EM28XX_AMUX_PHONE: |
---|
1750 | | - strcpy(a->name, "Phone"); |
---|
| 1742 | + strscpy(a->name, "Phone", sizeof(a->name)); |
---|
1751 | 1743 | break; |
---|
1752 | 1744 | case EM28XX_AMUX_MIC: |
---|
1753 | | - strcpy(a->name, "Mic"); |
---|
| 1745 | + strscpy(a->name, "Mic", sizeof(a->name)); |
---|
1754 | 1746 | break; |
---|
1755 | 1747 | case EM28XX_AMUX_CD: |
---|
1756 | | - strcpy(a->name, "CD"); |
---|
| 1748 | + strscpy(a->name, "CD", sizeof(a->name)); |
---|
1757 | 1749 | break; |
---|
1758 | 1750 | case EM28XX_AMUX_AUX: |
---|
1759 | | - strcpy(a->name, "Aux"); |
---|
| 1751 | + strscpy(a->name, "Aux", sizeof(a->name)); |
---|
1760 | 1752 | break; |
---|
1761 | 1753 | case EM28XX_AMUX_PCM_OUT: |
---|
1762 | | - strcpy(a->name, "PCM"); |
---|
| 1754 | + strscpy(a->name, "PCM", sizeof(a->name)); |
---|
1763 | 1755 | break; |
---|
1764 | 1756 | case EM28XX_AMUX_UNUSED: |
---|
1765 | 1757 | default: |
---|
.. | .. |
---|
1845 | 1837 | if (t->index != 0) |
---|
1846 | 1838 | return -EINVAL; |
---|
1847 | 1839 | |
---|
1848 | | - strcpy(t->name, "Tuner"); |
---|
| 1840 | + strscpy(t->name, "Tuner", sizeof(t->name)); |
---|
1849 | 1841 | |
---|
1850 | 1842 | v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, g_tuner, t); |
---|
1851 | 1843 | return 0; |
---|
.. | .. |
---|
1902 | 1894 | if (chip->match.addr > 1) |
---|
1903 | 1895 | return -EINVAL; |
---|
1904 | 1896 | if (chip->match.addr == 1) |
---|
1905 | | - strlcpy(chip->name, "ac97", sizeof(chip->name)); |
---|
| 1897 | + strscpy(chip->name, "ac97", sizeof(chip->name)); |
---|
1906 | 1898 | else |
---|
1907 | | - strlcpy(chip->name, |
---|
| 1899 | + strscpy(chip->name, |
---|
1908 | 1900 | dev->v4l2->v4l2_dev.name, sizeof(chip->name)); |
---|
1909 | 1901 | return 0; |
---|
1910 | 1902 | } |
---|
.. | .. |
---|
1984 | 1976 | static int vidioc_querycap(struct file *file, void *priv, |
---|
1985 | 1977 | struct v4l2_capability *cap) |
---|
1986 | 1978 | { |
---|
1987 | | - struct video_device *vdev = video_devdata(file); |
---|
1988 | 1979 | struct em28xx *dev = video_drvdata(file); |
---|
1989 | 1980 | struct em28xx_v4l2 *v4l2 = dev->v4l2; |
---|
1990 | 1981 | struct usb_device *udev = interface_to_usbdev(dev->intf); |
---|
1991 | 1982 | |
---|
1992 | | - strlcpy(cap->driver, "em28xx", sizeof(cap->driver)); |
---|
1993 | | - strlcpy(cap->card, em28xx_boards[dev->model].name, sizeof(cap->card)); |
---|
| 1983 | + strscpy(cap->driver, "em28xx", sizeof(cap->driver)); |
---|
| 1984 | + strscpy(cap->card, em28xx_boards[dev->model].name, sizeof(cap->card)); |
---|
1994 | 1985 | usb_make_path(udev, cap->bus_info, sizeof(cap->bus_info)); |
---|
1995 | 1986 | |
---|
1996 | | - if (vdev->vfl_type == VFL_TYPE_GRABBER) |
---|
1997 | | - cap->device_caps = V4L2_CAP_READWRITE | |
---|
1998 | | - V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; |
---|
1999 | | - else if (vdev->vfl_type == VFL_TYPE_RADIO) |
---|
2000 | | - cap->device_caps = V4L2_CAP_RADIO; |
---|
2001 | | - else |
---|
2002 | | - cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE; |
---|
2003 | | - |
---|
2004 | | - if (dev->int_audio_type != EM28XX_INT_AUDIO_NONE) |
---|
2005 | | - cap->device_caps |= V4L2_CAP_AUDIO; |
---|
2006 | | - |
---|
2007 | | - if (dev->tuner_type != TUNER_ABSENT) |
---|
2008 | | - cap->device_caps |= V4L2_CAP_TUNER; |
---|
2009 | | - |
---|
2010 | | - cap->capabilities = cap->device_caps | |
---|
2011 | | - V4L2_CAP_DEVICE_CAPS | V4L2_CAP_READWRITE | |
---|
| 1987 | + cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_READWRITE | |
---|
2012 | 1988 | V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; |
---|
| 1989 | + if (dev->int_audio_type != EM28XX_INT_AUDIO_NONE) |
---|
| 1990 | + cap->capabilities |= V4L2_CAP_AUDIO; |
---|
| 1991 | + if (dev->tuner_type != TUNER_ABSENT) |
---|
| 1992 | + cap->capabilities |= V4L2_CAP_TUNER; |
---|
2013 | 1993 | if (video_is_registered(&v4l2->vbi_dev)) |
---|
2014 | 1994 | cap->capabilities |= V4L2_CAP_VBI_CAPTURE; |
---|
2015 | 1995 | if (video_is_registered(&v4l2->radio_dev)) |
---|
.. | .. |
---|
2023 | 2003 | if (unlikely(f->index >= ARRAY_SIZE(format))) |
---|
2024 | 2004 | return -EINVAL; |
---|
2025 | 2005 | |
---|
2026 | | - strlcpy(f->description, format[f->index].name, sizeof(f->description)); |
---|
2027 | 2006 | f->pixelformat = format[f->index].fourcc; |
---|
2028 | 2007 | |
---|
2029 | 2008 | return 0; |
---|
.. | .. |
---|
2114 | 2093 | if (unlikely(t->index > 0)) |
---|
2115 | 2094 | return -EINVAL; |
---|
2116 | 2095 | |
---|
2117 | | - strcpy(t->name, "Radio"); |
---|
| 2096 | + strscpy(t->name, "Radio", sizeof(t->name)); |
---|
2118 | 2097 | |
---|
2119 | 2098 | v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, g_tuner, t); |
---|
2120 | 2099 | |
---|
.. | .. |
---|
2162 | 2141 | int ret; |
---|
2163 | 2142 | |
---|
2164 | 2143 | switch (vdev->vfl_type) { |
---|
2165 | | - case VFL_TYPE_GRABBER: |
---|
| 2144 | + case VFL_TYPE_VIDEO: |
---|
2166 | 2145 | fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
---|
2167 | 2146 | break; |
---|
2168 | 2147 | case VFL_TYPE_VBI: |
---|
.. | .. |
---|
2220 | 2199 | /* |
---|
2221 | 2200 | * em28xx_v4l2_fini() |
---|
2222 | 2201 | * unregisters the v4l2,i2c and usb devices |
---|
2223 | | - * called when the device gets disconected or at module unload |
---|
| 2202 | + * called when the device gets disconnected or at module unload |
---|
2224 | 2203 | */ |
---|
2225 | 2204 | static int em28xx_v4l2_fini(struct em28xx *dev) |
---|
2226 | 2205 | { |
---|
.. | .. |
---|
2782 | 2761 | mutex_init(&v4l2->vb_vbi_queue_lock); |
---|
2783 | 2762 | v4l2->vdev.queue = &v4l2->vb_vidq; |
---|
2784 | 2763 | v4l2->vdev.queue->lock = &v4l2->vb_queue_lock; |
---|
| 2764 | + v4l2->vdev.device_caps = V4L2_CAP_READWRITE | V4L2_CAP_VIDEO_CAPTURE | |
---|
| 2765 | + V4L2_CAP_STREAMING; |
---|
| 2766 | + if (dev->int_audio_type != EM28XX_INT_AUDIO_NONE) |
---|
| 2767 | + v4l2->vdev.device_caps |= V4L2_CAP_AUDIO; |
---|
| 2768 | + if (dev->tuner_type != TUNER_ABSENT) |
---|
| 2769 | + v4l2->vdev.device_caps |= V4L2_CAP_TUNER; |
---|
| 2770 | + |
---|
2785 | 2771 | |
---|
2786 | 2772 | /* disable inapplicable ioctls */ |
---|
2787 | 2773 | if (dev->is_webcam) { |
---|
.. | .. |
---|
2803 | 2789 | } |
---|
2804 | 2790 | |
---|
2805 | 2791 | /* register v4l2 video video_device */ |
---|
2806 | | - ret = video_register_device(&v4l2->vdev, VFL_TYPE_GRABBER, |
---|
| 2792 | + ret = video_register_device(&v4l2->vdev, VFL_TYPE_VIDEO, |
---|
2807 | 2793 | video_nr[dev->devno]); |
---|
2808 | 2794 | if (ret) { |
---|
2809 | 2795 | dev_err(&dev->intf->dev, |
---|
.. | .. |
---|
2818 | 2804 | |
---|
2819 | 2805 | v4l2->vbi_dev.queue = &v4l2->vb_vbiq; |
---|
2820 | 2806 | v4l2->vbi_dev.queue->lock = &v4l2->vb_vbi_queue_lock; |
---|
| 2807 | + v4l2->vbi_dev.device_caps = V4L2_CAP_STREAMING | |
---|
| 2808 | + V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE; |
---|
| 2809 | + if (dev->tuner_type != TUNER_ABSENT) |
---|
| 2810 | + v4l2->vbi_dev.device_caps |= V4L2_CAP_TUNER; |
---|
2821 | 2811 | |
---|
2822 | 2812 | /* disable inapplicable ioctls */ |
---|
2823 | 2813 | v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_PARM); |
---|
.. | .. |
---|
2845 | 2835 | if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) { |
---|
2846 | 2836 | em28xx_vdev_init(dev, &v4l2->radio_dev, &em28xx_radio_template, |
---|
2847 | 2837 | "radio"); |
---|
| 2838 | + v4l2->radio_dev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER; |
---|
2848 | 2839 | ret = video_register_device(&v4l2->radio_dev, VFL_TYPE_RADIO, |
---|
2849 | 2840 | radio_nr[dev->devno]); |
---|
2850 | 2841 | if (ret < 0) { |
---|