Merge branch 'for-4.0/upstream-fixes' into for-4.1/wacom

Conflicts:
	drivers/hid/wacom_wac.c

Need to fetch the 4.0 fixes to apply 4.1 patches based on top
of those.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
Jiri Kosina 2015-04-02 14:09:09 +02:00
commit 1fd29be5ce
11 changed files with 97 additions and 43 deletions

View File

@ -1872,6 +1872,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
@ -1926,6 +1927,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
#endif #endif
#if IS_ENABLED(CONFIG_HID_SAITEK) #if IS_ENABLED(CONFIG_HID_SAITEK)
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) },
@ -1957,6 +1959,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) },
{ HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
{ HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) },

View File

@ -459,6 +459,10 @@
#define USB_DEVICE_ID_UGCI_FLYING 0x0020 #define USB_DEVICE_ID_UGCI_FLYING 0x0020
#define USB_DEVICE_ID_UGCI_FIGHTING 0x0030 #define USB_DEVICE_ID_UGCI_FIGHTING 0x0030
#define USB_VENDOR_ID_HP 0x03f0
#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE 0x0a4a
#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a
#define USB_VENDOR_ID_HUION 0x256c #define USB_VENDOR_ID_HUION 0x256c
#define USB_DEVICE_ID_HUION_TABLET 0x006e #define USB_DEVICE_ID_HUION_TABLET 0x006e
@ -586,6 +590,7 @@
#define USB_VENDOR_ID_LOGITECH 0x046d #define USB_VENDOR_ID_LOGITECH 0x046d
#define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e
#define USB_DEVICE_ID_LOGITECH_T651 0xb00c #define USB_DEVICE_ID_LOGITECH_T651 0xb00c
#define USB_DEVICE_ID_LOGITECH_C077 0xc007
#define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101
#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110
#define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
@ -654,6 +659,7 @@
#define USB_DEVICE_ID_MS_LK6K 0x00f9 #define USB_DEVICE_ID_MS_LK6K 0x00f9
#define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701 #define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701
#define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713
#define USB_DEVICE_ID_MS_NE7K 0x071d
#define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730
#define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c
#define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799 #define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799
@ -802,6 +808,7 @@
#define USB_VENDOR_ID_SAITEK 0x06a3 #define USB_VENDOR_ID_SAITEK 0x06a3
#define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17
#define USB_DEVICE_ID_SAITEK_PS1000 0x0621 #define USB_DEVICE_ID_SAITEK_PS1000 0x0621
#define USB_DEVICE_ID_SAITEK_RAT7_OLD 0x0ccb
#define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7 #define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7
#define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0
@ -896,6 +903,7 @@
#define USB_VENDOR_ID_TIVO 0x150a #define USB_VENDOR_ID_TIVO 0x150a
#define USB_DEVICE_ID_TIVO_SLIDE_BT 0x1200 #define USB_DEVICE_ID_TIVO_SLIDE_BT 0x1200
#define USB_DEVICE_ID_TIVO_SLIDE 0x1201 #define USB_DEVICE_ID_TIVO_SLIDE 0x1201
#define USB_DEVICE_ID_TIVO_SLIDE_PRO 0x1203
#define USB_VENDOR_ID_TOPSEED 0x0766 #define USB_VENDOR_ID_TOPSEED 0x0766
#define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204

View File

@ -264,6 +264,8 @@ static const struct hid_device_id ms_devices[] = {
.driver_data = MS_ERGONOMY }, .driver_data = MS_ERGONOMY },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP), { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP),
.driver_data = MS_ERGONOMY }, .driver_data = MS_ERGONOMY },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K),
.driver_data = MS_ERGONOMY },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K), { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K),
.driver_data = MS_ERGONOMY | MS_RDESC }, .driver_data = MS_ERGONOMY | MS_RDESC },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB),

View File

@ -177,6 +177,8 @@ static int saitek_event(struct hid_device *hdev, struct hid_field *field,
static const struct hid_device_id saitek_devices[] = { static const struct hid_device_id saitek_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000), { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000),
.driver_data = SAITEK_FIX_PS1000 }, .driver_data = SAITEK_FIX_PS1000 },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD),
.driver_data = SAITEK_RELEASE_MODE_RAT7 },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7), { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7),
.driver_data = SAITEK_RELEASE_MODE_RAT7 }, .driver_data = SAITEK_RELEASE_MODE_RAT7 },
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9), { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9),

