diff options
author | Laurent Pinchart <laurent.pinchart@skynet.be> | 2008-07-07 22:04:29 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:18:09 -0400 |
commit | 6833c917b4de1757febdbf946d709ece6dc7a86f (patch) | |
tree | e62653f3c86feeb1962807868e5d93569ab3bd66 /drivers/media/video/uvc | |
parent | ac0d6df69bc72eabda944fd14a958074dc08ca0c (diff) |
V4L/DVB (8234): 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>
Diffstat (limited to 'drivers/media/video/uvc')
-rw-r--r-- | drivers/media/video/uvc/Kconfig | 17 | ||||
-rw-r--r-- | drivers/media/video/uvc/uvc_status.c | 17 |
2 files changed, 32 insertions, 2 deletions
diff --git a/drivers/media/video/uvc/Kconfig b/drivers/media/video/uvc/Kconfig new file mode 100644 index 000000000000..c2d9760de832 --- /dev/null +++ b/drivers/media/video/uvc/Kconfig | |||
@@ -0,0 +1,17 @@ | |||
1 | config USB_VIDEO_CLASS | ||
2 | tristate "USB Video Class (UVC)" | ||
3 | ---help--- | ||
4 | Support for the USB Video Class (UVC). Currently only video | ||
5 | input devices, such as webcams, are supported. | ||
6 | |||
7 | For more information see: <http://linux-uvc.berlios.de/> | ||
8 | |||
9 | config USB_VIDEO_CLASS_INPUT_EVDEV | ||
10 | bool "UVC input events device support" | ||
11 | default y | ||
12 | depends on USB_VIDEO_CLASS && INPUT | ||
13 | ---help--- | ||
14 | This option makes USB Video Class devices register an input device | ||
15 | to report button events. | ||
16 | |||
17 | 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 7bfddad37d8c..75e678ac54eb 100644 --- a/drivers/media/video/uvc/uvc_status.c +++ b/drivers/media/video/uvc/uvc_status.c | |||
@@ -22,6 +22,7 @@ | |||
22 | /* -------------------------------------------------------------------------- | 22 | /* -------------------------------------------------------------------------- |
23 | * Input device | 23 | * Input device |
24 | */ | 24 | */ |
25 | #ifdef CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV | ||
25 | static int uvc_input_init(struct uvc_device *dev) | 26 | static int uvc_input_init(struct uvc_device *dev) |
26 | { | 27 | { |
27 | struct usb_device *udev = dev->udev; | 28 | struct usb_device *udev = dev->udev; |
@@ -67,6 +68,19 @@ static void uvc_input_cleanup(struct uvc_device *dev) | |||
67 | input_unregister_device(dev->input); | 68 | input_unregister_device(dev->input); |
68 | } | 69 | } |
69 | 70 | ||
71 | static void uvc_input_report_key(struct uvc_device *dev, unsigned int code, | ||
72 | int value) | ||
73 | { | ||
74 | if (dev->input) | ||
75 | input_report_key(dev->input, code, value); | ||
76 | } | ||
77 | |||
78 | #else | ||
79 | #define uvc_input_init(dev) | ||
80 | #define uvc_input_cleanup(dev) | ||
81 | #define uvc_input_report_key(dev, code, value) | ||
82 | #endif /* CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV */ | ||
83 | |||
70 | /* -------------------------------------------------------------------------- | 84 | /* -------------------------------------------------------------------------- |
71 | * Status interrupt endpoint | 85 | * Status interrupt endpoint |
72 | */ | 86 | */ |
@@ -83,8 +97,7 @@ static void uvc_event_streaming(struct uvc_device *dev, __u8 *data, int len) | |||
83 | return; | 97 | return; |
84 | uvc_trace(UVC_TRACE_STATUS, "Button (intf %u) %s len %d\n", | 98 | uvc_trace(UVC_TRACE_STATUS, "Button (intf %u) %s len %d\n", |
85 | data[1], data[3] ? "pressed" : "released", len); | 99 | data[1], data[3] ? "pressed" : "released", len); |
86 | if (dev->input) | 100 | uvc_input_report_key(dev, BTN_0, data[3]); |
87 | input_report_key(dev->input, BTN_0, data[3]); | ||
88 | } else { | 101 | } else { |
89 | uvc_trace(UVC_TRACE_STATUS, "Stream %u error event %02x %02x " | 102 | uvc_trace(UVC_TRACE_STATUS, "Stream %u error event %02x %02x " |
90 | "len %d.\n", data[1], data[2], data[3], len); | 103 | "len %d.\n", data[1], data[2], data[3], len); |