OSDN Git Service

HID: ntrig: revert to older version
authorChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 8 Aug 2014 19:41:54 +0000 (19:41 +0000)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Sat, 13 Dec 2014 18:37:23 +0000 (02:37 +0800)
It is said the version works better for android-x86.
It's provided by Yo Abe <abe.geel@gmail.com>.

drivers/hid/hid-ntrig.c

index 600f207..bd04ca6 100644 (file)
@@ -859,43 +859,12 @@ not_claimed_input:
        return 1;
 }
 
-static void ntrig_input_configured(struct hid_device *hid,
-               struct hid_input *hidinput)
-
-{
-       struct input_dev *input = hidinput->input;
-
-       if (hidinput->report->maxfield < 1)
-               return;
-
-       switch (hidinput->report->field[0]->application) {
-       case HID_DG_PEN:
-               input->name = "N-Trig Pen";
-               break;
-       case HID_DG_TOUCHSCREEN:
-               /* These keys are redundant for fingers, clear them
-                * to prevent incorrect identification */
-               __clear_bit(BTN_TOOL_PEN, input->keybit);
-               __clear_bit(BTN_TOOL_FINGER, input->keybit);
-               __clear_bit(BTN_0, input->keybit);
-               __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
-               /*
-                * The physical touchscreen (single touch)
-                * input has a value for physical, whereas
-                * the multitouch only has logical input
-                * fields.
-                */
-               input->name = (hidinput->report->field[0]->physical) ?
-                                                       "N-Trig Touchscreen" :
-                                                       "N-Trig MultiTouch";
-               break;
-       }
-}
-
 static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
 {
        int ret;
        struct ntrig_data *nd;
+       struct hid_input *hidinput;
+       struct input_dev *input;
        struct hid_report *report;
 
        if (id->driver_data)
@@ -914,10 +883,10 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
        nd->activate_slack = activate_slack;
        nd->act_state = activate_slack;
        nd->deactivate_slack = -deactivate_slack;
-       nd->sensor_logical_width = 1;
-       nd->sensor_logical_height = 1;
-       nd->sensor_physical_width = 1;
-       nd->sensor_physical_height = 1;
+       nd->sensor_logical_width = 0;
+       nd->sensor_logical_height = 0;
+       nd->sensor_physical_width = 0;
+       nd->sensor_physical_height = 0;
 
        hid_set_drvdata(hdev, nd);
 
@@ -933,6 +902,38 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
                goto err_free;
        }
 
+
+       list_for_each_entry(hidinput, &hdev->inputs, list) {
+               if (hidinput->report->maxfield < 1)
+                       continue;
+
+               input = hidinput->input;
+               switch (hidinput->report->field[0]->application) {
+               case HID_DG_PEN:
+                       input->name = "N-Trig Pen";
+                       break;
+               case HID_DG_TOUCHSCREEN:
+                       /* These keys are redundant for fingers, clear them
+                        * to prevent incorrect identification */
+                       __clear_bit(BTN_TOOL_PEN, input->keybit);
+                       __clear_bit(BTN_TOOL_FINGER, input->keybit);
+                       __clear_bit(BTN_0, input->keybit);
+                       __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
+                       /*
+                        * The physical touchscreen (single touch)
+                        * input has a value for physical, whereas
+                        * the multitouch only has logical input
+                        * fields.
+                        */
+                       input->name =
+                               (hidinput->report->field[0]
+                                ->physical) ?
+                               "N-Trig Touchscreen" :
+                               "N-Trig MultiTouch";
+                       break;
+               }
+       }
+
        /* This is needed for devices with more recent firmware versions */
        report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a];
        if (report) {
@@ -1023,7 +1024,6 @@ static struct hid_driver ntrig_driver = {
        .remove = ntrig_remove,
        .input_mapping = ntrig_input_mapping,
        .input_mapped = ntrig_input_mapped,
-       .input_configured = ntrig_input_configured,
        .usage_table = ntrig_grabbed_usages,
        .event = ntrig_event,
 };