View File

@ -135,8 +135,9 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
{ {
struct hid_sensor_hub_callbacks_list *callback; struct hid_sensor_hub_callbacks_list *callback;
struct sensor_hub_data *pdata = hid_get_drvdata(hdev); struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
unsigned long flags;
spin_lock(&pdata->dyn_callback_lock); spin_lock_irqsave(&pdata->dyn_callback_lock, flags);
list_for_each_entry(callback, &pdata->dyn_callback_list, list) list_for_each_entry(callback, &pdata->dyn_callback_list, list)
if (callback->usage_id == usage_id && if (callback->usage_id == usage_id &&
(collection_index >= (collection_index >=
@ -145,10 +146,11 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
callback->hsdev->end_collection_index)) { callback->hsdev->end_collection_index)) {
*priv = callback->priv; *priv = callback->priv;
*hsdev = callback->hsdev; *hsdev = callback->hsdev;
spin_unlock(&pdata->dyn_callback_lock); spin_unlock_irqrestore(&pdata->dyn_callback_lock,
flags);
return callback->usage_callback; return callback->usage_callback;
} }
spin_unlock(&pdata->dyn_callback_lock); spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags);
return NULL; return NULL;
} }

View File

@ -804,7 +804,7 @@ union sixaxis_output_report_01 {
#define DS4_REPORT_0x81_SIZE 7 #define DS4_REPORT_0x81_SIZE 7
#define SIXAXIS_REPORT_0xF2_SIZE 18 #define SIXAXIS_REPORT_0xF2_SIZE 18
static spinlock_t sony_dev_list_lock; static DEFINE_SPINLOCK(sony_dev_list_lock);
static LIST_HEAD(sony_device_list); static LIST_HEAD(sony_device_list);
static DEFINE_IDA(sony_device_id_allocator); static DEFINE_IDA(sony_device_id_allocator);
@ -1944,6 +1944,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
return -ENOMEM; return -ENOMEM;
} }
spin_lock_init(&sc->lock);
sc->quirks = quirks; sc->quirks = quirks;
hid_set_drvdata(hdev, sc); hid_set_drvdata(hdev, sc);
sc->hdev = hdev; sc->hdev = hdev;
@ -2147,8 +2149,8 @@ static void __exit sony_exit(void)
{ {
dbg_hid("Sony:%s\n", __func__); dbg_hid("Sony:%s\n", __func__);
ida_destroy(&sony_device_id_allocator);
hid_unregister_driver(&sony_driver); hid_unregister_driver(&sony_driver);
ida_destroy(&sony_device_id_allocator);
} }
module_init(sony_init); module_init(sony_init);
module_exit(sony_exit); module_exit(sony_exit);

View File

