diff options
author | Hans de Goede <hdegoede@redhat.com> | 2012-01-01 14:09:17 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-06 07:41:09 -0500 |
commit | ee186fd96a5f98f971316d26822b94c331d56a57 (patch) | |
tree | 9c57d6da3f69b8c9feec60a767e194333f0aca85 | |
parent | 0218d53a12a1b90d261b6f9cf0a4cee38d230916 (diff) |
[media] gscpa_t613: Add support for the 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/t613.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 90f0877eb599..c22d4e810f8d 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | #define MODULE_NAME "t613" | 31 | #define MODULE_NAME "t613" |
32 | 32 | ||
33 | #include <linux/input.h> | ||
33 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
34 | #include "gspca.h" | 35 | #include "gspca.h" |
35 | 36 | ||
@@ -57,6 +58,7 @@ struct sd { | |||
57 | u8 effect; | 58 | u8 effect; |
58 | 59 | ||
59 | u8 sensor; | 60 | u8 sensor; |
61 | u8 button_pressed; | ||
60 | }; | 62 | }; |
61 | enum sensors { | 63 | enum sensors { |
62 | SENSOR_OM6802, | 64 | SENSOR_OM6802, |
@@ -1095,15 +1097,35 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
1095 | msleep(20); | 1097 | msleep(20); |
1096 | reg_w(gspca_dev, 0x0309); | 1098 | reg_w(gspca_dev, 0x0309); |
1097 | } | 1099 | } |
1100 | #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) | ||
1101 | /* If the last button state is pressed, release it now! */ | ||
1102 | if (sd->button_pressed) { | ||
1103 | input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); | ||
1104 | input_sync(gspca_dev->input_dev); | ||
1105 | sd->button_pressed = 0; | ||
1106 | } | ||
1107 | #endif | ||
1098 | } | 1108 | } |
1099 | 1109 | ||
1100 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 1110 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
1101 | u8 *data, /* isoc packet */ | 1111 | u8 *data, /* isoc packet */ |
1102 | int len) /* iso packet length */ | 1112 | int len) /* iso packet length */ |
1103 | { | 1113 | { |
1114 | struct sd *sd = (struct sd *) gspca_dev; | ||
1104 | int pkt_type; | 1115 | int pkt_type; |
1105 | 1116 | ||
1106 | if (data[0] == 0x5a) { | 1117 | if (data[0] == 0x5a) { |
1118 | #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) | ||
1119 | if (len > 20) { | ||
1120 | u8 state = (data[20] & 0x80) ? 1 : 0; | ||
1121 | if (sd->button_pressed != state) { | ||
1122 | input_report_key(gspca_dev->input_dev, | ||
1123 | KEY_CAMERA, state); | ||
1124 | input_sync(gspca_dev->input_dev); | ||
1125 | sd->button_pressed = state; | ||
1126 | } | ||
1127 | } | ||
1128 | #endif | ||
1107 | /* Control Packet, after this came the header again, | 1129 | /* Control Packet, after this came the header again, |
1108 | * but extra bytes came in the packet before this, | 1130 | * but extra bytes came in the packet before this, |
1109 | * sometimes an EOF arrives, sometimes not... */ | 1131 | * sometimes an EOF arrives, sometimes not... */ |
@@ -1410,6 +1432,9 @@ static const struct sd_desc sd_desc = { | |||
1410 | .stopN = sd_stopN, | 1432 | .stopN = sd_stopN, |
1411 | .pkt_scan = sd_pkt_scan, | 1433 | .pkt_scan = sd_pkt_scan, |
1412 | .querymenu = sd_querymenu, | 1434 | .querymenu = sd_querymenu, |
1435 | #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) | ||
1436 | .other_input = 1, | ||
1437 | #endif | ||
1413 | }; | 1438 | }; |
1414 | 1439 | ||
1415 | /* -- module initialisation -- */ | 1440 | /* -- module initialisation -- */ |