wacom_wac.c (50066a042da5457ae5b6397425f0a7ca556231e3) | wacom_wac.c (c9c095874ab4446be6dec6755d8f68862fdeae48) |
---|---|
1/* 2 * drivers/input/tablet/wacom_wac.c 3 * 4 * USB Wacom tablet support - Wacom specific code 5 * 6 */ 7 8/* --- 1421 unchanged lines hidden (view full) --- 1430 case WACOM_REPORT_PENABLED: 1431 return wacom_tpc_pen(wacom); 1432 } 1433 } 1434 1435 return 0; 1436} 1437 | 1/* 2 * drivers/input/tablet/wacom_wac.c 3 * 4 * USB Wacom tablet support - Wacom specific code 5 * 6 */ 7 8/* --- 1421 unchanged lines hidden (view full) --- 1430 case WACOM_REPORT_PENABLED: 1431 return wacom_tpc_pen(wacom); 1432 } 1433 } 1434 1435 return 0; 1436} 1437 |
1438static int wacom_equivalent_usage(int usage) 1439{ 1440 if ((usage & HID_USAGE_PAGE) == WACOM_HID_UP_WACOMDIGITIZER) { 1441 int subpage = (usage & 0xFF00) << 8; 1442 int subusage = (usage & 0xFF); 1443 1444 if (subpage == WACOM_HID_SP_DIGITIZER || 1445 subpage == WACOM_HID_SP_DIGITIZERINFO) { 1446 return usage; 1447 } 1448 1449 if (subpage == HID_UP_UNDEFINED) 1450 subpage = HID_UP_DIGITIZER; 1451 1452 return subpage | subusage; 1453 } 1454 1455 return usage; 1456} 1457 |
|
1438static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage, 1439 struct hid_field *field, __u8 type, __u16 code, int fuzz) 1440{ 1441 int fmin = field->logical_minimum; 1442 int fmax = field->logical_maximum; | 1458static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage, 1459 struct hid_field *field, __u8 type, __u16 code, int fuzz) 1460{ 1461 int fmin = field->logical_minimum; 1462 int fmax = field->logical_maximum; |
1463 unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); |
|
1443 int resolution_code = code; 1444 | 1464 int resolution_code = code; 1465 |
1445 if (usage->hid == HID_DG_TWIST) { | 1466 if (equivalent_usage == HID_DG_TWIST) { |
1446 resolution_code = ABS_RZ; 1447 } 1448 1449 usage->type = type; 1450 usage->code = code; 1451 1452 set_bit(type, input->evbit); 1453 --- 13 unchanged lines hidden (view full) --- 1467} 1468 1469static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, 1470 struct hid_field *field, struct hid_usage *usage) 1471{ 1472 struct wacom *wacom = hid_get_drvdata(hdev); 1473 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1474 struct input_dev *input = wacom_wac->pen_input; | 1467 resolution_code = ABS_RZ; 1468 } 1469 1470 usage->type = type; 1471 usage->code = code; 1472 1473 set_bit(type, input->evbit); 1474 --- 13 unchanged lines hidden (view full) --- 1488} 1489 1490static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, 1491 struct hid_field *field, struct hid_usage *usage) 1492{ 1493 struct wacom *wacom = hid_get_drvdata(hdev); 1494 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1495 struct input_dev *input = wacom_wac->pen_input; |
1496 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
|
1475 | 1497 |
1476 switch (usage->hid) { | 1498 switch (equivalent_usage) { |
1477 case HID_GD_X: 1478 wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); 1479 break; 1480 case HID_GD_Y: 1481 wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); 1482 break; 1483 case HID_GD_Z: 1484 wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0); --- 34 unchanged lines hidden (view full) --- 1519} 1520 1521static int wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field, 1522 struct hid_usage *usage, __s32 value) 1523{ 1524 struct wacom *wacom = hid_get_drvdata(hdev); 1525 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1526 struct input_dev *input = wacom_wac->pen_input; | 1499 case HID_GD_X: 1500 wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); 1501 break; 1502 case HID_GD_Y: 1503 wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); 1504 break; 1505 case HID_GD_Z: 1506 wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0); --- 34 unchanged lines hidden (view full) --- 1541} 1542 1543static int wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field, 1544 struct hid_usage *usage, __s32 value) 1545{ 1546 struct wacom *wacom = hid_get_drvdata(hdev); 1547 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1548 struct input_dev *input = wacom_wac->pen_input; |
1549 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
|
1527 | 1550 |
1528 switch (usage->hid) { | 1551 switch (equivalent_usage) { |
1529 case HID_GD_Z: 1530 /* 1531 * HID_GD_Z "should increase as the control's position is 1532 * moved from high to low", while ABS_DISTANCE instead 1533 * increases in value as the tool moves from low to high. 1534 */ 1535 value = field->logical_maximum - value; 1536 break; --- 55 unchanged lines hidden (view full) --- 1592 1593static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, 1594 struct hid_field *field, struct hid_usage *usage) 1595{ 1596 struct wacom *wacom = hid_get_drvdata(hdev); 1597 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1598 struct input_dev *input = wacom_wac->touch_input; 1599 unsigned touch_max = wacom_wac->features.touch_max; | 1552 case HID_GD_Z: 1553 /* 1554 * HID_GD_Z "should increase as the control's position is 1555 * moved from high to low", while ABS_DISTANCE instead 1556 * increases in value as the tool moves from low to high. 1557 */ 1558 value = field->logical_maximum - value; 1559 break; --- 55 unchanged lines hidden (view full) --- 1615 1616static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, 1617 struct hid_field *field, struct hid_usage *usage) 1618{ 1619 struct wacom *wacom = hid_get_drvdata(hdev); 1620 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1621 struct input_dev *input = wacom_wac->touch_input; 1622 unsigned touch_max = wacom_wac->features.touch_max; |
1623 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
|
1600 | 1624 |
1601 switch (usage->hid) { | 1625 switch (equivalent_usage) { |
1602 case HID_GD_X: 1603 if (touch_max == 1) 1604 wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); 1605 else 1606 wacom_map_usage(input, usage, field, EV_ABS, 1607 ABS_MT_POSITION_X, 4); 1608 break; 1609 case HID_GD_Y: --- 58 unchanged lines hidden (view full) --- 1668 } 1669} 1670 1671static int wacom_wac_finger_event(struct hid_device *hdev, 1672 struct hid_field *field, struct hid_usage *usage, __s32 value) 1673{ 1674 struct wacom *wacom = hid_get_drvdata(hdev); 1675 struct wacom_wac *wacom_wac = &wacom->wacom_wac; | 1626 case HID_GD_X: 1627 if (touch_max == 1) 1628 wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); 1629 else 1630 wacom_map_usage(input, usage, field, EV_ABS, 1631 ABS_MT_POSITION_X, 4); 1632 break; 1633 case HID_GD_Y: --- 58 unchanged lines hidden (view full) --- 1692 } 1693} 1694 1695static int wacom_wac_finger_event(struct hid_device *hdev, 1696 struct hid_field *field, struct hid_usage *usage, __s32 value) 1697{ 1698 struct wacom *wacom = hid_get_drvdata(hdev); 1699 struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
1700 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
|
1676 | 1701 |
1677 switch (usage->hid) { | 1702 switch (equivalent_usage) { |
1678 case HID_GD_X: 1679 wacom_wac->hid_data.x = value; 1680 break; 1681 case HID_GD_Y: 1682 wacom_wac->hid_data.y = value; 1683 break; 1684 case HID_DG_WIDTH: 1685 wacom_wac->hid_data.width = value; --- 6 unchanged lines hidden (view full) --- 1692 break; 1693 case HID_DG_TIPSWITCH: 1694 wacom_wac->hid_data.tipswitch = value; 1695 break; 1696 } 1697 1698 1699 if (usage->usage_index + 1 == field->report_count) { | 1703 case HID_GD_X: 1704 wacom_wac->hid_data.x = value; 1705 break; 1706 case HID_GD_Y: 1707 wacom_wac->hid_data.y = value; 1708 break; 1709 case HID_DG_WIDTH: 1710 wacom_wac->hid_data.width = value; --- 6 unchanged lines hidden (view full) --- 1717 break; 1718 case HID_DG_TIPSWITCH: 1719 wacom_wac->hid_data.tipswitch = value; 1720 break; 1721 } 1722 1723 1724 if (usage->usage_index + 1 == field->report_count) { |
1700 if (usage->hid == wacom_wac->hid_data.last_slot_field) | 1725 if (equivalent_usage == wacom_wac->hid_data.last_slot_field) |
1701 wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); 1702 } 1703 1704 return 0; 1705} 1706 1707static void wacom_wac_finger_pre_report(struct hid_device *hdev, 1708 struct hid_report *report) --- 2035 unchanged lines hidden --- | 1726 wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); 1727 } 1728 1729 return 0; 1730} 1731 1732static void wacom_wac_finger_pre_report(struct hid_device *hdev, 1733 struct hid_report *report) --- 2035 unchanged lines hidden --- |