From: kernel test robot <lkp@intel.com> To: John Chen <johnchen902@gmail.com>, linux-kernel@vger.kernel.org Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com, Rohit Pidaparthi <rohitpid@gmail.com>, RicardoEPRodrigues <ricardo.e.p.rodrigues@gmail.com>, Jiri Kosina <jikos@kernel.org>, Benjamin Tissoires <benjamin.tissoires@redhat.com>, John Chen <johnchen902@gmail.com> Subject: Re: [PATCH 4/4] HID: input: map battery capacity (00850065) Date: Sun, 28 Mar 2021 01:50:56 +0800 [thread overview] Message-ID: <202103280118.9Jjxpf6B-lkp@intel.com> (raw) In-Reply-To: <20210327130508.24849-5-johnchen902@gmail.com> [-- Attachment #1: Type: text/plain, Size: 29849 bytes --] Hi John, Thank you for the patch! Yet something to improve: [auto build test ERROR on hid/for-next] [also build test ERROR on linux/master linus/master jikos-hid/for-next jikos-trivial/for-next v5.12-rc4 next-20210326] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/John-Chen/HID-add-Apple-Magic-Mouse-2-support/20210327-211004 base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next config: x86_64-randconfig-a012-20210327 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d50fe9f0d6b9ee61df8830a67ea0a33c27a637e7) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # https://github.com/0day-ci/linux/commit/00e05cc61c9d267c5857d61fd40638d560460f89 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review John-Chen/HID-add-Apple-Magic-Mouse-2-support/20210327-211004 git checkout 00e05cc61c9d267c5857d61fd40638d560460f89 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/hid/hid-input.c:1082:12: error: no member named 'battery_min' in 'struct hid_device' device->battery_min = 0; ~~~~~~ ^ >> drivers/hid/hid-input.c:1083:12: error: no member named 'battery_max' in 'struct hid_device' device->battery_max = 100; ~~~~~~ ^ 2 errors generated. vim +1082 drivers/hid/hid-input.c 568 569 static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field, 570 struct hid_usage *usage) 571 { 572 struct input_dev *input = hidinput->input; 573 struct hid_device *device = input_get_drvdata(input); 574 int max = 0, code; 575 unsigned long *bit = NULL; 576 577 field->hidinput = hidinput; 578 579 if (field->flags & HID_MAIN_ITEM_CONSTANT) 580 goto ignore; 581 582 /* Ignore if report count is out of bounds. */ 583 if (field->report_count < 1) 584 goto ignore; 585 586 /* only LED usages are supported in output fields */ 587 if (field->report_type == HID_OUTPUT_REPORT && 588 (usage->hid & HID_USAGE_PAGE) != HID_UP_LED) { 589 goto ignore; 590 } 591 592 if (device->driver->input_mapping) { 593 int ret = device->driver->input_mapping(device, hidinput, field, 594 usage, &bit, &max); 595 if (ret > 0) 596 goto mapped; 597 if (ret < 0) 598 goto ignore; 599 } 600 601 switch (usage->hid & HID_USAGE_PAGE) { 602 case HID_UP_UNDEFINED: 603 goto ignore; 604 605 case HID_UP_KEYBOARD: 606 set_bit(EV_REP, input->evbit); 607 608 if ((usage->hid & HID_USAGE) < 256) { 609 if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore; 610 map_key_clear(hid_keyboard[usage->hid & HID_USAGE]); 611 } else 612 map_key(KEY_UNKNOWN); 613 614 break; 615 616 case HID_UP_BUTTON: 617 code = ((usage->hid - 1) & HID_USAGE); 618 619 switch (field->application) { 620 case HID_GD_MOUSE: 621 case HID_GD_POINTER: code += BTN_MOUSE; break; 622 case HID_GD_JOYSTICK: 623 if (code <= 0xf) 624 code += BTN_JOYSTICK; 625 else 626 code += BTN_TRIGGER_HAPPY - 0x10; 627 break; 628 case HID_GD_GAMEPAD: 629 if (code <= 0xf) 630 code += BTN_GAMEPAD; 631 else 632 code += BTN_TRIGGER_HAPPY - 0x10; 633 break; 634 default: 635 switch (field->physical) { 636 case HID_GD_MOUSE: 637 case HID_GD_POINTER: code += BTN_MOUSE; break; 638 case HID_GD_JOYSTICK: code += BTN_JOYSTICK; break; 639 case HID_GD_GAMEPAD: code += BTN_GAMEPAD; break; 640 default: code += BTN_MISC; 641 } 642 } 643 644 map_key(code); 645 break; 646 647 case HID_UP_SIMULATION: 648 switch (usage->hid & 0xffff) { 649 case 0xba: map_abs(ABS_RUDDER); break; 650 case 0xbb: map_abs(ABS_THROTTLE); break; 651 case 0xc4: map_abs(ABS_GAS); break; 652 case 0xc5: map_abs(ABS_BRAKE); break; 653 case 0xc8: map_abs(ABS_WHEEL); break; 654 default: goto ignore; 655 } 656 break; 657 658 case HID_UP_GENDESK: 659 if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */ 660 switch (usage->hid & 0xf) { 661 case 0x1: map_key_clear(KEY_POWER); break; 662 case 0x2: map_key_clear(KEY_SLEEP); break; 663 case 0x3: map_key_clear(KEY_WAKEUP); break; 664 case 0x4: map_key_clear(KEY_CONTEXT_MENU); break; 665 case 0x5: map_key_clear(KEY_MENU); break; 666 case 0x6: map_key_clear(KEY_PROG1); break; 667 case 0x7: map_key_clear(KEY_HELP); break; 668 case 0x8: map_key_clear(KEY_EXIT); break; 669 case 0x9: map_key_clear(KEY_SELECT); break; 670 case 0xa: map_key_clear(KEY_RIGHT); break; 671 case 0xb: map_key_clear(KEY_LEFT); break; 672 case 0xc: map_key_clear(KEY_UP); break; 673 case 0xd: map_key_clear(KEY_DOWN); break; 674 case 0xe: map_key_clear(KEY_POWER2); break; 675 case 0xf: map_key_clear(KEY_RESTART); break; 676 default: goto unknown; 677 } 678 break; 679 } 680 681 if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */ 682 switch (usage->hid & 0xf) { 683 case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break; 684 default: goto ignore; 685 } 686 break; 687 } 688 689 /* 690 * Some lazy vendors declare 255 usages for System Control, 691 * leading to the creation of ABS_X|Y axis and too many others. 692 * It wouldn't be a problem if joydev doesn't consider the 693 * device as a joystick then. 694 */ 695 if (field->application == HID_GD_SYSTEM_CONTROL) 696 goto ignore; 697 698 if ((usage->hid & 0xf0) == 0x90) { /* D-pad */ 699 switch (usage->hid) { 700 case HID_GD_UP: usage->hat_dir = 1; break; 701 case HID_GD_DOWN: usage->hat_dir = 5; break; 702 case HID_GD_RIGHT: usage->hat_dir = 3; break; 703 case HID_GD_LEFT: usage->hat_dir = 7; break; 704 default: goto unknown; 705 } 706 if (field->dpad) { 707 map_abs(field->dpad); 708 goto ignore; 709 } 710 map_abs(ABS_HAT0X); 711 break; 712 } 713 714 switch (usage->hid) { 715 /* These usage IDs map directly to the usage codes. */ 716 case HID_GD_X: case HID_GD_Y: case HID_GD_Z: 717 case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: 718 if (field->flags & HID_MAIN_ITEM_RELATIVE) 719 map_rel(usage->hid & 0xf); 720 else 721 map_abs_clear(usage->hid & 0xf); 722 break; 723 724 case HID_GD_WHEEL: 725 if (field->flags & HID_MAIN_ITEM_RELATIVE) { 726 set_bit(REL_WHEEL, input->relbit); 727 map_rel(REL_WHEEL_HI_RES); 728 } else { 729 map_abs(usage->hid & 0xf); 730 } 731 break; 732 case HID_GD_SLIDER: case HID_GD_DIAL: 733 if (field->flags & HID_MAIN_ITEM_RELATIVE) 734 map_rel(usage->hid & 0xf); 735 else 736 map_abs(usage->hid & 0xf); 737 break; 738 739 case HID_GD_HATSWITCH: 740 usage->hat_min = field->logical_minimum; 741 usage->hat_max = field->logical_maximum; 742 map_abs(ABS_HAT0X); 743 break; 744 745 case HID_GD_START: map_key_clear(BTN_START); break; 746 case HID_GD_SELECT: map_key_clear(BTN_SELECT); break; 747 748 case HID_GD_RFKILL_BTN: 749 /* MS wireless radio ctl extension, also check CA */ 750 if (field->application == HID_GD_WIRELESS_RADIO_CTLS) { 751 map_key_clear(KEY_RFKILL); 752 /* We need to simulate the btn release */ 753 field->flags |= HID_MAIN_ITEM_RELATIVE; 754 break; 755 } 756 goto unknown; 757 758 default: goto unknown; 759 } 760 761 break; 762 763 case HID_UP_LED: 764 switch (usage->hid & 0xffff) { /* HID-Value: */ 765 case 0x01: map_led (LED_NUML); break; /* "Num Lock" */ 766 case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */ 767 case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */ 768 case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */ 769 case 0x05: map_led (LED_KANA); break; /* "Kana" */ 770 case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */ 771 case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */ 772 case 0x09: map_led (LED_MUTE); break; /* "Mute" */ 773 case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */ 774 case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */ 775 case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */ 776 777 default: goto ignore; 778 } 779 break; 780 781 case HID_UP_DIGITIZER: 782 if ((field->application & 0xff) == 0x01) /* Digitizer */ 783 __set_bit(INPUT_PROP_POINTER, input->propbit); 784 else if ((field->application & 0xff) == 0x02) /* Pen */ 785 __set_bit(INPUT_PROP_DIRECT, input->propbit); 786 787 switch (usage->hid & 0xff) { 788 case 0x00: /* Undefined */ 789 goto ignore; 790 791 case 0x30: /* TipPressure */ 792 if (!test_bit(BTN_TOUCH, input->keybit)) { 793 device->quirks |= HID_QUIRK_NOTOUCH; 794 set_bit(EV_KEY, input->evbit); 795 set_bit(BTN_TOUCH, input->keybit); 796 } 797 map_abs_clear(ABS_PRESSURE); 798 break; 799 800 case 0x32: /* InRange */ 801 switch (field->physical & 0xff) { 802 case 0x21: map_key(BTN_TOOL_MOUSE); break; 803 case 0x22: map_key(BTN_TOOL_FINGER); break; 804 default: map_key(BTN_TOOL_PEN); break; 805 } 806 break; 807 808 case 0x3b: /* Battery Strength */ 809 hidinput_setup_battery(device, HID_INPUT_REPORT, field); 810 usage->type = EV_PWR; 811 return; 812 813 case 0x3c: /* Invert */ 814 map_key_clear(BTN_TOOL_RUBBER); 815 break; 816 817 case 0x3d: /* X Tilt */ 818 map_abs_clear(ABS_TILT_X); 819 break; 820 821 case 0x3e: /* Y Tilt */ 822 map_abs_clear(ABS_TILT_Y); 823 break; 824 825 case 0x33: /* Touch */ 826 case 0x42: /* TipSwitch */ 827 case 0x43: /* TipSwitch2 */ 828 device->quirks &= ~HID_QUIRK_NOTOUCH; 829 map_key_clear(BTN_TOUCH); 830 break; 831 832 case 0x44: /* BarrelSwitch */ 833 map_key_clear(BTN_STYLUS); 834 break; 835 836 case 0x45: /* ERASER */ 837 /* 838 * This event is reported when eraser tip touches the surface. 839 * Actual eraser (BTN_TOOL_RUBBER) is set by Invert usage when 840 * tool gets in proximity. 841 */ 842 map_key_clear(BTN_TOUCH); 843 break; 844 845 case 0x46: /* TabletPick */ 846 case 0x5a: /* SecondaryBarrelSwitch */ 847 map_key_clear(BTN_STYLUS2); 848 break; 849 850 case 0x5b: /* TransducerSerialNumber */ 851 usage->type = EV_MSC; 852 usage->code = MSC_SERIAL; 853 bit = input->mscbit; 854 max = MSC_MAX; 855 break; 856 857 default: goto unknown; 858 } 859 break; 860 861 case HID_UP_TELEPHONY: 862 switch (usage->hid & HID_USAGE) { 863 case 0x2f: map_key_clear(KEY_MICMUTE); break; 864 case 0xb0: map_key_clear(KEY_NUMERIC_0); break; 865 case 0xb1: map_key_clear(KEY_NUMERIC_1); break; 866 case 0xb2: map_key_clear(KEY_NUMERIC_2); break; 867 case 0xb3: map_key_clear(KEY_NUMERIC_3); break; 868 case 0xb4: map_key_clear(KEY_NUMERIC_4); break; 869 case 0xb5: map_key_clear(KEY_NUMERIC_5); break; 870 case 0xb6: map_key_clear(KEY_NUMERIC_6); break; 871 case 0xb7: map_key_clear(KEY_NUMERIC_7); break; 872 case 0xb8: map_key_clear(KEY_NUMERIC_8); break; 873 case 0xb9: map_key_clear(KEY_NUMERIC_9); break; 874 case 0xba: map_key_clear(KEY_NUMERIC_STAR); break; 875 case 0xbb: map_key_clear(KEY_NUMERIC_POUND); break; 876 case 0xbc: map_key_clear(KEY_NUMERIC_A); break; 877 case 0xbd: map_key_clear(KEY_NUMERIC_B); break; 878 case 0xbe: map_key_clear(KEY_NUMERIC_C); break; 879 case 0xbf: map_key_clear(KEY_NUMERIC_D); break; 880 default: goto ignore; 881 } 882 break; 883 884 case HID_UP_CONSUMER: /* USB HUT v1.12, pages 75-84 */ 885 switch (usage->hid & HID_USAGE) { 886 case 0x000: goto ignore; 887 case 0x030: map_key_clear(KEY_POWER); break; 888 case 0x031: map_key_clear(KEY_RESTART); break; 889 case 0x032: map_key_clear(KEY_SLEEP); break; 890 case 0x034: map_key_clear(KEY_SLEEP); break; 891 case 0x035: map_key_clear(KEY_KBDILLUMTOGGLE); break; 892 case 0x036: map_key_clear(BTN_MISC); break; 893 894 case 0x040: map_key_clear(KEY_MENU); break; /* Menu */ 895 case 0x041: map_key_clear(KEY_SELECT); break; /* Menu Pick */ 896 case 0x042: map_key_clear(KEY_UP); break; /* Menu Up */ 897 case 0x043: map_key_clear(KEY_DOWN); break; /* Menu Down */ 898 case 0x044: map_key_clear(KEY_LEFT); break; /* Menu Left */ 899 case 0x045: map_key_clear(KEY_RIGHT); break; /* Menu Right */ 900 case 0x046: map_key_clear(KEY_ESC); break; /* Menu Escape */ 901 case 0x047: map_key_clear(KEY_KPPLUS); break; /* Menu Value Increase */ 902 case 0x048: map_key_clear(KEY_KPMINUS); break; /* Menu Value Decrease */ 903 904 case 0x060: map_key_clear(KEY_INFO); break; /* Data On Screen */ 905 case 0x061: map_key_clear(KEY_SUBTITLE); break; /* Closed Caption */ 906 case 0x063: map_key_clear(KEY_VCR); break; /* VCR/TV */ 907 case 0x065: map_key_clear(KEY_CAMERA); break; /* Snapshot */ 908 case 0x069: map_key_clear(KEY_RED); break; 909 case 0x06a: map_key_clear(KEY_GREEN); break; 910 case 0x06b: map_key_clear(KEY_BLUE); break; 911 case 0x06c: map_key_clear(KEY_YELLOW); break; 912 case 0x06d: map_key_clear(KEY_ASPECT_RATIO); break; 913 914 case 0x06f: map_key_clear(KEY_BRIGHTNESSUP); break; 915 case 0x070: map_key_clear(KEY_BRIGHTNESSDOWN); break; 916 case 0x072: map_key_clear(KEY_BRIGHTNESS_TOGGLE); break; 917 case 0x073: map_key_clear(KEY_BRIGHTNESS_MIN); break; 918 case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break; 919 case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break; 920 921 case 0x079: map_key_clear(KEY_KBDILLUMUP); break; 922 case 0x07a: map_key_clear(KEY_KBDILLUMDOWN); break; 923 case 0x07c: map_key_clear(KEY_KBDILLUMTOGGLE); break; 924 925 case 0x082: map_key_clear(KEY_VIDEO_NEXT); break; 926 case 0x083: map_key_clear(KEY_LAST); break; 927 case 0x084: map_key_clear(KEY_ENTER); break; 928 case 0x088: map_key_clear(KEY_PC); break; 929 case 0x089: map_key_clear(KEY_TV); break; 930 case 0x08a: map_key_clear(KEY_WWW); break; 931 case 0x08b: map_key_clear(KEY_DVD); break; 932 case 0x08c: map_key_clear(KEY_PHONE); break; 933 case 0x08d: map_key_clear(KEY_PROGRAM); break; 934 case 0x08e: map_key_clear(KEY_VIDEOPHONE); break; 935 case 0x08f: map_key_clear(KEY_GAMES); break; 936 case 0x090: map_key_clear(KEY_MEMO); break; 937 case 0x091: map_key_clear(KEY_CD); break; 938 case 0x092: map_key_clear(KEY_VCR); break; 939 case 0x093: map_key_clear(KEY_TUNER); break; 940 case 0x094: map_key_clear(KEY_EXIT); break; 941 case 0x095: map_key_clear(KEY_HELP); break; 942 case 0x096: map_key_clear(KEY_TAPE); break; 943 case 0x097: map_key_clear(KEY_TV2); break; 944 case 0x098: map_key_clear(KEY_SAT); break; 945 case 0x09a: map_key_clear(KEY_PVR); break; 946 947 case 0x09c: map_key_clear(KEY_CHANNELUP); break; 948 case 0x09d: map_key_clear(KEY_CHANNELDOWN); break; 949 case 0x0a0: map_key_clear(KEY_VCR2); break; 950 951 case 0x0b0: map_key_clear(KEY_PLAY); break; 952 case 0x0b1: map_key_clear(KEY_PAUSE); break; 953 case 0x0b2: map_key_clear(KEY_RECORD); break; 954 case 0x0b3: map_key_clear(KEY_FASTFORWARD); break; 955 case 0x0b4: map_key_clear(KEY_REWIND); break; 956 case 0x0b5: map_key_clear(KEY_NEXTSONG); break; 957 case 0x0b6: map_key_clear(KEY_PREVIOUSSONG); break; 958 case 0x0b7: map_key_clear(KEY_STOPCD); break; 959 case 0x0b8: map_key_clear(KEY_EJECTCD); break; 960 case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break; 961 case 0x0b9: map_key_clear(KEY_SHUFFLE); break; 962 case 0x0bf: map_key_clear(KEY_SLOW); break; 963 964 case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break; 965 case 0x0cf: map_key_clear(KEY_VOICECOMMAND); break; 966 case 0x0e0: map_abs_clear(ABS_VOLUME); break; 967 case 0x0e2: map_key_clear(KEY_MUTE); break; 968 case 0x0e5: map_key_clear(KEY_BASSBOOST); break; 969 case 0x0e9: map_key_clear(KEY_VOLUMEUP); break; 970 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break; 971 case 0x0f5: map_key_clear(KEY_SLOW); break; 972 973 case 0x181: map_key_clear(KEY_BUTTONCONFIG); break; 974 case 0x182: map_key_clear(KEY_BOOKMARKS); break; 975 case 0x183: map_key_clear(KEY_CONFIG); break; 976 case 0x184: map_key_clear(KEY_WORDPROCESSOR); break; 977 case 0x185: map_key_clear(KEY_EDITOR); break; 978 case 0x186: map_key_clear(KEY_SPREADSHEET); break; 979 case 0x187: map_key_clear(KEY_GRAPHICSEDITOR); break; 980 case 0x188: map_key_clear(KEY_PRESENTATION); break; 981 case 0x189: map_key_clear(KEY_DATABASE); break; 982 case 0x18a: map_key_clear(KEY_MAIL); break; 983 case 0x18b: map_key_clear(KEY_NEWS); break; 984 case 0x18c: map_key_clear(KEY_VOICEMAIL); break; 985 case 0x18d: map_key_clear(KEY_ADDRESSBOOK); break; 986 case 0x18e: map_key_clear(KEY_CALENDAR); break; 987 case 0x18f: map_key_clear(KEY_TASKMANAGER); break; 988 case 0x190: map_key_clear(KEY_JOURNAL); break; 989 case 0x191: map_key_clear(KEY_FINANCE); break; 990 case 0x192: map_key_clear(KEY_CALC); break; 991 case 0x193: map_key_clear(KEY_PLAYER); break; 992 case 0x194: map_key_clear(KEY_FILE); break; 993 case 0x196: map_key_clear(KEY_WWW); break; 994 case 0x199: map_key_clear(KEY_CHAT); break; 995 case 0x19c: map_key_clear(KEY_LOGOFF); break; 996 case 0x19e: map_key_clear(KEY_COFFEE); break; 997 case 0x19f: map_key_clear(KEY_CONTROLPANEL); break; 998 case 0x1a2: map_key_clear(KEY_APPSELECT); break; 999 case 0x1a3: map_key_clear(KEY_NEXT); break; 1000 case 0x1a4: map_key_clear(KEY_PREVIOUS); break; 1001 case 0x1a6: map_key_clear(KEY_HELP); break; 1002 case 0x1a7: map_key_clear(KEY_DOCUMENTS); break; 1003 case 0x1ab: map_key_clear(KEY_SPELLCHECK); break; 1004 case 0x1ae: map_key_clear(KEY_KEYBOARD); break; 1005 case 0x1b1: map_key_clear(KEY_SCREENSAVER); break; 1006 case 0x1b4: map_key_clear(KEY_FILE); break; 1007 case 0x1b6: map_key_clear(KEY_IMAGES); break; 1008 case 0x1b7: map_key_clear(KEY_AUDIO); break; 1009 case 0x1b8: map_key_clear(KEY_VIDEO); break; 1010 case 0x1bc: map_key_clear(KEY_MESSENGER); break; 1011 case 0x1bd: map_key_clear(KEY_INFO); break; 1012 case 0x1cb: map_key_clear(KEY_ASSISTANT); break; 1013 case 0x201: map_key_clear(KEY_NEW); break; 1014 case 0x202: map_key_clear(KEY_OPEN); break; 1015 case 0x203: map_key_clear(KEY_CLOSE); break; 1016 case 0x204: map_key_clear(KEY_EXIT); break; 1017 case 0x207: map_key_clear(KEY_SAVE); break; 1018 case 0x208: map_key_clear(KEY_PRINT); break; 1019 case 0x209: map_key_clear(KEY_PROPS); break; 1020 case 0x21a: map_key_clear(KEY_UNDO); break; 1021 case 0x21b: map_key_clear(KEY_COPY); break; 1022 case 0x21c: map_key_clear(KEY_CUT); break; 1023 case 0x21d: map_key_clear(KEY_PASTE); break; 1024 case 0x21f: map_key_clear(KEY_FIND); break; 1025 case 0x221: map_key_clear(KEY_SEARCH); break; 1026 case 0x222: map_key_clear(KEY_GOTO); break; 1027 case 0x223: map_key_clear(KEY_HOMEPAGE); break; 1028 case 0x224: map_key_clear(KEY_BACK); break; 1029 case 0x225: map_key_clear(KEY_FORWARD); break; 1030 case 0x226: map_key_clear(KEY_STOP); break; 1031 case 0x227: map_key_clear(KEY_REFRESH); break; 1032 case 0x22a: map_key_clear(KEY_BOOKMARKS); break; 1033 case 0x22d: map_key_clear(KEY_ZOOMIN); break; 1034 case 0x22e: map_key_clear(KEY_ZOOMOUT); break; 1035 case 0x22f: map_key_clear(KEY_ZOOMRESET); break; 1036 case 0x232: map_key_clear(KEY_FULL_SCREEN); break; 1037 case 0x233: map_key_clear(KEY_SCROLLUP); break; 1038 case 0x234: map_key_clear(KEY_SCROLLDOWN); break; 1039 case 0x238: /* AC Pan */ 1040 set_bit(REL_HWHEEL, input->relbit); 1041 map_rel(REL_HWHEEL_HI_RES); 1042 break; 1043 case 0x23d: map_key_clear(KEY_EDIT); break; 1044 case 0x25f: map_key_clear(KEY_CANCEL); break; 1045 case 0x269: map_key_clear(KEY_INSERT); break; 1046 case 0x26a: map_key_clear(KEY_DELETE); break; 1047 case 0x279: map_key_clear(KEY_REDO); break; 1048 1049 case 0x289: map_key_clear(KEY_REPLY); break; 1050 case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; 1051 case 0x28c: map_key_clear(KEY_SEND); break; 1052 1053 case 0x29d: map_key_clear(KEY_KBD_LAYOUT_NEXT); break; 1054 1055 case 0x2c7: map_key_clear(KEY_KBDINPUTASSIST_PREV); break; 1056 case 0x2c8: map_key_clear(KEY_KBDINPUTASSIST_NEXT); break; 1057 case 0x2c9: map_key_clear(KEY_KBDINPUTASSIST_PREVGROUP); break; 1058 case 0x2ca: map_key_clear(KEY_KBDINPUTASSIST_NEXTGROUP); break; 1059 case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; 1060 case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; 1061 1062 case 0x29f: map_key_clear(KEY_SCALE); break; 1063 1064 default: map_key_clear(KEY_UNKNOWN); 1065 } 1066 break; 1067 1068 case HID_UP_GENDEVCTRLS: 1069 switch (usage->hid) { 1070 case HID_DC_BATTERYSTRENGTH: 1071 hidinput_setup_battery(device, HID_INPUT_REPORT, field); 1072 usage->type = EV_PWR; 1073 return; 1074 } 1075 goto unknown; 1076 1077 case HID_UP_BATTERY: 1078 switch (usage->hid) { 1079 case HID_BAT_ABSOLUTESTATEOFCHARGE: 1080 hidinput_setup_battery(device, HID_INPUT_REPORT, field); 1081 usage->type = EV_PWR; > 1082 device->battery_min = 0; > 1083 device->battery_max = 100; 1084 return; 1085 } 1086 goto unknown; 1087 1088 case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */ 1089 set_bit(EV_REP, input->evbit); 1090 switch (usage->hid & HID_USAGE) { 1091 case 0x021: map_key_clear(KEY_PRINT); break; 1092 case 0x070: map_key_clear(KEY_HP); break; 1093 case 0x071: map_key_clear(KEY_CAMERA); break; 1094 case 0x072: map_key_clear(KEY_SOUND); break; 1095 case 0x073: map_key_clear(KEY_QUESTION); break; 1096 case 0x080: map_key_clear(KEY_EMAIL); break; 1097 case 0x081: map_key_clear(KEY_CHAT); break; 1098 case 0x082: map_key_clear(KEY_SEARCH); break; 1099 case 0x083: map_key_clear(KEY_CONNECT); break; 1100 case 0x084: map_key_clear(KEY_FINANCE); break; 1101 case 0x085: map_key_clear(KEY_SPORT); break; 1102 case 0x086: map_key_clear(KEY_SHOP); break; 1103 default: goto ignore; 1104 } 1105 break; 1106 1107 case HID_UP_HPVENDOR2: 1108 set_bit(EV_REP, input->evbit); 1109 switch (usage->hid & HID_USAGE) { 1110 case 0x001: map_key_clear(KEY_MICMUTE); break; 1111 case 0x003: map_key_clear(KEY_BRIGHTNESSDOWN); break; 1112 case 0x004: map_key_clear(KEY_BRIGHTNESSUP); break; 1113 default: goto ignore; 1114 } 1115 break; 1116 1117 case HID_UP_MSVENDOR: 1118 goto ignore; 1119 1120 case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */ 1121 set_bit(EV_REP, input->evbit); 1122 goto ignore; 1123 1124 case HID_UP_LOGIVENDOR: 1125 /* intentional fallback */ 1126 case HID_UP_LOGIVENDOR2: 1127 /* intentional fallback */ 1128 case HID_UP_LOGIVENDOR3: 1129 goto ignore; 1130 1131 case HID_UP_PID: 1132 switch (usage->hid & HID_USAGE) { 1133 case 0xa4: map_key_clear(BTN_DEAD); break; 1134 default: goto ignore; 1135 } 1136 break; 1137 1138 default: 1139 unknown: 1140 if (field->report_size == 1) { 1141 if (field->report->type == HID_OUTPUT_REPORT) { 1142 map_led(LED_MISC); 1143 break; 1144 } 1145 map_key(BTN_MISC); 1146 break; 1147 } 1148 if (field->flags & HID_MAIN_ITEM_RELATIVE) { 1149 map_rel(REL_MISC); 1150 break; 1151 } 1152 map_abs(ABS_MISC); 1153 break; 1154 } 1155 1156 mapped: 1157 /* Mapping failed, bail out */ 1158 if (!bit) 1159 return; 1160 1161 if (device->driver->input_mapped && 1162 device->driver->input_mapped(device, hidinput, field, usage, 1163 &bit, &max) < 0) { 1164 /* 1165 * The driver indicated that no further generic handling 1166 * of the usage is desired. 1167 */ 1168 return; 1169 } 1170 1171 set_bit(usage->type, input->evbit); 1172 1173 /* 1174 * This part is *really* controversial: 1175 * - HID aims at being generic so we should do our best to export 1176 * all incoming events 1177 * - HID describes what events are, so there is no reason for ABS_X 1178 * to be mapped to ABS_Y 1179 * - HID is using *_MISC+N as a default value, but nothing prevents 1180 * *_MISC+N to overwrite a legitimate even, which confuses userspace 1181 * (for instance ABS_MISC + 7 is ABS_MT_SLOT, which has a different 1182 * processing) 1183 * 1184 * If devices still want to use this (at their own risk), they will 1185 * have to use the quirk HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE, but 1186 * the default should be a reliable mapping. 1187 */ 1188 while (usage->code <= max && test_and_set_bit(usage->code, bit)) { 1189 if (device->quirks & HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE) { 1190 usage->code = find_next_zero_bit(bit, 1191 max + 1, 1192 usage->code); 1193 } else { 1194 device->status |= HID_STAT_DUP_DETECTED; 1195 goto ignore; 1196 } 1197 } 1198 1199 if (usage->code > max) 1200 goto ignore; 1201 1202 if (usage->type == EV_ABS) { 1203 1204 int a = field->logical_minimum; 1205 int b = field->logical_maximum; 1206 1207 if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X || usage->code == ABS_Y)) { 1208 a = field->logical_minimum = 0; 1209 b = field->logical_maximum = 255; 1210 } 1211 1212 if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK) 1213 input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4); 1214 else input_set_abs_params(input, usage->code, a, b, 0, 0); 1215 1216 input_abs_set_res(input, usage->code, 1217 hidinput_calc_abs_res(field, usage->code)); 1218 1219 /* use a larger default input buffer for MT devices */ 1220 if (usage->code == ABS_MT_POSITION_X && input->hint_events_per_packet == 0) 1221 input_set_events_per_packet(input, 60); 1222 } 1223 1224 if (usage->type == EV_ABS && 1225 (usage->hat_min < usage->hat_max || usage->hat_dir)) { 1226 int i; 1227 for (i = usage->code; i < usage->code + 2 && i <= max; i++) { 1228 input_set_abs_params(input, i, -1, 1, 0, 0); 1229 set_bit(i, input->absbit); 1230 } 1231 if (usage->hat_dir && !field->dpad) 1232 field->dpad = usage->code; 1233 } 1234 1235 /* for those devices which produce Consumer volume usage as relative, 1236 * we emulate pressing volumeup/volumedown appropriate number of times 1237 * in hidinput_hid_event() 1238 */ 1239 if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) && 1240 (usage->code == ABS_VOLUME)) { 1241 set_bit(KEY_VOLUMEUP, input->keybit); 1242 set_bit(KEY_VOLUMEDOWN, input->keybit); 1243 } 1244 1245 if (usage->type == EV_KEY) { 1246 set_bit(EV_MSC, input->evbit); 1247 set_bit(MSC_SCAN, input->mscbit); 1248 } 1249 1250 return; 1251 1252 ignore: 1253 usage->type = 0; 1254 usage->code = 0; 1255 } 1256 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 34064 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com> To: kbuild-all@lists.01.org Subject: Re: [PATCH 4/4] HID: input: map battery capacity (00850065) Date: Sun, 28 Mar 2021 01:50:56 +0800 [thread overview] Message-ID: <202103280118.9Jjxpf6B-lkp@intel.com> (raw) In-Reply-To: <20210327130508.24849-5-johnchen902@gmail.com> [-- Attachment #1: Type: text/plain, Size: 30586 bytes --] Hi John, Thank you for the patch! Yet something to improve: [auto build test ERROR on hid/for-next] [also build test ERROR on linux/master linus/master jikos-hid/for-next jikos-trivial/for-next v5.12-rc4 next-20210326] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/John-Chen/HID-add-Apple-Magic-Mouse-2-support/20210327-211004 base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next config: x86_64-randconfig-a012-20210327 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d50fe9f0d6b9ee61df8830a67ea0a33c27a637e7) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # https://github.com/0day-ci/linux/commit/00e05cc61c9d267c5857d61fd40638d560460f89 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review John-Chen/HID-add-Apple-Magic-Mouse-2-support/20210327-211004 git checkout 00e05cc61c9d267c5857d61fd40638d560460f89 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/hid/hid-input.c:1082:12: error: no member named 'battery_min' in 'struct hid_device' device->battery_min = 0; ~~~~~~ ^ >> drivers/hid/hid-input.c:1083:12: error: no member named 'battery_max' in 'struct hid_device' device->battery_max = 100; ~~~~~~ ^ 2 errors generated. vim +1082 drivers/hid/hid-input.c 568 569 static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field, 570 struct hid_usage *usage) 571 { 572 struct input_dev *input = hidinput->input; 573 struct hid_device *device = input_get_drvdata(input); 574 int max = 0, code; 575 unsigned long *bit = NULL; 576 577 field->hidinput = hidinput; 578 579 if (field->flags & HID_MAIN_ITEM_CONSTANT) 580 goto ignore; 581 582 /* Ignore if report count is out of bounds. */ 583 if (field->report_count < 1) 584 goto ignore; 585 586 /* only LED usages are supported in output fields */ 587 if (field->report_type == HID_OUTPUT_REPORT && 588 (usage->hid & HID_USAGE_PAGE) != HID_UP_LED) { 589 goto ignore; 590 } 591 592 if (device->driver->input_mapping) { 593 int ret = device->driver->input_mapping(device, hidinput, field, 594 usage, &bit, &max); 595 if (ret > 0) 596 goto mapped; 597 if (ret < 0) 598 goto ignore; 599 } 600 601 switch (usage->hid & HID_USAGE_PAGE) { 602 case HID_UP_UNDEFINED: 603 goto ignore; 604 605 case HID_UP_KEYBOARD: 606 set_bit(EV_REP, input->evbit); 607 608 if ((usage->hid & HID_USAGE) < 256) { 609 if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore; 610 map_key_clear(hid_keyboard[usage->hid & HID_USAGE]); 611 } else 612 map_key(KEY_UNKNOWN); 613 614 break; 615 616 case HID_UP_BUTTON: 617 code = ((usage->hid - 1) & HID_USAGE); 618 619 switch (field->application) { 620 case HID_GD_MOUSE: 621 case HID_GD_POINTER: code += BTN_MOUSE; break; 622 case HID_GD_JOYSTICK: 623 if (code <= 0xf) 624 code += BTN_JOYSTICK; 625 else 626 code += BTN_TRIGGER_HAPPY - 0x10; 627 break; 628 case HID_GD_GAMEPAD: 629 if (code <= 0xf) 630 code += BTN_GAMEPAD; 631 else 632 code += BTN_TRIGGER_HAPPY - 0x10; 633 break; 634 default: 635 switch (field->physical) { 636 case HID_GD_MOUSE: 637 case HID_GD_POINTER: code += BTN_MOUSE; break; 638 case HID_GD_JOYSTICK: code += BTN_JOYSTICK; break; 639 case HID_GD_GAMEPAD: code += BTN_GAMEPAD; break; 640 default: code += BTN_MISC; 641 } 642 } 643 644 map_key(code); 645 break; 646 647 case HID_UP_SIMULATION: 648 switch (usage->hid & 0xffff) { 649 case 0xba: map_abs(ABS_RUDDER); break; 650 case 0xbb: map_abs(ABS_THROTTLE); break; 651 case 0xc4: map_abs(ABS_GAS); break; 652 case 0xc5: map_abs(ABS_BRAKE); break; 653 case 0xc8: map_abs(ABS_WHEEL); break; 654 default: goto ignore; 655 } 656 break; 657 658 case HID_UP_GENDESK: 659 if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */ 660 switch (usage->hid & 0xf) { 661 case 0x1: map_key_clear(KEY_POWER); break; 662 case 0x2: map_key_clear(KEY_SLEEP); break; 663 case 0x3: map_key_clear(KEY_WAKEUP); break; 664 case 0x4: map_key_clear(KEY_CONTEXT_MENU); break; 665 case 0x5: map_key_clear(KEY_MENU); break; 666 case 0x6: map_key_clear(KEY_PROG1); break; 667 case 0x7: map_key_clear(KEY_HELP); break; 668 case 0x8: map_key_clear(KEY_EXIT); break; 669 case 0x9: map_key_clear(KEY_SELECT); break; 670 case 0xa: map_key_clear(KEY_RIGHT); break; 671 case 0xb: map_key_clear(KEY_LEFT); break; 672 case 0xc: map_key_clear(KEY_UP); break; 673 case 0xd: map_key_clear(KEY_DOWN); break; 674 case 0xe: map_key_clear(KEY_POWER2); break; 675 case 0xf: map_key_clear(KEY_RESTART); break; 676 default: goto unknown; 677 } 678 break; 679 } 680 681 if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */ 682 switch (usage->hid & 0xf) { 683 case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break; 684 default: goto ignore; 685 } 686 break; 687 } 688 689 /* 690 * Some lazy vendors declare 255 usages for System Control, 691 * leading to the creation of ABS_X|Y axis and too many others. 692 * It wouldn't be a problem if joydev doesn't consider the 693 * device as a joystick then. 694 */ 695 if (field->application == HID_GD_SYSTEM_CONTROL) 696 goto ignore; 697 698 if ((usage->hid & 0xf0) == 0x90) { /* D-pad */ 699 switch (usage->hid) { 700 case HID_GD_UP: usage->hat_dir = 1; break; 701 case HID_GD_DOWN: usage->hat_dir = 5; break; 702 case HID_GD_RIGHT: usage->hat_dir = 3; break; 703 case HID_GD_LEFT: usage->hat_dir = 7; break; 704 default: goto unknown; 705 } 706 if (field->dpad) { 707 map_abs(field->dpad); 708 goto ignore; 709 } 710 map_abs(ABS_HAT0X); 711 break; 712 } 713 714 switch (usage->hid) { 715 /* These usage IDs map directly to the usage codes. */ 716 case HID_GD_X: case HID_GD_Y: case HID_GD_Z: 717 case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: 718 if (field->flags & HID_MAIN_ITEM_RELATIVE) 719 map_rel(usage->hid & 0xf); 720 else 721 map_abs_clear(usage->hid & 0xf); 722 break; 723 724 case HID_GD_WHEEL: 725 if (field->flags & HID_MAIN_ITEM_RELATIVE) { 726 set_bit(REL_WHEEL, input->relbit); 727 map_rel(REL_WHEEL_HI_RES); 728 } else { 729 map_abs(usage->hid & 0xf); 730 } 731 break; 732 case HID_GD_SLIDER: case HID_GD_DIAL: 733 if (field->flags & HID_MAIN_ITEM_RELATIVE) 734 map_rel(usage->hid & 0xf); 735 else 736 map_abs(usage->hid & 0xf); 737 break; 738 739 case HID_GD_HATSWITCH: 740 usage->hat_min = field->logical_minimum; 741 usage->hat_max = field->logical_maximum; 742 map_abs(ABS_HAT0X); 743 break; 744 745 case HID_GD_START: map_key_clear(BTN_START); break; 746 case HID_GD_SELECT: map_key_clear(BTN_SELECT); break; 747 748 case HID_GD_RFKILL_BTN: 749 /* MS wireless radio ctl extension, also check CA */ 750 if (field->application == HID_GD_WIRELESS_RADIO_CTLS) { 751 map_key_clear(KEY_RFKILL); 752 /* We need to simulate the btn release */ 753 field->flags |= HID_MAIN_ITEM_RELATIVE; 754 break; 755 } 756 goto unknown; 757 758 default: goto unknown; 759 } 760 761 break; 762 763 case HID_UP_LED: 764 switch (usage->hid & 0xffff) { /* HID-Value: */ 765 case 0x01: map_led (LED_NUML); break; /* "Num Lock" */ 766 case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */ 767 case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */ 768 case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */ 769 case 0x05: map_led (LED_KANA); break; /* "Kana" */ 770 case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */ 771 case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */ 772 case 0x09: map_led (LED_MUTE); break; /* "Mute" */ 773 case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */ 774 case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */ 775 case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */ 776 777 default: goto ignore; 778 } 779 break; 780 781 case HID_UP_DIGITIZER: 782 if ((field->application & 0xff) == 0x01) /* Digitizer */ 783 __set_bit(INPUT_PROP_POINTER, input->propbit); 784 else if ((field->application & 0xff) == 0x02) /* Pen */ 785 __set_bit(INPUT_PROP_DIRECT, input->propbit); 786 787 switch (usage->hid & 0xff) { 788 case 0x00: /* Undefined */ 789 goto ignore; 790 791 case 0x30: /* TipPressure */ 792 if (!test_bit(BTN_TOUCH, input->keybit)) { 793 device->quirks |= HID_QUIRK_NOTOUCH; 794 set_bit(EV_KEY, input->evbit); 795 set_bit(BTN_TOUCH, input->keybit); 796 } 797 map_abs_clear(ABS_PRESSURE); 798 break; 799 800 case 0x32: /* InRange */ 801 switch (field->physical & 0xff) { 802 case 0x21: map_key(BTN_TOOL_MOUSE); break; 803 case 0x22: map_key(BTN_TOOL_FINGER); break; 804 default: map_key(BTN_TOOL_PEN); break; 805 } 806 break; 807 808 case 0x3b: /* Battery Strength */ 809 hidinput_setup_battery(device, HID_INPUT_REPORT, field); 810 usage->type = EV_PWR; 811 return; 812 813 case 0x3c: /* Invert */ 814 map_key_clear(BTN_TOOL_RUBBER); 815 break; 816 817 case 0x3d: /* X Tilt */ 818 map_abs_clear(ABS_TILT_X); 819 break; 820 821 case 0x3e: /* Y Tilt */ 822 map_abs_clear(ABS_TILT_Y); 823 break; 824 825 case 0x33: /* Touch */ 826 case 0x42: /* TipSwitch */ 827 case 0x43: /* TipSwitch2 */ 828 device->quirks &= ~HID_QUIRK_NOTOUCH; 829 map_key_clear(BTN_TOUCH); 830 break; 831 832 case 0x44: /* BarrelSwitch */ 833 map_key_clear(BTN_STYLUS); 834 break; 835 836 case 0x45: /* ERASER */ 837 /* 838 * This event is reported when eraser tip touches the surface. 839 * Actual eraser (BTN_TOOL_RUBBER) is set by Invert usage when 840 * tool gets in proximity. 841 */ 842 map_key_clear(BTN_TOUCH); 843 break; 844 845 case 0x46: /* TabletPick */ 846 case 0x5a: /* SecondaryBarrelSwitch */ 847 map_key_clear(BTN_STYLUS2); 848 break; 849 850 case 0x5b: /* TransducerSerialNumber */ 851 usage->type = EV_MSC; 852 usage->code = MSC_SERIAL; 853 bit = input->mscbit; 854 max = MSC_MAX; 855 break; 856 857 default: goto unknown; 858 } 859 break; 860 861 case HID_UP_TELEPHONY: 862 switch (usage->hid & HID_USAGE) { 863 case 0x2f: map_key_clear(KEY_MICMUTE); break; 864 case 0xb0: map_key_clear(KEY_NUMERIC_0); break; 865 case 0xb1: map_key_clear(KEY_NUMERIC_1); break; 866 case 0xb2: map_key_clear(KEY_NUMERIC_2); break; 867 case 0xb3: map_key_clear(KEY_NUMERIC_3); break; 868 case 0xb4: map_key_clear(KEY_NUMERIC_4); break; 869 case 0xb5: map_key_clear(KEY_NUMERIC_5); break; 870 case 0xb6: map_key_clear(KEY_NUMERIC_6); break; 871 case 0xb7: map_key_clear(KEY_NUMERIC_7); break; 872 case 0xb8: map_key_clear(KEY_NUMERIC_8); break; 873 case 0xb9: map_key_clear(KEY_NUMERIC_9); break; 874 case 0xba: map_key_clear(KEY_NUMERIC_STAR); break; 875 case 0xbb: map_key_clear(KEY_NUMERIC_POUND); break; 876 case 0xbc: map_key_clear(KEY_NUMERIC_A); break; 877 case 0xbd: map_key_clear(KEY_NUMERIC_B); break; 878 case 0xbe: map_key_clear(KEY_NUMERIC_C); break; 879 case 0xbf: map_key_clear(KEY_NUMERIC_D); break; 880 default: goto ignore; 881 } 882 break; 883 884 case HID_UP_CONSUMER: /* USB HUT v1.12, pages 75-84 */ 885 switch (usage->hid & HID_USAGE) { 886 case 0x000: goto ignore; 887 case 0x030: map_key_clear(KEY_POWER); break; 888 case 0x031: map_key_clear(KEY_RESTART); break; 889 case 0x032: map_key_clear(KEY_SLEEP); break; 890 case 0x034: map_key_clear(KEY_SLEEP); break; 891 case 0x035: map_key_clear(KEY_KBDILLUMTOGGLE); break; 892 case 0x036: map_key_clear(BTN_MISC); break; 893 894 case 0x040: map_key_clear(KEY_MENU); break; /* Menu */ 895 case 0x041: map_key_clear(KEY_SELECT); break; /* Menu Pick */ 896 case 0x042: map_key_clear(KEY_UP); break; /* Menu Up */ 897 case 0x043: map_key_clear(KEY_DOWN); break; /* Menu Down */ 898 case 0x044: map_key_clear(KEY_LEFT); break; /* Menu Left */ 899 case 0x045: map_key_clear(KEY_RIGHT); break; /* Menu Right */ 900 case 0x046: map_key_clear(KEY_ESC); break; /* Menu Escape */ 901 case 0x047: map_key_clear(KEY_KPPLUS); break; /* Menu Value Increase */ 902 case 0x048: map_key_clear(KEY_KPMINUS); break; /* Menu Value Decrease */ 903 904 case 0x060: map_key_clear(KEY_INFO); break; /* Data On Screen */ 905 case 0x061: map_key_clear(KEY_SUBTITLE); break; /* Closed Caption */ 906 case 0x063: map_key_clear(KEY_VCR); break; /* VCR/TV */ 907 case 0x065: map_key_clear(KEY_CAMERA); break; /* Snapshot */ 908 case 0x069: map_key_clear(KEY_RED); break; 909 case 0x06a: map_key_clear(KEY_GREEN); break; 910 case 0x06b: map_key_clear(KEY_BLUE); break; 911 case 0x06c: map_key_clear(KEY_YELLOW); break; 912 case 0x06d: map_key_clear(KEY_ASPECT_RATIO); break; 913 914 case 0x06f: map_key_clear(KEY_BRIGHTNESSUP); break; 915 case 0x070: map_key_clear(KEY_BRIGHTNESSDOWN); break; 916 case 0x072: map_key_clear(KEY_BRIGHTNESS_TOGGLE); break; 917 case 0x073: map_key_clear(KEY_BRIGHTNESS_MIN); break; 918 case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break; 919 case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break; 920 921 case 0x079: map_key_clear(KEY_KBDILLUMUP); break; 922 case 0x07a: map_key_clear(KEY_KBDILLUMDOWN); break; 923 case 0x07c: map_key_clear(KEY_KBDILLUMTOGGLE); break; 924 925 case 0x082: map_key_clear(KEY_VIDEO_NEXT); break; 926 case 0x083: map_key_clear(KEY_LAST); break; 927 case 0x084: map_key_clear(KEY_ENTER); break; 928 case 0x088: map_key_clear(KEY_PC); break; 929 case 0x089: map_key_clear(KEY_TV); break; 930 case 0x08a: map_key_clear(KEY_WWW); break; 931 case 0x08b: map_key_clear(KEY_DVD); break; 932 case 0x08c: map_key_clear(KEY_PHONE); break; 933 case 0x08d: map_key_clear(KEY_PROGRAM); break; 934 case 0x08e: map_key_clear(KEY_VIDEOPHONE); break; 935 case 0x08f: map_key_clear(KEY_GAMES); break; 936 case 0x090: map_key_clear(KEY_MEMO); break; 937 case 0x091: map_key_clear(KEY_CD); break; 938 case 0x092: map_key_clear(KEY_VCR); break; 939 case 0x093: map_key_clear(KEY_TUNER); break; 940 case 0x094: map_key_clear(KEY_EXIT); break; 941 case 0x095: map_key_clear(KEY_HELP); break; 942 case 0x096: map_key_clear(KEY_TAPE); break; 943 case 0x097: map_key_clear(KEY_TV2); break; 944 case 0x098: map_key_clear(KEY_SAT); break; 945 case 0x09a: map_key_clear(KEY_PVR); break; 946 947 case 0x09c: map_key_clear(KEY_CHANNELUP); break; 948 case 0x09d: map_key_clear(KEY_CHANNELDOWN); break; 949 case 0x0a0: map_key_clear(KEY_VCR2); break; 950 951 case 0x0b0: map_key_clear(KEY_PLAY); break; 952 case 0x0b1: map_key_clear(KEY_PAUSE); break; 953 case 0x0b2: map_key_clear(KEY_RECORD); break; 954 case 0x0b3: map_key_clear(KEY_FASTFORWARD); break; 955 case 0x0b4: map_key_clear(KEY_REWIND); break; 956 case 0x0b5: map_key_clear(KEY_NEXTSONG); break; 957 case 0x0b6: map_key_clear(KEY_PREVIOUSSONG); break; 958 case 0x0b7: map_key_clear(KEY_STOPCD); break; 959 case 0x0b8: map_key_clear(KEY_EJECTCD); break; 960 case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break; 961 case 0x0b9: map_key_clear(KEY_SHUFFLE); break; 962 case 0x0bf: map_key_clear(KEY_SLOW); break; 963 964 case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break; 965 case 0x0cf: map_key_clear(KEY_VOICECOMMAND); break; 966 case 0x0e0: map_abs_clear(ABS_VOLUME); break; 967 case 0x0e2: map_key_clear(KEY_MUTE); break; 968 case 0x0e5: map_key_clear(KEY_BASSBOOST); break; 969 case 0x0e9: map_key_clear(KEY_VOLUMEUP); break; 970 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break; 971 case 0x0f5: map_key_clear(KEY_SLOW); break; 972 973 case 0x181: map_key_clear(KEY_BUTTONCONFIG); break; 974 case 0x182: map_key_clear(KEY_BOOKMARKS); break; 975 case 0x183: map_key_clear(KEY_CONFIG); break; 976 case 0x184: map_key_clear(KEY_WORDPROCESSOR); break; 977 case 0x185: map_key_clear(KEY_EDITOR); break; 978 case 0x186: map_key_clear(KEY_SPREADSHEET); break; 979 case 0x187: map_key_clear(KEY_GRAPHICSEDITOR); break; 980 case 0x188: map_key_clear(KEY_PRESENTATION); break; 981 case 0x189: map_key_clear(KEY_DATABASE); break; 982 case 0x18a: map_key_clear(KEY_MAIL); break; 983 case 0x18b: map_key_clear(KEY_NEWS); break; 984 case 0x18c: map_key_clear(KEY_VOICEMAIL); break; 985 case 0x18d: map_key_clear(KEY_ADDRESSBOOK); break; 986 case 0x18e: map_key_clear(KEY_CALENDAR); break; 987 case 0x18f: map_key_clear(KEY_TASKMANAGER); break; 988 case 0x190: map_key_clear(KEY_JOURNAL); break; 989 case 0x191: map_key_clear(KEY_FINANCE); break; 990 case 0x192: map_key_clear(KEY_CALC); break; 991 case 0x193: map_key_clear(KEY_PLAYER); break; 992 case 0x194: map_key_clear(KEY_FILE); break; 993 case 0x196: map_key_clear(KEY_WWW); break; 994 case 0x199: map_key_clear(KEY_CHAT); break; 995 case 0x19c: map_key_clear(KEY_LOGOFF); break; 996 case 0x19e: map_key_clear(KEY_COFFEE); break; 997 case 0x19f: map_key_clear(KEY_CONTROLPANEL); break; 998 case 0x1a2: map_key_clear(KEY_APPSELECT); break; 999 case 0x1a3: map_key_clear(KEY_NEXT); break; 1000 case 0x1a4: map_key_clear(KEY_PREVIOUS); break; 1001 case 0x1a6: map_key_clear(KEY_HELP); break; 1002 case 0x1a7: map_key_clear(KEY_DOCUMENTS); break; 1003 case 0x1ab: map_key_clear(KEY_SPELLCHECK); break; 1004 case 0x1ae: map_key_clear(KEY_KEYBOARD); break; 1005 case 0x1b1: map_key_clear(KEY_SCREENSAVER); break; 1006 case 0x1b4: map_key_clear(KEY_FILE); break; 1007 case 0x1b6: map_key_clear(KEY_IMAGES); break; 1008 case 0x1b7: map_key_clear(KEY_AUDIO); break; 1009 case 0x1b8: map_key_clear(KEY_VIDEO); break; 1010 case 0x1bc: map_key_clear(KEY_MESSENGER); break; 1011 case 0x1bd: map_key_clear(KEY_INFO); break; 1012 case 0x1cb: map_key_clear(KEY_ASSISTANT); break; 1013 case 0x201: map_key_clear(KEY_NEW); break; 1014 case 0x202: map_key_clear(KEY_OPEN); break; 1015 case 0x203: map_key_clear(KEY_CLOSE); break; 1016 case 0x204: map_key_clear(KEY_EXIT); break; 1017 case 0x207: map_key_clear(KEY_SAVE); break; 1018 case 0x208: map_key_clear(KEY_PRINT); break; 1019 case 0x209: map_key_clear(KEY_PROPS); break; 1020 case 0x21a: map_key_clear(KEY_UNDO); break; 1021 case 0x21b: map_key_clear(KEY_COPY); break; 1022 case 0x21c: map_key_clear(KEY_CUT); break; 1023 case 0x21d: map_key_clear(KEY_PASTE); break; 1024 case 0x21f: map_key_clear(KEY_FIND); break; 1025 case 0x221: map_key_clear(KEY_SEARCH); break; 1026 case 0x222: map_key_clear(KEY_GOTO); break; 1027 case 0x223: map_key_clear(KEY_HOMEPAGE); break; 1028 case 0x224: map_key_clear(KEY_BACK); break; 1029 case 0x225: map_key_clear(KEY_FORWARD); break; 1030 case 0x226: map_key_clear(KEY_STOP); break; 1031 case 0x227: map_key_clear(KEY_REFRESH); break; 1032 case 0x22a: map_key_clear(KEY_BOOKMARKS); break; 1033 case 0x22d: map_key_clear(KEY_ZOOMIN); break; 1034 case 0x22e: map_key_clear(KEY_ZOOMOUT); break; 1035 case 0x22f: map_key_clear(KEY_ZOOMRESET); break; 1036 case 0x232: map_key_clear(KEY_FULL_SCREEN); break; 1037 case 0x233: map_key_clear(KEY_SCROLLUP); break; 1038 case 0x234: map_key_clear(KEY_SCROLLDOWN); break; 1039 case 0x238: /* AC Pan */ 1040 set_bit(REL_HWHEEL, input->relbit); 1041 map_rel(REL_HWHEEL_HI_RES); 1042 break; 1043 case 0x23d: map_key_clear(KEY_EDIT); break; 1044 case 0x25f: map_key_clear(KEY_CANCEL); break; 1045 case 0x269: map_key_clear(KEY_INSERT); break; 1046 case 0x26a: map_key_clear(KEY_DELETE); break; 1047 case 0x279: map_key_clear(KEY_REDO); break; 1048 1049 case 0x289: map_key_clear(KEY_REPLY); break; 1050 case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; 1051 case 0x28c: map_key_clear(KEY_SEND); break; 1052 1053 case 0x29d: map_key_clear(KEY_KBD_LAYOUT_NEXT); break; 1054 1055 case 0x2c7: map_key_clear(KEY_KBDINPUTASSIST_PREV); break; 1056 case 0x2c8: map_key_clear(KEY_KBDINPUTASSIST_NEXT); break; 1057 case 0x2c9: map_key_clear(KEY_KBDINPUTASSIST_PREVGROUP); break; 1058 case 0x2ca: map_key_clear(KEY_KBDINPUTASSIST_NEXTGROUP); break; 1059 case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; 1060 case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; 1061 1062 case 0x29f: map_key_clear(KEY_SCALE); break; 1063 1064 default: map_key_clear(KEY_UNKNOWN); 1065 } 1066 break; 1067 1068 case HID_UP_GENDEVCTRLS: 1069 switch (usage->hid) { 1070 case HID_DC_BATTERYSTRENGTH: 1071 hidinput_setup_battery(device, HID_INPUT_REPORT, field); 1072 usage->type = EV_PWR; 1073 return; 1074 } 1075 goto unknown; 1076 1077 case HID_UP_BATTERY: 1078 switch (usage->hid) { 1079 case HID_BAT_ABSOLUTESTATEOFCHARGE: 1080 hidinput_setup_battery(device, HID_INPUT_REPORT, field); 1081 usage->type = EV_PWR; > 1082 device->battery_min = 0; > 1083 device->battery_max = 100; 1084 return; 1085 } 1086 goto unknown; 1087 1088 case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */ 1089 set_bit(EV_REP, input->evbit); 1090 switch (usage->hid & HID_USAGE) { 1091 case 0x021: map_key_clear(KEY_PRINT); break; 1092 case 0x070: map_key_clear(KEY_HP); break; 1093 case 0x071: map_key_clear(KEY_CAMERA); break; 1094 case 0x072: map_key_clear(KEY_SOUND); break; 1095 case 0x073: map_key_clear(KEY_QUESTION); break; 1096 case 0x080: map_key_clear(KEY_EMAIL); break; 1097 case 0x081: map_key_clear(KEY_CHAT); break; 1098 case 0x082: map_key_clear(KEY_SEARCH); break; 1099 case 0x083: map_key_clear(KEY_CONNECT); break; 1100 case 0x084: map_key_clear(KEY_FINANCE); break; 1101 case 0x085: map_key_clear(KEY_SPORT); break; 1102 case 0x086: map_key_clear(KEY_SHOP); break; 1103 default: goto ignore; 1104 } 1105 break; 1106 1107 case HID_UP_HPVENDOR2: 1108 set_bit(EV_REP, input->evbit); 1109 switch (usage->hid & HID_USAGE) { 1110 case 0x001: map_key_clear(KEY_MICMUTE); break; 1111 case 0x003: map_key_clear(KEY_BRIGHTNESSDOWN); break; 1112 case 0x004: map_key_clear(KEY_BRIGHTNESSUP); break; 1113 default: goto ignore; 1114 } 1115 break; 1116 1117 case HID_UP_MSVENDOR: 1118 goto ignore; 1119 1120 case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */ 1121 set_bit(EV_REP, input->evbit); 1122 goto ignore; 1123 1124 case HID_UP_LOGIVENDOR: 1125 /* intentional fallback */ 1126 case HID_UP_LOGIVENDOR2: 1127 /* intentional fallback */ 1128 case HID_UP_LOGIVENDOR3: 1129 goto ignore; 1130 1131 case HID_UP_PID: 1132 switch (usage->hid & HID_USAGE) { 1133 case 0xa4: map_key_clear(BTN_DEAD); break; 1134 default: goto ignore; 1135 } 1136 break; 1137 1138 default: 1139 unknown: 1140 if (field->report_size == 1) { 1141 if (field->report->type == HID_OUTPUT_REPORT) { 1142 map_led(LED_MISC); 1143 break; 1144 } 1145 map_key(BTN_MISC); 1146 break; 1147 } 1148 if (field->flags & HID_MAIN_ITEM_RELATIVE) { 1149 map_rel(REL_MISC); 1150 break; 1151 } 1152 map_abs(ABS_MISC); 1153 break; 1154 } 1155 1156 mapped: 1157 /* Mapping failed, bail out */ 1158 if (!bit) 1159 return; 1160 1161 if (device->driver->input_mapped && 1162 device->driver->input_mapped(device, hidinput, field, usage, 1163 &bit, &max) < 0) { 1164 /* 1165 * The driver indicated that no further generic handling 1166 * of the usage is desired. 1167 */ 1168 return; 1169 } 1170 1171 set_bit(usage->type, input->evbit); 1172 1173 /* 1174 * This part is *really* controversial: 1175 * - HID aims at being generic so we should do our best to export 1176 * all incoming events 1177 * - HID describes what events are, so there is no reason for ABS_X 1178 * to be mapped to ABS_Y 1179 * - HID is using *_MISC+N as a default value, but nothing prevents 1180 * *_MISC+N to overwrite a legitimate even, which confuses userspace 1181 * (for instance ABS_MISC + 7 is ABS_MT_SLOT, which has a different 1182 * processing) 1183 * 1184 * If devices still want to use this (at their own risk), they will 1185 * have to use the quirk HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE, but 1186 * the default should be a reliable mapping. 1187 */ 1188 while (usage->code <= max && test_and_set_bit(usage->code, bit)) { 1189 if (device->quirks & HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE) { 1190 usage->code = find_next_zero_bit(bit, 1191 max + 1, 1192 usage->code); 1193 } else { 1194 device->status |= HID_STAT_DUP_DETECTED; 1195 goto ignore; 1196 } 1197 } 1198 1199 if (usage->code > max) 1200 goto ignore; 1201 1202 if (usage->type == EV_ABS) { 1203 1204 int a = field->logical_minimum; 1205 int b = field->logical_maximum; 1206 1207 if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X || usage->code == ABS_Y)) { 1208 a = field->logical_minimum = 0; 1209 b = field->logical_maximum = 255; 1210 } 1211 1212 if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK) 1213 input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4); 1214 else input_set_abs_params(input, usage->code, a, b, 0, 0); 1215 1216 input_abs_set_res(input, usage->code, 1217 hidinput_calc_abs_res(field, usage->code)); 1218 1219 /* use a larger default input buffer for MT devices */ 1220 if (usage->code == ABS_MT_POSITION_X && input->hint_events_per_packet == 0) 1221 input_set_events_per_packet(input, 60); 1222 } 1223 1224 if (usage->type == EV_ABS && 1225 (usage->hat_min < usage->hat_max || usage->hat_dir)) { 1226 int i; 1227 for (i = usage->code; i < usage->code + 2 && i <= max; i++) { 1228 input_set_abs_params(input, i, -1, 1, 0, 0); 1229 set_bit(i, input->absbit); 1230 } 1231 if (usage->hat_dir && !field->dpad) 1232 field->dpad = usage->code; 1233 } 1234 1235 /* for those devices which produce Consumer volume usage as relative, 1236 * we emulate pressing volumeup/volumedown appropriate number of times 1237 * in hidinput_hid_event() 1238 */ 1239 if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) && 1240 (usage->code == ABS_VOLUME)) { 1241 set_bit(KEY_VOLUMEUP, input->keybit); 1242 set_bit(KEY_VOLUMEDOWN, input->keybit); 1243 } 1244 1245 if (usage->type == EV_KEY) { 1246 set_bit(EV_MSC, input->evbit); 1247 set_bit(MSC_SCAN, input->mscbit); 1248 } 1249 1250 return; 1251 1252 ignore: 1253 usage->type = 0; 1254 usage->code = 0; 1255 } 1256 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org [-- Attachment #2: config.gz --] [-- Type: application/gzip, Size: 34064 bytes --]
next prev parent reply other threads:[~2021-03-27 17:52 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-27 13:05 [PATCH 0/4] HID: add Apple Magic Mouse 2 support John Chen 2021-03-27 13:05 ` [PATCH 1/4] HID: magicmouse: " John Chen 2021-03-27 13:05 ` [PATCH 2/4] HID: magicmouse: fix 3 button emulation of Mouse 2 John Chen 2021-03-27 13:05 ` [PATCH 3/4] HID: magicmouse: fix reconnection of Magic " John Chen 2021-03-27 13:05 ` [PATCH 4/4] HID: input: map battery capacity (00850065) John Chen 2021-03-27 14:14 ` Pochang Chen 2021-03-27 17:22 ` kernel test robot 2021-03-27 17:22 ` kernel test robot 2021-03-27 17:50 ` kernel test robot [this message] 2021-03-27 17:50 ` kernel test robot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=202103280118.9Jjxpf6B-lkp@intel.com \ --to=lkp@intel.com \ --cc=benjamin.tissoires@redhat.com \ --cc=clang-built-linux@googlegroups.com \ --cc=jikos@kernel.org \ --cc=johnchen902@gmail.com \ --cc=kbuild-all@lists.01.org \ --cc=linux-kernel@vger.kernel.org \ --cc=ricardo.e.p.rodrigues@gmail.com \ --cc=rohitpid@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.