Input: ili210x - Set the device name according to the device model
Subsystems (2)
PATCH v2 1/1 Input: ili210x - Set the device name according to the device model
Adding the device model into the device name is useful when applications need to set different parameters according to the touchscreen being used, e.g. X11 calibration points.
---
Changes since v1: Get the device ID from touchscreen controller instead of driver's device list.
drivers/input/touchscreen/ili210x.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/input/touchscreen/ili210x.c +10 -1
@@ -19,10 +19,14 @@#define ILI251X_DATA_SIZE1 31#define ILI251X_DATA_SIZE2 20 +#define ILI_NAME_LEN 27 +#define ILITEK_TS_NAME "Ilitek ILI%x%x Touchscreen" +/* Touchscreen commands */ #define REG_TOUCHDATA 0x10#define REG_PANEL_INFO 0x20#define REG_CALIBRATE 0xcc +#define REG_TS_MODEL 0x61struct ili2xxx_chip { int (*read_reg)(struct i2c_client *client, u8 reg,
@@ -384,6 +388,8 @@ static int ili210x_i2c_probe(struct i2c_client *client,struct input_dev *input;int error;unsigned int max_xy; +unsigned char buf[2 ]; +char *model_name;dev_dbg (dev,"Probing for ILI210X I2C Touschreen driver" );
@@ -430,7 +436,10 @@ static int ili210x_i2c_probe(struct i2c_client *client,i2c_set_clientdata (client, priv);/* Setup input device */ - input->name ="ILI210x Touchscreen" ; + input->name =ILITEK_TS_NAME ; + model_name = (char *)input->name; + priv->chip->read_reg (priv->client,REG_TS_MODEL , buf,2 ); +snprintf (model_name,ILI_NAME_LEN , input->name, buf[1 ], buf[0 ]); input->id.bustype =BUS_I2C ;/* Multi touch */
Signature · 1 line
2.17.1
Quoted 19 lines · Rogerio Pimentel
Adding the device model into the device name is useful when applications need to set different parameters according to the touchscreen being used, e.g. X11 calibration points.
Signed-off-by Rogerio Pimentel <[email protected]>---
Changes since v1: Get the device ID from touchscreen controller instead of driver's device list.
drivers/input/touchscreen/ili210x.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/input/touchscreen/ili210x.c +0
-0@@ -19,10 +19,14 @@#define ILI251X_DATA_SIZE1 31
drivers/input/touchscreen/ili210x.c line 29
Quoted 10 lines
drivers/input/touchscreen/ili210x.c +4
-0#define ILI251X_DATA_SIZE2 20 +#define ILI_NAME_LEN 27 +#define ILITEK_TS_NAME "Ilitek ILI%x%x Touchscreen" +/* Touchscreen commands */ #define REG_TOUCHDATA 0x10#define REG_PANEL_INFO 0x20#define REG_CALIBRATE 0xcc +#define REG_TS_MODEL 0x61
Have a look at the following patch for the extra register names:
[PATCH v3 2/3] Input: ili210x - export ili251x version details via sysfs
Quoted 12 lines
drivers/input/touchscreen/ili210x.c +2
-0struct ili2xxx_chip { int (*read_reg)(struct i2c_client *client, u8 reg,@@ -384,6 +388,8 @@ static int ili210x_i2c_probe(struct i2c_client *client,struct input_dev *input;int error;unsigned int max_xy; +unsigned char buf[2 ]; +char *model_name;dev_dbg (dev,"Probing for ILI210X I2C Touschreen driver" );
drivers/input/touchscreen/ili210x.c static int ili210x_i2c_probe(struct i2c_client *client, · line 441
Quoted 7 lines
drivers/input/touchscreen/ili210x.c +3
-1@@ -430,7 +436,10 @@ static int ili210x_i2c_probe(struct i2c_client *client,i2c_set_clientdata (client, priv);/* Setup input device */ - input->name ="ILI210x Touchscreen" ; + input->name =ILITEK_TS_NAME ; + model_name = (char *)input->name; + priv->chip->read_reg (priv->client,REG_TS_MODEL , buf,2 );
Please check return value of ^ that function.
drivers/input/touchscreen/ili210x.c static int ili210x_i2c_probe(struct i2c_client *client, · line 443
Quoted 2 lines
drivers/input/touchscreen/ili210x.c +1
-0+snprintf (model_name,ILI_NAME_LEN , input->name, buf[1 ], buf[0 ]); input->id.bustype =BUS_I2C ;
This was still tested only on ili2511, right ?
Quoted 23 lines · Marek Vasut
Quoted 21 lines · Rogerio Pimentel
Adding the device model into the device name is useful when applications need to set different parameters according to the touchscreen being used, e.g. X11 calibration points.
Signed-off-by Rogerio Pimentel <[email protected]>---
Changes since v1: Get the device ID from touchscreen controller instead of driver's device list.
drivers/input/touchscreen/ili210x.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/input/touchscreen/ili210x.c +0
-0@@ -19,10 +19,14 @@#define ILI251X_DATA_SIZE1 31#define ILI251X_DATA_SIZE2 20
Quoted 11 lines
drivers/input/touchscreen/ili210x.c line 29
Quoted 8 lines
drivers/input/touchscreen/ili210x.c +4
-0+#define ILI_NAME_LEN 27 +#define ILITEK_TS_NAME "Ilitek ILI%x%x Touchscreen" +/* Touchscreen commands */ #define REG_TOUCHDATA 0x10#define REG_PANEL_INFO 0x20#define REG_CALIBRATE 0xcc +#define REG_TS_MODEL 0x61Have a look at the following patch for the extra register names:
[PATCH v3 2/3] Input: ili210x - export ili251x version details via sysfs
Ok, I will.
Quoted 15 lines
Quoted 15 lines
drivers/input/touchscreen/ili210x.c +2
-0struct ili2xxx_chip { int (*read_reg)(struct i2c_client *client, u8 reg,@@ -384,6 +388,8 @@ static int ili210x_i2c_probe(struct i2c_client *client,struct input_dev *input;int error;unsigned int max_xy; +unsigned char buf[2 ]; +char *model_name;dev_dbg (dev,"Probing for ILI210X I2C Touschreen driver" );@@ -430,7 +436,10 @@ static int ili210x_i2c_probe(struct i2c_client *client,i2c_set_clientdata (client, priv);
Quoted 7 lines
drivers/input/touchscreen/ili210x.c static int ili210x_i2c_probe(struct i2c_client *client, · line 441
Quoted 5 lines
drivers/input/touchscreen/ili210x.c +3
-1/* Setup input device */ - input->name ="ILI210x Touchscreen" ; + input->name =ILITEK_TS_NAME ; + model_name = (char *)input->name; + priv->chip->read_reg (priv->client,REG_TS_MODEL , buf,2 );Please check return value of ^ that function.
Ok, I will make the changes.
Quoted 5 lines
drivers/input/touchscreen/ili210x.c static int ili210x_i2c_probe(struct i2c_client *client, · line 443
Quoted 3 lines
drivers/input/touchscreen/ili210x.c +1
-0+snprintf (model_name,ILI_NAME_LEN , input->name, buf[1 ], buf[0 ]); input->id.bustype =BUS_I2C ;This was still tested only on ili2511, right ?
Yes, by now I have only tested ili2511.
Dmitry Torokhov
maintainerHi Rogerio,
Quoted 3 lines · Rogerio Pimentel
Adding the device model into the device name is useful when applications need to set different parameters according to the touchscreen being used, e.g. X11 calibration points.
Typically model would go into input->id.product and optionally input->id.version.
Quoted 39 lines
Signed-off-by Rogerio Pimentel <[email protected]>---
Changes since v1: Get the device ID from touchscreen controller instead of driver's device list.
drivers/input/touchscreen/ili210x.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/input/touchscreen/ili210x.c +6
-0@@ -19,10 +19,14 @@#define ILI251X_DATA_SIZE1 31#define ILI251X_DATA_SIZE2 20 +#define ILI_NAME_LEN 27 +#define ILITEK_TS_NAME "Ilitek ILI%x%x Touchscreen" +/* Touchscreen commands */ #define REG_TOUCHDATA 0x10#define REG_PANEL_INFO 0x20#define REG_CALIBRATE 0xcc +#define REG_TS_MODEL 0x61struct ili2xxx_chip { int (*read_reg)(struct i2c_client *client, u8 reg,@@ -384,6 +388,8 @@ static int ili210x_i2c_probe(struct i2c_client *client,struct input_dev *input;int error;unsigned int max_xy; +unsigned char buf[2 ]; +char *model_name;dev_dbg (dev,"Probing for ILI210X I2C Touschreen driver" );
drivers/input/touchscreen/ili210x.c static int ili210x_i2c_probe(struct i2c_client *client, · line 440
Quoted 6 lines
drivers/input/touchscreen/ili210x.c +2
-1@@ -430,7 +436,10 @@ static int ili210x_i2c_probe(struct i2c_client *client,i2c_set_clientdata (client, priv);/* Setup input device */ - input->name ="ILI210x Touchscreen" ; + input->name =ILITEK_TS_NAME ; + model_name = (char *)input->name;
Umm, no. Smashing RO data is not nice.
Quoted 8 lines
drivers/input/touchscreen/ili210x.c +2
-0+ priv->chip->read_reg (priv->client,REG_TS_MODEL , buf,2 ); +snprintf (model_name,ILI_NAME_LEN , input->name, buf[1 ], buf[0 ]); input->id.bustype =BUS_I2C ;/* Multi touch */ Signature · 1 line
2.17.1
Thanks.
Signature · 1 line
Dmitry
Quoted 63 lines · Dmitry Torokhov
Hi Rogerio,
Quoted 3 lines · Rogerio Pimentel
Adding the device model into the device name is useful when applications need to set different parameters according to the touchscreen being used, e.g. X11 calibration points.
Typically model would go into
input->id.productand optionallyinput->id.version.Quoted 39 lines
Signed-off-by Rogerio Pimentel <[email protected]>---
Changes since v1: Get the device ID from touchscreen controller instead of driver's device list.
drivers/input/touchscreen/ili210x.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/input/touchscreen/ili210x.c +6
-0@@ -19,10 +19,14 @@#define ILI251X_DATA_SIZE1 31#define ILI251X_DATA_SIZE2 20 +#define ILI_NAME_LEN 27 +#define ILITEK_TS_NAME "Ilitek ILI%x%x Touchscreen" +/* Touchscreen commands */ #define REG_TOUCHDATA 0x10#define REG_PANEL_INFO 0x20#define REG_CALIBRATE 0xcc +#define REG_TS_MODEL 0x61struct ili2xxx_chip { int (*read_reg)(struct i2c_client *client, u8 reg,@@ -384,6 +388,8 @@ static int ili210x_i2c_probe(struct i2c_client *client,struct input_dev *input;int error;unsigned int max_xy; +unsigned char buf[2 ]; +char *model_name;dev_dbg (dev,"Probing for ILI210X I2C Touschreen driver" );drivers/input/touchscreen/ili210x.c static int ili210x_i2c_probe(struct i2c_client *client, · line 440
Quoted 6 lines
drivers/input/touchscreen/ili210x.c +2
-1@@ -430,7 +436,10 @@ static int ili210x_i2c_probe(struct i2c_client *client,i2c_set_clientdata (client, priv);/* Setup input device */ - input->name ="ILI210x Touchscreen" ; + input->name =ILITEK_TS_NAME ; + model_name = (char *)input->name;Umm, no. Smashing RO data is not nice.
Quoted 4 lines
drivers/input/touchscreen/ili210x.c +2
-0+ priv->chip->read_reg (priv->client,REG_TS_MODEL , buf,2 ); +snprintf (model_name,ILI_NAME_LEN , input->name, buf[1 ], buf[0 ]); input->id.bustype =BUS_I2C ;
Quoted 7 lines
Quoted 4 lines
drivers/input/touchscreen/ili210x.c +0
-1/* Multi touch */ --2.17.1
Thanks.
I agree with the comments.
Please, discard this patch.
Rogerio
Quoted 2 lines
--
Dmitry