Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1514451
| From | "Ooi, Joyce" <joyce.ooi@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] hid: sensor: fix input and feature attributes in HID sensor custom sysfs interface |
| Date | 2016-11-03 12:00 +0100 |
| Message-ID | <sznUt-2MN-17@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
User is unable to access to input-X-yyy and feature-X-yyy where
X is a hex value and more than 9 (e.g. input-a-yyy, feature-b-yyy) in HID
sensor custom sysfs interface.
This is because when creating the attribute, the attribute index is
written to using %x (hex). However, when reading and writing values into
the attribute, the attribute index is scanned using %d (decimal). Hence,
user is unable to access to attributes with index in hex values
(e.g. 'a', 'b', 'c') but able to access to attributes with index in
decimal values (e.g. 1, 2, 3,..).
This fix will change input-%d-%x-%s and feature-%d-%x-%s to input-%x-%x-%s
and feature-%x-%x-%s in show_values() and store_values() accordingly.
Signed-off-by: Ooi, Joyce <joyce.ooi@intel.com>
---
drivers/hid/hid-sensor-custom.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 5614fee..3a84aaf 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -292,11 +292,11 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr,
bool input = false;
int value = 0;
- if (sscanf(attr->attr.name, "feature-%d-%x-%s", &index, &usage,
+ if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage,
name) == 3) {
feature = true;
field_index = index + sensor_inst->input_field_count;
- } else if (sscanf(attr->attr.name, "input-%d-%x-%s", &index, &usage,
+ } else if (sscanf(attr->attr.name, "input-%x-%x-%s", &index, &usage,
name) == 3) {
input = true;
field_index = index;
@@ -398,7 +398,7 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
char name[HID_CUSTOM_NAME_LENGTH];
int value;
- if (sscanf(attr->attr.name, "feature-%d-%x-%s", &index, &usage,
+ if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage,
name) == 3) {
field_index = index + sensor_inst->input_field_count;
} else
--
1.9.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] hid: sensor: fix input and feature attributes in HID sensor custom sysfs interface "Ooi, Joyce" <joyce.ooi@intel.com> - 2016-11-03 12:00 +0100
Re: [PATCH] hid: sensor: fix input and feature attributes in HID sensor custom sysfs interface Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-11-04 15:10 +0100
Re: [PATCH] hid: sensor: fix input and feature attributes in HID sensor custom sysfs interface Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2016-11-04 18:50 +0100
Re: [PATCH] hid: sensor: fix input and feature attributes in HID sensor custom sysfs interface Jiri Kosina <jikos@kernel.org> - 2016-11-05 17:00 +0100
csiph-web