Skip to contentSkip to conversation

gspca pac7302: add support for camera button

PATCH In review Németh Márton 2 participants 5 messages Nov 22, 2009 – Jan 10, 2010 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 gspca pac7302: add support for camera button

From: Márton Németh <[email protected]>

Add support for snapshot button found on Labtec Webcam 2200 (USB ID 093a:2626).

---

linux/drivers/media/video/gspca/pac7302.c +36 -0
diff -r bc16afd1e7a4 linux/drivers/media/video/gspca/pac7302.c
@@ -68,8 +68,10 @@
 
 #define MODULE_NAME "pac7302"
 
+#include <linux/input.h>
 #include <media/v4l2-chip-ident.h>
 #include "gspca.h"
+#include "input.h"
 
 MODULE_AUTHOR("Thomas Kaiser [email protected]");
 MODULE_DESCRIPTION("Pixart PAC7302");
@@ -1220,6 +1222,37 @@
 }
 #endif
 
+#ifdef CONFIG_INPUT
+static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
+			u8 *data,		/* interrupt packet data */
+			int len)		/* interrput packet length */
+{
+	int ret = -EINVAL;
+	u8 data0, data1;
+
+	if (len == 2) {
+		data0 = data[0];
+		data1 = data[1];
+		if ((data0 == 0x00 && data1 == 0x11) ||
+		    (data0 == 0x22 && data1 == 0x33) ||
+		    (data0 == 0x44 && data1 == 0x55) ||
+		    (data0 == 0x66 && data1 == 0x77) ||
+		    (data0 == 0x88 && data1 == 0x99) ||
+		    (data0 == 0xaa && data1 == 0xbb) ||
+		    (data0 == 0xcc && data1 == 0xdd) ||
+		    (data0 == 0xee && data1 == 0xff)) {
+			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);
+			ret = 0;
+		}
+	}
+
+	return ret;
+}
+#endif
+
 /* sub-driver description for pac7302 */
 static struct sd_desc sd_desc = {
 	.name = MODULE_NAME,
@@ -1235,6 +1268,9 @@
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 	.set_register = sd_dbg_s_register,
 	.get_chip_ident = sd_chip_ident,
+#endif
+#ifdef CONFIG_INPUT
+	.int_pkt_scan = sd_int_pkt_scan,
 #endif
 };
 
#1 lore raw
Quoted 4 lines · Németh Márton

From: Márton Németh <[email protected]>

Add support for snapshot button found on Labtec Webcam 2200 (USB ID 093a:2626

This patch breaks compilation against current -tip:

/home/v4l/master/v4l/pac7302.c:74:19: error: input.h: No such file or directory /home/v4l/master/v4l/pac7302.c: In function 'sd_int_pkt_scan':
/home/v4l/master/v4l/pac7302.c:1255: error: 'struct gspca_dev' has no member named 'input_dev' /home/v4l/master/v4l/pac7302.c:1256: error: 'struct gspca_dev' has no member named 'input_dev' /home/v4l/master/v4l/pac7302.c:1257: error: 'struct gspca_dev' has no member named 'input_dev' /home/v4l/master/v4l/pac7302.c:1258: error: 'struct gspca_dev' has no member named 'input_dev' /home/v4l/master/v4l/pac7302.c: At top level:
/home/v4l/master/v4l/pac7302.c:1284: error: unknown field 'int_pkt_scan' specified in initializer /home/v4l/master/v4l/pac7302.c:1284: warning: excess elements in struct initializer /home/v4l/master/v4l/pac7302.c:1284: warning: (near initialization for 'sd_desc') make[3]: *** [/home/v4l/master/v4l/pac7302.o] Error 1

Cheers,
Mauro

#2 lore raw

Mauro Carvalho Chehab worte:

Quoted 7 lines
Quoted 4 lines · Németh Márton

From: Márton Németh <[email protected]>

Add support for snapshot button found on Labtec Webcam 2200 (USB ID 093a:2626

This patch breaks compilation against current -tip:

There was several versions of adding support to pac7302. The last version still have some problems which I haven't addressed, yet. So the camera button support for pac7302 is not yet ready for inclusion.

Regards,

Márton Németh

#3 lore raw
Quoted 11 lines · Németh Márton

Mauro Carvalho Chehab worte:

Quoted 6 lines
Quoted 4 lines · Németh Márton

From: Márton Németh <[email protected]>

Add support for snapshot button found on Labtec Webcam 2200 (USB ID 093a:2626

This patch breaks compilation against current -tip:

There was several versions of adding support to pac7302. The last version still have some problems which I haven't addressed, yet. So the camera button support for pac7302 is not yet ready for inclusion.

Ok. While you don't have a final version, please add an "RFC" at the patch, for me to know, when dealing with patchwork queue, that the patch is not ok yet.

Quoted 9 lines

Regards,

Márton Németh

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Mauro Carvalho Chehab írta:

Quoted 7 lines
Quoted 6 lines · Németh Márton

Mauro Carvalho Chehab worte:

Quoted 5 lines
Quoted 4 lines · Németh Márton

From: Márton Németh <[email protected]>

Add support for snapshot button found on Labtec Webcam 2200 (USB ID 093a:2626

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

This patch breaks compilation against current -tip:

There was several versions of adding support to pac7302. The last version still have some problems which I haven't addressed, yet. So the camera button support for pac7302 is not yet ready for inclusion.

Ok. While you don't have a final version, please add an "RFC" at the patch, for me to know, when dealing with patchwork queue, that the patch is not ok yet.

I thought every time it was the final version ;-), but I get some comments which may make the code quality and acceptance better.

Regards,

Márton Németh