Commit ad117c55 authored by Lucas Stach's avatar Lucas Stach Committed by Dmitry Torokhov

Input: exc3000 - add type sysfs attribute

Add a sysfs attribute to query the type of the touchscreen device.
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Link: https://lore.kernel.org/r/20210125182527.1225245-5-l.stach@pengutronix.deSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent c929ac9e
......@@ -15,3 +15,12 @@ Description: Reports the model identification provided by the touchscreen, fo
Access: Read
Valid values: Represented as string
What: /sys/bus/i2c/devices/xxx/type
Date: Jan 2021
Contact: linux-input@vger.kernel.org
Description: Reports the type identification provided by the touchscreen, for example "PCAP82H80 Series"
Access: Read
Valid values: Represented as string
......@@ -301,9 +301,26 @@ static ssize_t model_show(struct device *dev,
}
static DEVICE_ATTR_RO(model);
static ssize_t type_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct exc3000_data *data = i2c_get_clientdata(client);
u8 response[EXC3000_LEN_FRAME];
int ret;
ret = exc3000_vendor_data_request(data, (u8[]){'F'}, 1, response, 1);
if (ret < 0)
return ret;
return sprintf(buf, "%s\n", &response[1]);
}
static DEVICE_ATTR_RO(type);
static struct attribute *sysfs_attrs[] = {
&dev_attr_fw_version.attr,
&dev_attr_model.attr,
&dev_attr_type.attr,
NULL
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment