diff options
author | Laurent Pinchart <laurent.pinchart@skynet.be> | 2008-07-21 22:07:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-08-01 12:43:08 -0700 |
commit | dcdc61d2c15e9121550928a1a7dc0cf1616b83fc (patch) | |
tree | efef07196d327d7cc1f7e4ee80b3c11a54228440 | |
parent | 9dfab57400864516e63f2c811a194ca78fd01155 (diff) |
V4L: uvcvideo: Make input device support optional
(cherry picked from commit 6833c917b4de1757febdbf946d709ece6dc7a86f)
V4L: uvcvideo: Make input device support optional
UVC devices can report button events. The uvcvideo driver depends on
CONFIG_INPUT to report events to the input layer. This patch removes the hard
dependency by introducing a new CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV option.
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/media/video/Kconfig | 8 | ||||
-rw-r--r-- | drivers/media/video/uvc/Kconfig | 17 | ||||
-rw-r--r-- | drivers/media/video/uvc/uvc_status.c | 17 |
3 files changed, 33 insertions, 9 deletions
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 5ccb0aeca8c..e00717d71ee 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -793,13 +793,7 @@ menuconfig V4L_USB_DRIVERS if V4L_USB_DRIVERS && USB -config USB_VIDEO_CLASS - tristate "USB Video Class (UVC)" - ---help--- - Support for the USB Video Class (UVC). Currently only video - input devices, such as webcams, are supported. - - For more information see: <http://linux-uvc.berlios.de/> +source "drivers/media/video/uvc/Kconfig" source "drivers/media/video/pvrusb2/Kconfig" diff --git a/drivers/media/video/uvc/Kconfig b/drivers/media/video/uvc/Kconfig new file mode 100644 index 00000000000..c2d9760de83 --- /dev/null +++ b/drivers/media/video/uvc/Kconfig @@ -0,0 +1,17 @@ +config USB_VIDEO_CLASS + tristate "USB Video Class (UVC)" + ---help--- + Support for the USB Video Class (UVC). Currently only video + input devices, such as webcams, are supported. + + For more information see: <http://linux-uvc.berlios.de/> + +config USB_VIDEO_CLASS_INPUT_EVDEV + bool "UVC input events device support" + default y + depends on USB_VIDEO_CLASS && INPUT + ---help--- + This option makes USB Video Class devices register an input device + to report button events. + + If you are in doubt, say Y. diff --git a/drivers/media/video/uvc/uvc_status.c b/drivers/media/video/uvc/uvc_status.c index 06b47980ed9..eb2f97090a3 100644 --- a/drivers/media/video/uvc/uvc_status.c +++ b/drivers/media/video/uvc/uvc_status.c @@ -22,6 +22,7 @@ /* -------------------------------------------------------------------------- * Input device */ +#ifdef CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV static int uvc_input_init(struct uvc_device *dev) { struct usb_device *udev = dev->udev; @@ -67,6 +68,19 @@ static void uvc_input_cleanup(struct uvc_device *dev) input_unregister_device(dev->input); } +static void uvc_input_report_key(struct uvc_device *dev, unsigned int code, + int value) +{ + if (dev->input) + input_report_key(dev->input, code, value); +} + +#else +#define uvc_input_init(dev) +#define uvc_input_cleanup(dev) +#define uvc_input_report_key(dev, code, value) +#endif /* CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV */ + /* -------------------------------------------------------------------------- * Status interrupt endpoint */ @@ -83,8 +97,7 @@ static void uvc_event_streaming(struct uvc_device *dev, __u8 *data, int len) return; uvc_trace(UVC_TRACE_STATUS, "Button (intf %u) %s len %d\n", data[1], data[3] ? "pressed" : "released", len); - if (dev->input) - input_report_key(dev->input, BTN_0, data[3]); + uvc_input_report_key(dev, BTN_0, data[3]); } else { uvc_trace(UVC_TRACE_STATUS, "Stream %u error event %02x %02x " "len %d.\n", data[1], data[2], data[3], len); |