aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/wacom_sys.c61
1 files changed, 16 insertions, 45 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 78e9e256cd7b..5cb852886179 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -1525,7 +1525,7 @@ static size_t wacom_compute_pktlen(struct hid_device *hdev)
1525 return size; 1525 return size;
1526} 1526}
1527 1527
1528static void wacom_update_name(struct wacom *wacom) 1528static void wacom_update_name(struct wacom *wacom, const char *suffix)
1529{ 1529{
1530 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1530 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
1531 struct wacom_features *features = &wacom_wac->features; 1531 struct wacom_features *features = &wacom_wac->features;
@@ -1561,14 +1561,14 @@ static void wacom_update_name(struct wacom *wacom)
1561 1561
1562 /* Append the device type to the name */ 1562 /* Append the device type to the name */
1563 snprintf(wacom_wac->pen_name, sizeof(wacom_wac->pen_name), 1563 snprintf(wacom_wac->pen_name, sizeof(wacom_wac->pen_name),
1564 "%s Pen", name); 1564 "%s%s Pen", name, suffix);
1565 snprintf(wacom_wac->touch_name, sizeof(wacom_wac->touch_name), 1565 snprintf(wacom_wac->touch_name, sizeof(wacom_wac->touch_name),
1566 "%s Finger", name); 1566 "%s%s Finger", name, suffix);
1567 snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name), 1567 snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name),
1568 "%s Pad", name); 1568 "%s%s Pad", name, suffix);
1569} 1569}
1570 1570
1571static int wacom_parse_and_register(struct wacom *wacom) 1571static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
1572{ 1572{
1573 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1573 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
1574 struct wacom_features *features = &wacom_wac->features; 1574 struct wacom_features *features = &wacom_wac->features;
@@ -1622,7 +1622,7 @@ static int wacom_parse_and_register(struct wacom *wacom)
1622 1622
1623 wacom_calculate_res(features); 1623 wacom_calculate_res(features);
1624 1624
1625 wacom_update_name(wacom); 1625 wacom_update_name(wacom, wireless ? " (WL)" : "");
1626 1626
1627 error = wacom_add_shared_data(hdev); 1627 error = wacom_add_shared_data(hdev);
1628 if (error) 1628 if (error)
@@ -1649,8 +1649,10 @@ static int wacom_parse_and_register(struct wacom *wacom)
1649 goto fail_hw_start; 1649 goto fail_hw_start;
1650 } 1650 }
1651 1651
1652 /* Note that if query fails it is not a hard failure */ 1652 if (!wireless) {
1653 wacom_query_tablet_data(hdev, features); 1653 /* Note that if query fails it is not a hard failure */
1654 wacom_query_tablet_data(hdev, features);
1655 }
1654 1656
1655 /* touch only Bamboo doesn't support pen */ 1657 /* touch only Bamboo doesn't support pen */
1656 if ((features->type == BAMBOO_TOUCH) && 1658 if ((features->type == BAMBOO_TOUCH) &&
@@ -1745,22 +1747,10 @@ static void wacom_wireless_work(struct work_struct *work)
1745 /* Stylus interface */ 1747 /* Stylus interface */
1746 wacom_wac1->features = 1748 wacom_wac1->features =
1747 *((struct wacom_features *)id->driver_data); 1749 *((struct wacom_features *)id->driver_data);
1748 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PEN; 1750
1749 wacom_set_default_phy(&wacom_wac1->features);
1750 wacom_calculate_res(&wacom_wac1->features);
1751 snprintf(wacom_wac1->pen_name, WACOM_NAME_MAX, "%s (WL) Pen",
1752 wacom_wac1->features.name);
1753 if (wacom_wac1->features.type < BAMBOO_PEN ||
1754 wacom_wac1->features.type > BAMBOO_PT) {
1755 snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX,
1756 "%s (WL) Pad", wacom_wac1->features.name);
1757 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PAD;
1758 }
1759 wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max;
1760 wacom_wac1->shared->type = wacom_wac1->features.type;
1761 wacom_wac1->pid = wacom_wac->pid; 1751 wacom_wac1->pid = wacom_wac->pid;
1762 error = wacom_allocate_inputs(wacom1) || 1752 hid_hw_stop(hdev1);
1763 wacom_register_inputs(wacom1); 1753 error = wacom_parse_and_register(wacom1, true);
1764 if (error) 1754 if (error)
1765 goto fail; 1755 goto fail;
1766 1756
@@ -1770,30 +1760,11 @@ static void wacom_wireless_work(struct work_struct *work)
1770 wacom_wac1->features.type <= BAMBOO_PT)) { 1760 wacom_wac1->features.type <= BAMBOO_PT)) {
1771 wacom_wac2->features = 1761 wacom_wac2->features =
1772 *((struct wacom_features *)id->driver_data); 1762 *((struct wacom_features *)id->driver_data);
1773 wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
1774 wacom_set_default_phy(&wacom_wac2->features);
1775 wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;
1776 wacom_calculate_res(&wacom_wac2->features);
1777 snprintf(wacom_wac2->touch_name, WACOM_NAME_MAX,
1778 "%s (WL) Finger", wacom_wac2->features.name);
1779 if (wacom_wac1->features.touch_max)
1780 wacom_wac2->features.device_type |= WACOM_DEVICETYPE_TOUCH;
1781 if (wacom_wac1->features.type >= INTUOSHT &&
1782 wacom_wac1->features.type <= BAMBOO_PT) {
1783 snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX,
1784 "%s (WL) Pad", wacom_wac2->features.name);
1785 wacom_wac2->features.device_type |= WACOM_DEVICETYPE_PAD;
1786 }
1787 wacom_wac2->pid = wacom_wac->pid; 1763 wacom_wac2->pid = wacom_wac->pid;
1788 error = wacom_allocate_inputs(wacom2) || 1764 hid_hw_stop(hdev2);
1789 wacom_register_inputs(wacom2); 1765 error = wacom_parse_and_register(wacom2, true);
1790 if (error) 1766 if (error)
1791 goto fail; 1767 goto fail;
1792
1793 if ((wacom_wac1->features.type == INTUOSHT ||
1794 wacom_wac1->features.type == INTUOSHT2) &&
1795 wacom_wac1->features.touch_max)
1796 wacom_wac->shared->touch_input = wacom_wac2->touch_input;
1797 } 1768 }
1798 1769
1799 error = wacom_initialize_battery(wacom); 1770 error = wacom_initialize_battery(wacom);
@@ -1855,7 +1826,7 @@ static int wacom_probe(struct hid_device *hdev,
1855 goto fail_parse; 1826 goto fail_parse;
1856 } 1827 }
1857 1828
1858 error = wacom_parse_and_register(wacom); 1829 error = wacom_parse_and_register(wacom, false);
1859 if (error) 1830 if (error)
1860 goto fail_parse; 1831 goto fail_parse;
1861 1832