+static void ov519_handle_button(struct gspca_dev *gspca_dev, u8 state)
+{
+ struct sd *sd = (struct sd *) gspca_dev;
+
+ /* This should never happen, but better to check */
+ if (state != 0 && state != 1)
+ return;
+
+ /* We may need to reset the button state multiple times, as resetting
+ does not work as long as the button stays pressed, so always set
+ snapshot_needs_reset (instead of only on a state change to 1). */
+ if (state)
+ sd->snapshot_needs_reset = 1;
+
+ if (sd->snapshot_pressed != state) {
+#ifdef CONFIG_INPUT
+ input_report_key(gspca_dev->input_dev, KEY_CAMERA, state);
+ input_sync(gspca_dev->input_dev);
+#endif
+
+ sd->snapshot_pressed = state;
+ }
+}
+