Ignore:
Timestamp:
Apr 14, 2017, 9:41:36 PM (6 weeks ago)
Author:
brainslayer
Message:

kernel update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/linux/universal/linux-4.9/drivers/hid/hid-multitouch.c

    r31574 r31859  
    109109        unsigned last_slot_field;       /* the last field of a slot */
    110110        unsigned mt_report_id;  /* the report ID of the multitouch device */
     111        unsigned long initial_quirks;   /* initial quirks state */
    111112        __s16 inputmode;        /* InputMode HID feature, -1 if non-existent */
    112113        __s16 inputmode_index;  /* InputMode HID feature index in the report */
     
    319320
    320321        /*
    321          * Only fetch the feature report if initial reports are not already
    322          * been retrieved. Currently this is only done for Windows 8 touch
    323          * devices.
     322         * Do not fetch the feature report if the device has been explicitly
     323         * marked as non-capable.
    324324         */
    325         if (!(hdev->quirks & HID_QUIRK_NO_INIT_REPORTS))
    326                 return;
    327         if (td->mtclass.name != MT_CLS_WIN_8)
     325        if (td->initial_quirks & HID_QUIRK_NO_INIT_REPORTS)
    328326                return;
    329327
     
    843841            field->application != HID_DG_TOUCHSCREEN &&
    844842            field->application != HID_DG_PEN &&
    845             field->application != HID_DG_TOUCHPAD)
     843            field->application != HID_DG_TOUCHPAD &&
     844            field->application != HID_GD_KEYBOARD &&
     845            field->application != HID_CP_CONSUMER_CONTROL)
    846846                return -1;
    847847
     
    10841084        }
    10851085
     1086        td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL);
     1087        if (!td) {
     1088                dev_err(&hdev->dev, "cannot allocate multitouch data\n");
     1089                return -ENOMEM;
     1090        }
     1091        td->mtclass = *mtclass;
     1092        td->inputmode = -1;
     1093        td->maxcontact_report_id = -1;
     1094        td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN;
     1095        td->cc_index = -1;
     1096        td->mt_report_id = -1;
     1097        hid_set_drvdata(hdev, td);
     1098
     1099        td->fields = devm_kzalloc(&hdev->dev, sizeof(struct mt_fields),
     1100                                  GFP_KERNEL);
     1101        if (!td->fields) {
     1102                dev_err(&hdev->dev, "cannot allocate multitouch fields data\n");
     1103                return -ENOMEM;
     1104        }
     1105
     1106        if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
     1107                td->serial_maybe = true;
     1108
     1109        /*
     1110         * Store the initial quirk state
     1111         */
     1112        td->initial_quirks = hdev->quirks;
     1113
    10861114        /* This allows the driver to correctly support devices
    10871115         * that emit events over several HID messages.
     
    10981126
    10991127        /*
    1100          * Handle special quirks for Windows 8 certified devices.
     1128         * Some multitouch screens do not like to be polled for input
     1129         * reports. Fortunately, the Win8 spec says that all touches
     1130         * should be sent during each report, making the initialization
     1131         * of input reports unnecessary. For Win7 devices, well, let's hope
     1132         * they will still be happy (this is only be a problem if a touch
     1133         * was already there while probing the device).
     1134         *
     1135         * In addition some touchpads do not behave well if we read
     1136         * all feature reports from them. Instead we prevent
     1137         * initial report fetching and then selectively fetch each
     1138         * report we are interested in.
    11011139         */
    1102         if (id->group == HID_GROUP_MULTITOUCH_WIN_8)
    1103                 /*
    1104                  * Some multitouch screens do not like to be polled for input
    1105                  * reports. Fortunately, the Win8 spec says that all touches
    1106                  * should be sent during each report, making the initialization
    1107                  * of input reports unnecessary.
    1108                  *
    1109                  * In addition some touchpads do not behave well if we read
    1110                  * all feature reports from them. Instead we prevent
    1111                  * initial report fetching and then selectively fetch each
    1112                  * report we are interested in.
    1113                  */
    1114                 hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
    1115 
    1116         td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL);
    1117         if (!td) {
    1118                 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
    1119                 return -ENOMEM;
    1120         }
    1121         td->mtclass = *mtclass;
    1122         td->inputmode = -1;
    1123         td->maxcontact_report_id = -1;
    1124         td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN;
    1125         td->cc_index = -1;
    1126         td->mt_report_id = -1;
    1127         hid_set_drvdata(hdev, td);
    1128 
    1129         td->fields = devm_kzalloc(&hdev->dev, sizeof(struct mt_fields),
    1130                                   GFP_KERNEL);
    1131         if (!td->fields) {
    1132                 dev_err(&hdev->dev, "cannot allocate multitouch fields data\n");
    1133                 return -ENOMEM;
    1134         }
    1135 
    1136         if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
    1137                 td->serial_maybe = true;
     1140        hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
    11381141
    11391142        ret = hid_parse(hdev);
     
    12051208static void mt_remove(struct hid_device *hdev)
    12061209{
     1210        struct mt_device *td = hid_get_drvdata(hdev);
     1211
    12071212        sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
    12081213        hid_hw_stop(hdev);
     1214        hdev->quirks = td->initial_quirks;
    12091215}
    12101216
Note: See TracChangeset for help on using the changeset viewer.