summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/uvc/uvc_status.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-07-07 23:04:29 +0000
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-07 23:04:29 +0000
commit4973fcaea035ae074ba9aa1c5bbbaa92e1b1720c (patch)
treeb8ce4cdd81a9ad16b05771e02389297a6a342ab6 /linux/drivers/media/video/uvc/uvc_status.c
parentc13f70467621e2c352f93b336b382e70ea24d218 (diff)
downloadmediapointer-dvb-s2-4973fcaea035ae074ba9aa1c5bbbaa92e1b1720c.tar.gz
mediapointer-dvb-s2-4973fcaea035ae074ba9aa1c5bbbaa92e1b1720c.tar.bz2
uvcvideo: Make input device support optional
From: Laurent Pinchart <laurent.pinchart@skynet.be> 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>
Diffstat (limited to 'linux/drivers/media/video/uvc/uvc_status.c')
-rw-r--r--linux/drivers/media/video/uvc/uvc_status.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/linux/drivers/media/video/uvc/uvc_status.c b/linux/drivers/media/video/uvc/uvc_status.c
index 7bfddad37..75e678ac5 100644
--- a/linux/drivers/media/video/uvc/uvc_status.c
+++ b/linux/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);