Guy, sorry to drop this just after your kind letter yesterday. This change has been in the works for a little while, and would have been sent in last week if I hadn't found an error in my model. Sorry to send these patches as such large chunks. In the current version of hid-ntrig, contacts are rejected based on a simple size threshold to filter out randomly generated activity. Unfortunately I was too aggressive in the selection of that threshold. As Micki may have pointed out we can improve the responsiveness of the 12" inch devices. Its actually been pretty good, but there was definitely room for improvement. However, the 17" studio laptop with the ntrig sensor still uses the same logical range which results in a decrease in the perceived size of a contact. Consequently, one needs a fairly substantial contact area to hit the threshold that was hard coded. Since I still don't fully understand the source of the noise, and don't have an accurate characterization, I've used what I have observed to create filters that should enable noise reduction/elimination as well as improve the sensitivity. Since I don't actually know what the optimal defaults are, and since the behavior of the screen seems to change from time to time, I'd like to expose the tuning parameters to the user. Perhaps between feedback from users and hopefully some advice from ntrig, we can select sensible defaults. On a side note, I haven't really used module parameters and sysfs before. What I wrote works fine, and I tried to follow the style of examples. Still I'd like some feedback of what I did wrong, or right. Rafi --
This should make it a little more convenient to tweak the filtering
parameters on the fly. Also unlike load-time parameters, this provides
independent tuning for each device conntected.
Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
---
drivers/hid/hid-ntrig.c | 285 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 285 insertions(+), 0 deletions(-)
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 18609c1..b6b0cae 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -89,6 +89,287 @@ struct ntrig_data {
__u16 sensor_physical_height;
};
+
+static ssize_t show_phys_width(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct ntrig_data *nd = hid_get_drvdata(hdev);
+
+ return sprintf(buf, "%d\n", nd->sensor_physical_width);
+}
+
+static DEVICE_ATTR(sensor_physical_width, S_IRUGO, show_phys_width, NULL);
+
+static ssize_t show_phys_height(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct ntrig_data *nd = hid_get_drvdata(hdev);
+
+ return sprintf(buf, "%d\n", nd->sensor_physical_height);
+}
+
+static DEVICE_ATTR(sensor_physical_height, S_IRUGO, show_phys_height, NULL);
+
+static ssize_t show_log_width(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct ntrig_data *nd = hid_get_drvdata(hdev);
+
+ return sprintf(buf, "%d\n", nd->sensor_logical_width);
+}
+
+static DEVICE_ATTR(sensor_logical_width, S_IRUGO, show_log_width, NULL);
+
+static ssize_t show_log_height(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct ntrig_data *nd = ...Hi Rafi, sorry, it took me quite some time to go through and review the patches. I have now applied them. Could you please also submit a separate one, adding the sysfs entries documentation (Documentation/ABI/testing would be the proper place). Thanks, -- Jiri Kosina SUSE Labs, Novell Inc. --