@ -64,6 +64,7 @@ static const struct hid_device_id tivo_devices[] = {
/* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) },
{ HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) },
{ } { }
}; };
MODULE_DEVICE_TABLE(hid, tivo_devices); MODULE_DEVICE_TABLE(hid, tivo_devices);

View File

@ -370,7 +370,10 @@ static int i2c_hid_hwreset(struct i2c_client *client)
static void i2c_hid_get_input(struct i2c_hid *ihid) static void i2c_hid_get_input(struct i2c_hid *ihid)
{ {
int ret, ret_size; int ret, ret_size;
int size = ihid->bufsize; int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
if (size > ihid->bufsize)
size = ihid->bufsize;
ret = i2c_master_recv(ihid->client, ihid->inbuf, size); ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
if (ret != size) { if (ret != size) {
@ -785,7 +788,7 @@ static int i2c_hid_init_irq(struct i2c_client *client)
dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq); dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq);
ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq, ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
client->name, ihid); client->name, ihid);
if (ret < 0) { if (ret < 0) {
dev_warn(&client->dev, dev_warn(&client->dev,

View File

@ -78,6 +78,9 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS },

View File

@ -581,9 +581,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
(features->type == CINTIQ && !(data[1] & 0x40))) (features->type == CINTIQ && !(data[1] & 0x40)))
return 1; return 1;
if (features->quirks & WACOM_QUIRK_MULTI_INPUT) if (wacom->shared) {
wacom->shared->stylus_in_proximity = true; wacom->shared->stylus_in_proximity = true;
if (wacom->shared->touch_down)
return 1;
}
/* in Range while exiting */ /* in Range while exiting */
if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) { if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
input_report_key(input, BTN_TOUCH, 0); input_report_key(input, BTN_TOUCH, 0);
@ -811,6 +815,11 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4])); input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4]));
input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6])); input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6]));
input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8])); input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8]));
if ((data[2] & 0x07) | data[4] | data[5] | data[6] | data[7] | data[8] | data[9]) {
input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
} else {
input_report_abs(input, ABS_MISC, 0);
}
} else if (features->type == CINTIQ_HYBRID) { } else if (features->type == CINTIQ_HYBRID) {
/* /*
* Do not send hardware buttons under Android. They * Do not send hardware buttons under Android. They
@ -1065,27 +1074,28 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
struct input_dev *input = wacom->input; struct input_dev *input = wacom->input;
unsigned char *data = wacom->data; unsigned char *data = wacom->data;
int i; int i;
int current_num_contacts = 0; int current_num_contacts = data[61];
int contacts_to_send = 0; int contacts_to_send = 0;
int num_contacts_left = 4; /* maximum contacts per packet */ int num_contacts_left = 4; /* maximum contacts per packet */
int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET; int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET;
int y_offset = 2; int y_offset = 2;
static int contact_with_no_pen_down_count = 0;
if (wacom->features.type == WACOM_27QHDT) { if (wacom->features.type == WACOM_27QHDT) {
current_num_contacts = data[63]; current_num_contacts = data[63];
num_contacts_left = 10; num_contacts_left = 10;
byte_per_packet = WACOM_BYTES_PER_QHDTHID_PACKET; byte_per_packet = WACOM_BYTES_PER_QHDTHID_PACKET;
y_offset = 0; y_offset = 0;
} else {
current_num_contacts = data[61];
} }
/* /*
* First packet resets the counter since only the first * First packet resets the counter since only the first
* packet in series will have non-zero current_num_contacts. * packet in series will have non-zero current_num_contacts.
*/ */
if (current_num_contacts) if (current_num_contacts) {
wacom->num_contacts_left = current_num_contacts; wacom->num_contacts_left = current_num_contacts;
contact_with_no_pen_down_count = 0;
}
contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); contacts_to_send = min(num_contacts_left, wacom->num_contacts_left);
@ -1118,15 +1128,16 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h));
input_report_abs(input, ABS_MT_ORIENTATION, w > h); input_report_abs(input, ABS_MT_ORIENTATION, w > h);
} }
contact_with_no_pen_down_count++;
} }
} }
input_mt_sync_frame(input); input_mt_sync_frame(input);
wacom->num_contacts_left -= contacts_to_send; wacom->num_contacts_left -= contacts_to_send;
if (wacom->num_contacts_left <= 0) if (wacom->num_contacts_left <= 0) {
wacom->num_contacts_left = 0; wacom->num_contacts_left = 0;
wacom->shared->touch_down = (contact_with_no_pen_down_count > 0);
wacom->shared->touch_down = (wacom->num_contacts_left > 0); }
return 1; return 1;
} }
@ -1138,6 +1149,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
int current_num_contacts = data[2]; int current_num_contacts = data[2];
int contacts_to_send = 0; int contacts_to_send = 0;
int x_offset = 0; int x_offset = 0;
static int contact_with_no_pen_down_count = 0;
/* MTTPC does not support Height and Width */ /* MTTPC does not support Height and Width */
if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B)
@ -1147,8 +1159,10 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
* First packet resets the counter since only the first * First packet resets the counter since only the first
* packet in series will have non-zero current_num_contacts. * packet in series will have non-zero current_num_contacts.
*/ */
if (current_num_contacts) if (current_num_contacts) {
wacom->num_contacts_left = current_num_contacts; wacom->num_contacts_left = current_num_contacts;
contact_with_no_pen_down_count = 0;
}
/* There are at most 5 contacts per packet */ /* There are at most 5 contacts per packet */
contacts_to_send = min(5, wacom->num_contacts_left); contacts_to_send = min(5, wacom->num_contacts_left);
@ -1169,15 +1183,16 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
int y = get_unaligned_le16(&data[offset + x_offset + 9]); int y = get_unaligned_le16(&data[offset + x_offset + 9]);
input_report_abs(input, ABS_MT_POSITION_X, x); input_report_abs(input, ABS_MT_POSITION_X, x);
input_report_abs(input, ABS_MT_POSITION_Y, y); input_report_abs(input, ABS_MT_POSITION_Y, y);
contact_with_no_pen_down_count++;
} }
} }
input_mt_sync_frame(input); input_mt_sync_frame(input);
wacom->num_contacts_left -= contacts_to_send; wacom->num_contacts_left -= contacts_to_send;
if (wacom->num_contacts_left < 0) if (wacom->num_contacts_left <= 0) {
wacom->num_contacts_left = 0; wacom->num_contacts_left = 0;
wacom->shared->touch_down = (contact_with_no_pen_down_count > 0);
wacom->shared->touch_down = (wacom->num_contacts_left > 0); }
return 1; return 1;
} }
@ -1215,29 +1230,25 @@ static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len)
{ {
unsigned char *data = wacom->data; unsigned char *data = wacom->data;
struct input_dev *input = wacom->input; struct input_dev *input = wacom->input;
bool prox; bool prox = !wacom->shared->stylus_in_proximity;
int x = 0, y = 0; int x = 0, y = 0;
if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG)
return 0; return 0;
if (!wacom->shared->stylus_in_proximity) { if (len == WACOM_PKGLEN_TPC1FG) {
if (len == WACOM_PKGLEN_TPC1FG) { prox = prox && (data[0] & 0x01);
prox = data[0] & 0x01; x = get_unaligned_le16(&data[1]);
x = get_unaligned_le16(&data[1]); y = get_unaligned_le16(&data[3]);
y = get_unaligned_le16(&data[3]); } else if (len == WACOM_PKGLEN_TPC1FG_B) {
} else if (len == WACOM_PKGLEN_TPC1FG_B) { prox = prox && (data[2] & 0x01);
prox = data[2] & 0x01; x = get_unaligned_le16(&data[3]);
x = get_unaligned_le16(&data[3]); y = get_unaligned_le16(&data[5]);
y = get_unaligned_le16(&data[5]); } else {
} else { prox = prox && (data[1] & 0x01);
prox = data[1] & 0x01; x = le16_to_cpup((__le16 *)&data[2]);
x = le16_to_cpup((__le16 *)&data[2]); y = le16_to_cpup((__le16 *)&data[4]);
y = le16_to_cpup((__le16 *)&data[4]); }
}
} else
/* force touch out when pen is in prox */
prox = 0;
if (prox) { if (prox) {
input_report_abs(input, ABS_X, x); input_report_abs(input, ABS_X, x);
@ -1635,6 +1646,7 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
struct input_dev *pad_input = wacom->pad_input; struct input_dev *pad_input = wacom->pad_input;
unsigned char *data = wacom->data; unsigned char *data = wacom->data;
int i; int i;
int contact_with_no_pen_down_count = 0;
if (data[0] != 0x02) if (data[0] != 0x02)
return 0; return 0;
@ -1662,6 +1674,7 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
} }
input_report_abs(input, ABS_MT_POSITION_X, x); input_report_abs(input, ABS_MT_POSITION_X, x);
input_report_abs(input, ABS_MT_POSITION_Y, y); input_report_abs(input, ABS_MT_POSITION_Y, y);
contact_with_no_pen_down_count++;
} }
} }
@ -1671,11 +1684,12 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0);
input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0);
input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0);
wacom->shared->touch_down = (contact_with_no_pen_down_count > 0);
return 1; return 1;
} }
static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) static int wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data, int last_touch_count)
{ {
struct wacom_features *features = &wacom->features; struct wacom_features *features = &wacom->features;
struct input_dev *input = wacom->input; struct input_dev *input = wacom->input;
@ -1683,7 +1697,7 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
int slot = input_mt_get_slot_by_key(input, data[0]); int slot = input_mt_get_slot_by_key(input, data[0]);
if (slot < 0) if (slot < 0)
return; return 0;
touch = touch && !wacom->shared->stylus_in_proximity; touch = touch && !wacom->shared->stylus_in_proximity;
@ -1715,7 +1729,9 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
input_report_abs(input, ABS_MT_POSITION_Y, y); input_report_abs(input, ABS_MT_POSITION_Y, y);
input_report_abs(input, ABS_MT_TOUCH_MAJOR, width); input_report_abs(input, ABS_MT_TOUCH_MAJOR, width);
input_report_abs(input, ABS_MT_TOUCH_MINOR, height); input_report_abs(input, ABS_MT_TOUCH_MINOR, height);
last_touch_count++;
} }
return last_touch_count;
} }
static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
@ -1740,6 +1756,7 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
unsigned char *data = wacom->data; unsigned char *data = wacom->data;
int count = data[1] & 0x07; int count = data[1] & 0x07;
int i; int i;
int contact_with_no_pen_down_count = 0;
if (data[0] != 0x02) if (data[0] != 0x02)
return 0; return 0;
@ -1750,12 +1767,15 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
int msg_id = data[offset]; int msg_id = data[offset];
if (msg_id >= 2 && msg_id <= 17) if (msg_id >= 2 && msg_id <= 17)
wacom_bpt3_touch_msg(wacom, data + offset); contact_with_no_pen_down_count =
wacom_bpt3_touch_msg(wacom, data + offset,
contact_with_no_pen_down_count);
else if (msg_id == 128) else if (msg_id == 128)
wacom_bpt3_button_msg(wacom, data + offset); wacom_bpt3_button_msg(wacom, data + offset);
} }
input_mt_sync_frame(input); input_mt_sync_frame(input);
wacom->shared->touch_down = (contact_with_no_pen_down_count > 0);
return 1; return 1;
} }
@ -1770,6 +1790,9 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
if (data[0] != WACOM_REPORT_PENABLED) if (data[0] != WACOM_REPORT_PENABLED)
return 0; return 0;
if (wacom->shared->touch_down)
return 0;
prox = (data[1] & 0x20) == 0x20; prox = (data[1] & 0x20) == 0x20;
/* /*
@ -2875,9 +2898,9 @@ static const struct wacom_features wacom_features_0xF6 =
.oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10, .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10,
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
static const struct wacom_features wacom_features_0x32A = static const struct wacom_features wacom_features_0x32A =
{ "Wacom Cintiq 27QHD", 119740, 67520, 2047, { "Wacom Cintiq 27QHD", 119740, 67520, 2047, 63,
63, WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
static const struct wacom_features wacom_features_0x32B = static const struct wacom_features wacom_features_0x32B =
{ "Wacom Cintiq 27QHD touch", 119740, 67520, 2047, 63, { "Wacom Cintiq 27QHD touch", 119740, 67520, 2047, 63,
WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,

View File

@ -33,6 +33,8 @@
* @units: Measurment unit for this attribute. * @units: Measurment unit for this attribute.
* @unit_expo: Exponent used in the data. * @unit_expo: Exponent used in the data.
* @size: Size in bytes for data size. * @size: Size in bytes for data size.
* @logical_minimum: Logical minimum value for this attribute.
* @logical_maximum: Logical maximum value for this attribute.
*/ */
struct hid_sensor_hub_attribute_info { struct hid_sensor_hub_attribute_info {
u32 usage_id; u32 usage_id;
@ -146,6 +148,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
/** /**
* sensor_hub_input_attr_get_raw_value() - Synchronous read request * sensor_hub_input_attr_get_raw_value() - Synchronous read request
* @hsdev: Hub device instance.
* @usage_id: Attribute usage id of parent physical device as per spec * @usage_id: Attribute usage id of parent physical device as per spec
* @attr_usage_id: Attribute usage id as per spec * @attr_usage_id: Attribute usage id as per spec
* @report_id: Report id to look for * @report_id: Report id to look for
@ -160,6 +163,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
u32 attr_usage_id, u32 report_id); u32 attr_usage_id, u32 report_id);
/** /**
* sensor_hub_set_feature() - Feature set request * sensor_hub_set_feature() - Feature set request
* @hsdev: Hub device instance.
* @report_id: Report id to look for * @report_id: Report id to look for
* @field_index: Field index inside a report * @field_index: Field index inside a report
* @value: Value to set * @value: Value to set
@ -172,6 +176,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
/** /**
* sensor_hub_get_feature() - Feature get request * sensor_hub_get_feature() - Feature get request
* @hsdev: Hub device instance.
* @report_id: Report id to look for * @report_id: Report id to look for
* @field_index: Field index inside a report * @field_index: Field index inside a report
* @value: Place holder for return value * @value: Place holder for return value