aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet/wacom_wac.c
diff options
context:
space:
mode:
authorPing Cheng <pinglinux@gmail.com>2013-12-05 15:54:53 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-12-16 05:12:32 -0500
commit961794a00eab03f4344b7d5e825e8e789e55da87 (patch)
treebe8c0fc41751917397343ae5d7945578f590579a /drivers/input/tablet/wacom_wac.c
parent348324c5b10bcba8d9daabdfb85a6927311be34f (diff)
Input: wacom - add reporting of SW_MUTE_DEVICE events
New Intuos series models added a hardware switch to turn touch data on/off. The state of the switch is reported periodically from the tablet. To report the state the driver will emit SW_MUTE_DEVICE events. Reviewed_by: Chris Bagwell <chris@cnpbagwell.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Jason Gerecke <killertofu@gmail.com> Signed-off-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/tablet/wacom_wac.c')
-rw-r--r--drivers/input/tablet/wacom_wac.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 7655088f78e0..048e5b38f167 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1219,13 +1219,23 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
1219 1219
1220static int wacom_bpt_pen(struct wacom_wac *wacom) 1220static int wacom_bpt_pen(struct wacom_wac *wacom)
1221{ 1221{
1222 struct wacom_features *features = &wacom->features;
1222 struct input_dev *input = wacom->input; 1223 struct input_dev *input = wacom->input;
1223 unsigned char *data = wacom->data; 1224 unsigned char *data = wacom->data;
1224 int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; 1225 int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
1225 1226
1226 if (data[0] != WACOM_REPORT_PENABLED) 1227 if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_USB)
1227 return 0; 1228 return 0;
1228 1229
1230 if (data[0] == WACOM_REPORT_USB) {
1231 if (features->type == INTUOSHT && features->touch_max) {
1232 input_report_switch(wacom->shared->touch_input,
1233 SW_MUTE_DEVICE, data[8] & 0x40);
1234 input_sync(wacom->shared->touch_input);
1235 }
1236 return 0;
1237 }
1238
1229 prox = (data[1] & 0x20) == 0x20; 1239 prox = (data[1] & 0x20) == 0x20;
1230 1240
1231 /* 1241 /*
@@ -1258,8 +1268,8 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
1258 * touching and applying pressure; do not report negative 1268 * touching and applying pressure; do not report negative
1259 * distance. 1269 * distance.
1260 */ 1270 */
1261 if (data[8] <= wacom->features.distance_max) 1271 if (data[8] <= features->distance_max)
1262 d = wacom->features.distance_max - data[8]; 1272 d = features->distance_max - data[8];
1263 1273
1264 pen = data[1] & 0x01; 1274 pen = data[1] & 0x01;
1265 btn1 = data[1] & 0x02; 1275 btn1 = data[1] & 0x02;
@@ -1310,6 +1320,13 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
1310 if (connected) { 1320 if (connected) {
1311 int pid, battery; 1321 int pid, battery;
1312 1322
1323 if ((wacom->shared->type == INTUOSHT) &&
1324 wacom->shared->touch_max) {
1325 input_report_switch(wacom->shared->touch_input,
1326 SW_MUTE_DEVICE, data[5] & 0x40);
1327 input_sync(wacom->shared->touch_input);
1328 }
1329
1313 pid = get_unaligned_be16(&data[6]); 1330 pid = get_unaligned_be16(&data[6]);
1314 battery = data[5] & 0x3f; 1331 battery = data[5] & 0x3f;
1315 if (wacom->pid != pid) { 1332 if (wacom->pid != pid) {
@@ -1779,6 +1796,13 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
1779 break; 1796 break;
1780 1797
1781 case INTUOSHT: 1798 case INTUOSHT:
1799 if (features->touch_max &&
1800 features->device_type == BTN_TOOL_FINGER) {
1801 input_dev->evbit[0] |= BIT_MASK(EV_SW);
1802 __set_bit(SW_MUTE_DEVICE, input_dev->swbit);
1803 }
1804 /* fall through */
1805
1782 case BAMBOO_PT: 1806 case BAMBOO_PT:
1783 __clear_bit(ABS_MISC, input_dev->absbit); 1807 __clear_bit(ABS_MISC, input_dev->absbit);
1784 1808