<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.490   -&gt; 1.491  
#	drivers/usb/media/konicawc.c	1.7     -&gt; 1.8    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/08/17	spse@secret.org.uk	1.491
# [PATCH] konicawc - make snapshot button into input device
# 
# This patch presents the snapshot button on the camera as an
# event input device.
# --------------------------------------------
#
diff -Nru a/drivers/usb/media/konicawc.c b/drivers/usb/media/konicawc.c
--- a/drivers/usb/media/konicawc.c	Sun Aug 18 20:48:33 2002
+++ b/drivers/usb/media/konicawc.c	Sun Aug 18 20:48:33 2002
@@ -15,7 +15,7 @@
 #include &lt;linux/kernel.h&gt;
 #include &lt;linux/module.h&gt;
 #include &lt;linux/init.h&gt;
-
+#include &lt;linux/input.h&gt;
 
 #include "usbvideo.h"
 
@@ -117,6 +117,10 @@
 	int maxline;		/* number of lines per frame */
 	int yplanesz;		/* Number of bytes in the Y plane */
 	unsigned int buttonsts:1;
+#ifdef CONFIG_INPUT
+	struct input_dev input;
+	char input_physname[64];
+#endif
 };
 
 
@@ -258,7 +262,7 @@
 		 */
 
 		if(sts &lt; 0x80) {
-			button = sts &amp; 0x40;
+			button = !!(sts &amp; 0x40);
 			sts &amp;= ~0x40;
 		}
 		
@@ -268,6 +272,10 @@
 		if(button != cam-&gt;buttonsts) {
 			DEBUG(2, "button: %sclicked", button ? "" : "un");
 			cam-&gt;buttonsts = button;
+#ifdef CONFIG_INPUT
+			input_report_key(&amp;cam-&gt;input, BTN_0, cam-&gt;buttonsts);
+			input_sync(&amp;cam-&gt;input);
+#endif
 		}
 
 		if(sts == 0x01) { /* drop frame */
@@ -624,7 +632,7 @@
 	int i, nas;
 	int actInterface=-1, inactInterface=-1, maxPS=0;
 	unsigned char video_ep = 0;
-	
+
 	DEBUG(1, "konicawc_probe(%p,%u.)", dev, ifnum);
 
 	/* We don't handle multi-config cameras */
@@ -735,6 +743,24 @@
 			err("usbvideo_RegisterVideoDevice() failed.");
 			uvd = NULL;
 		}
+#ifdef CONFIG_INPUT
+		/* Register input device for button */
+		memset(&amp;cam-&gt;input, 0, sizeof(struct input_dev));
+		cam-&gt;input.name = "Konicawc snapshot button";
+		cam-&gt;input.private = cam;
+		cam-&gt;input.evbit[0] = BIT(EV_KEY);
+		cam-&gt;input.keybit[LONG(BTN_0)] = BIT(BTN_0);
+		cam-&gt;input.id.bustype = BUS_USB;
+		cam-&gt;input.id.vendor = dev-&gt;descriptor.idVendor;
+		cam-&gt;input.id.product = dev-&gt;descriptor.idProduct;
+		cam-&gt;input.id.version = dev-&gt;descriptor.bcdDevice;
+		input_register_device(&amp;cam-&gt;input);
+		
+		usb_make_path(dev, cam-&gt;input_physname, 56);
+		strcat(cam-&gt;input_physname, "/input0");
+		cam-&gt;input.phys = cam-&gt;input_physname;
+		info("konicawc: %s on %s\n", cam-&gt;input.name, cam-&gt;input.phys);
+#endif
 	}
 	MOD_DEC_USE_COUNT;
 	return uvd;
@@ -746,6 +772,9 @@
 	int i;
 	struct konicawc *cam = (struct konicawc *)uvd-&gt;user_data;
 
+#ifdef CONFIG_INPUT
+	input_unregister_device(&amp;cam-&gt;input);
+#endif
 	for (i=0; i &lt; USBVIDEO_NUMSBUF; i++) {
 		usb_free_urb(cam-&gt;sts_urb[i]);
 		cam-&gt;sts_urb[i] = NULL;
</pre></body></html>