diff options
author | Hans de Goede <hdegoede@redhat.com> | 2010-02-28 15:41:04 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-18 07:50:11 +0400 |
commit | 436c2c533a2a2f98d95347f4d5b4022becb046f6 (patch) | |
tree | 3899d2350869fcfd2fa3c8ad22a1794c2f30b990 | |
parent | 6b33e5e7fe03c6577ccbaeeb028ab4ec1f26f2b0 (diff) | |
download | linux-436c2c533a2a2f98d95347f4d5b4022becb046f6.tar.xz |
V4L/DVB: gspca_spca561: Add support for camera button
gspca_spca561: Add support for camera button
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/gspca/spca561.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c index 6346ddc67967..7bb2355005dc 100644 --- a/drivers/media/video/gspca/spca561.c +++ b/drivers/media/video/gspca/spca561.c @@ -22,6 +22,7 @@ #define MODULE_NAME "spca561" +#include <linux/input.h> #include "gspca.h" MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); @@ -778,6 +779,23 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, switch (*data++) { /* sequence number */ case 0: /* start of frame */ gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); + + /* This should never happen */ + if (len < 2) { + PDEBUG(D_ERR, "Short SOF packet, ignoring"); + gspca_dev->last_packet_type = DISCARD_PACKET; + return; + } + +#ifdef CONFIG_INPUT + if (data[0] & 0x20) { + input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); + input_sync(gspca_dev->input_dev); + input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); + input_sync(gspca_dev->input_dev); + } +#endif + if (data[1] & 0x10) { /* compressed bayer */ gspca_frame_add(gspca_dev, FIRST_PACKET, data, len); @@ -1019,6 +1037,9 @@ static const struct sd_desc sd_desc_12a = { .start = sd_start_12a, .stopN = sd_stopN, .pkt_scan = sd_pkt_scan, +#ifdef CONFIG_INPUT + .other_input = 1, +#endif }; static const struct sd_desc sd_desc_72a = { .name = MODULE_NAME, @@ -1030,6 +1051,9 @@ static const struct sd_desc sd_desc_72a = { .stopN = sd_stopN, .pkt_scan = sd_pkt_scan, .dq_callback = do_autogain, +#ifdef CONFIG_INPUT + .other_input = 1, +#endif }; static const struct sd_desc *sd_desc[2] = { &sd_desc_12a, |