aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca
diff options
context:
space:
mode:
authorMárton Németh <nm127@freemail.hu>2010-01-28 14:33:38 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:10:49 -0500
commitaed6f1b5fe4e95cf8a9fc149e25041aa8cc7c78a (patch)
tree0f262c140d291487f1b4116f6a8803128601c8d8 /drivers/media/video/gspca
parent0274d42e052ecd9bc6b5f69fbfc8792ce2cc0fb6 (diff)
V4L/DVB: gspca - pac7302: Add support for camera button.
Signed-off-by: Márton Németh <nm127@freemail.hu> Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r--drivers/media/video/gspca/pac7302.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c
index 4fa604a0457..5bf51786b44 100644
--- a/drivers/media/video/gspca/pac7302.c
+++ b/drivers/media/video/gspca/pac7302.c
@@ -5,6 +5,8 @@
5 * V4L2 by Jean-Francois Moine <http://moinejf.free.fr> 5 * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
6 * 6 *
7 * Separated from Pixart PAC7311 library by Márton Németh <nm127@freemail.hu> 7 * Separated from Pixart PAC7311 library by Márton Németh <nm127@freemail.hu>
8 * Camera button input handling by Márton Németh <nm127@freemail.hu>
9 * Copyright (C) 2009-2010 Márton Németh <nm127@freemail.hu>
8 * 10 *
9 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
@@ -68,6 +70,7 @@
68 70
69#define MODULE_NAME "pac7302" 71#define MODULE_NAME "pac7302"
70 72
73#include <linux/input.h>
71#include <media/v4l2-chip-ident.h> 74#include <media/v4l2-chip-ident.h>
72#include "gspca.h" 75#include "gspca.h"
73 76
@@ -1143,6 +1146,37 @@ static int sd_chip_ident(struct gspca_dev *gspca_dev,
1143} 1146}
1144#endif 1147#endif
1145 1148
1149#ifdef CONFIG_INPUT
1150static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
1151 u8 *data, /* interrupt packet data */
1152 int len) /* interrput packet length */
1153{
1154 int ret = -EINVAL;
1155 u8 data0, data1;
1156
1157 if (len == 2) {
1158 data0 = data[0];
1159 data1 = data[1];
1160 if ((data0 == 0x00 && data1 == 0x11) ||
1161 (data0 == 0x22 && data1 == 0x33) ||
1162 (data0 == 0x44 && data1 == 0x55) ||
1163 (data0 == 0x66 && data1 == 0x77) ||
1164 (data0 == 0x88 && data1 == 0x99) ||
1165 (data0 == 0xaa && data1 == 0xbb) ||
1166 (data0 == 0xcc && data1 == 0xdd) ||
1167 (data0 == 0xee && data1 == 0xff)) {
1168 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
1169 input_sync(gspca_dev->input_dev);
1170 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
1171 input_sync(gspca_dev->input_dev);
1172 ret = 0;
1173 }
1174 }
1175
1176 return ret;
1177}
1178#endif
1179
1146/* sub-driver description for pac7302 */ 1180/* sub-driver description for pac7302 */
1147static const struct sd_desc sd_desc = { 1181static const struct sd_desc sd_desc = {
1148 .name = MODULE_NAME, 1182 .name = MODULE_NAME,
@@ -1159,6 +1193,9 @@ static const struct sd_desc sd_desc = {
1159 .set_register = sd_dbg_s_register, 1193 .set_register = sd_dbg_s_register,
1160 .get_chip_ident = sd_chip_ident, 1194 .get_chip_ident = sd_chip_ident,
1161#endif 1195#endif
1196#ifdef CONFIG_INPUT
1197 .int_pkt_scan = sd_int_pkt_scan,
1198#endif
1162}; 1199};
1163 1200
1164/* -- module initialisation -- */ 1201/* -- module initialisation -- */