Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

HID: wacom: more appropriate tool type categorization

Recent eraser and pen tools are able to be distinguished
by looking at its least significant nibble.
This modification applies it to wacom_intuos_get_tool_type
function and reduces its code lines.

Signed-off-by: Tatsunosuke Tobita <tatsunosuke.tobita@wacom.com>
Signed-off-by: Tatsunosuke Tobita <tatsunosuke.wacom@gmail.com>
Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
Link: https://patch.msgid.link/20240709055729.17158-2-tatsunosuke.wacom@gmail.com
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>

authored by

Tatsunosuke Tobita and committed by
Benjamin Tissoires
9c2913b9 f0d17d69

+10 -56
+10 -56
drivers/hid/wacom_wac.c
··· 692 692 693 693 static int wacom_intuos_get_tool_type(int tool_id) 694 694 { 695 - int tool_type = BTN_TOOL_PEN; 696 - 697 - if (wacom_is_art_pen(tool_id)) 698 - return tool_type; 699 - 700 695 switch (tool_id) { 701 696 case 0x812: /* Inking pen */ 702 697 case 0x801: /* Intuos3 Inking pen */ 703 698 case 0x12802: /* Intuos4/5 Inking Pen */ 704 699 case 0x012: 705 - tool_type = BTN_TOOL_PENCIL; 706 - break; 707 - 708 - case 0x822: /* Pen */ 709 - case 0x842: 710 - case 0x852: 711 - case 0x823: /* Intuos3 Grip Pen */ 712 - case 0x813: /* Intuos3 Classic Pen */ 713 - case 0x802: /* Intuos4/5 13HD/24HD General Pen */ 714 - case 0x8e2: /* IntuosHT2 pen */ 715 - case 0x022: 716 - case 0x200: /* Pro Pen 3 */ 717 - case 0x10842: /* MobileStudio Pro Pro Pen slim */ 718 - case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */ 719 - case 0x16802: /* Cintiq 13HD Pro Pen */ 720 - case 0x18802: /* DTH2242 Pen */ 721 - case 0x10802: /* Intuos4/5 13HD/24HD General Pen */ 722 - case 0x8842: /* Intuos Pro and Cintiq Pro 3D Pen */ 723 - tool_type = BTN_TOOL_PEN; 724 - break; 700 + return BTN_TOOL_PENCIL; 725 701 726 702 case 0x832: /* Stroke pen */ 727 703 case 0x032: 728 - tool_type = BTN_TOOL_BRUSH; 729 - break; 704 + return BTN_TOOL_BRUSH; 730 705 731 706 case 0x007: /* Mouse 4D and 2D */ 732 707 case 0x09c: 733 708 case 0x094: 734 709 case 0x017: /* Intuos3 2D Mouse */ 735 710 case 0x806: /* Intuos4 Mouse */ 736 - tool_type = BTN_TOOL_MOUSE; 737 - break; 711 + return BTN_TOOL_MOUSE; 738 712 739 713 case 0x096: /* Lens cursor */ 740 714 case 0x097: /* Intuos3 Lens cursor */ 741 715 case 0x006: /* Intuos4 Lens cursor */ 742 - tool_type = BTN_TOOL_LENS; 743 - break; 744 - 745 - case 0x82a: /* Eraser */ 746 - case 0x84a: 747 - case 0x85a: 748 - case 0x91a: 749 - case 0xd1a: 750 - case 0x0fa: 751 - case 0x82b: /* Intuos3 Grip Pen Eraser */ 752 - case 0x81b: /* Intuos3 Classic Pen Eraser */ 753 - case 0x91b: /* Intuos3 Airbrush Eraser */ 754 - case 0x80c: /* Intuos4/5 13HD/24HD Marker Pen Eraser */ 755 - case 0x80a: /* Intuos4/5 13HD/24HD General Pen Eraser */ 756 - case 0x90a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ 757 - case 0x1480a: /* Intuos4/5 13HD/24HD Classic Pen Eraser */ 758 - case 0x1090a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ 759 - case 0x1080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */ 760 - case 0x1084a: /* MobileStudio Pro Pro Pen slim Eraser */ 761 - case 0x1680a: /* Cintiq 13HD Pro Pen Eraser */ 762 - case 0x1880a: /* DTH2242 Eraser */ 763 - case 0x1080a: /* Intuos4/5 13HD/24HD General Pen Eraser */ 764 - tool_type = BTN_TOOL_RUBBER; 765 - break; 716 + return BTN_TOOL_LENS; 766 717 767 718 case 0xd12: 768 719 case 0x912: ··· 721 770 case 0x913: /* Intuos3 Airbrush */ 722 771 case 0x902: /* Intuos4/5 13HD/24HD Airbrush */ 723 772 case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */ 724 - tool_type = BTN_TOOL_AIRBRUSH; 725 - break; 773 + return BTN_TOOL_AIRBRUSH; 774 + 775 + default: 776 + if (tool_id & 0x0008) 777 + return BTN_TOOL_RUBBER; 778 + return BTN_TOOL_PEN; 726 779 } 727 - return tool_type; 728 780 } 729 781 730 782 static void wacom_exit_report(struct wacom_wac *wacom)