himax_mmi: Add support to set csv file name

Change-Id: Ic6a4c7dd31282fea921be142010c764c456883e1
Signed-off-by: haojl2 <haojl2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1223385
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
haojl2 2018-08-09 14:43:42 +08:00 • committed by Jialei Hao
commit c53c7f9fba
3 changed files with 53 additions and 4 deletions

View file

@ -150,6 +150,7 @@ int himax_report_data_init(void);
extern bool hx83112_chip_detect (void);
extern int himax_dev_set(struct himax_ts_data *ts);
extern int himax_input_register_device(struct input_dev *input_dev);
extern char *hx_self_test_file_name;
int g_ts_dbg = 0;
@ -199,6 +200,45 @@ static int himax_palm_detect(uint8_t *buf)
}
#endif
static ssize_t himax_self_test_write(struct file *file, const char *buff,
size_t len, loff_t *pos)
{
int i = 0;
char buf[80] = {0};
if (len >= 80) {
I("%s: no command exceeds 80 chars.\n", __func__);
return -EFAULT;
}
if (copy_from_user(buf, buff, len)) {
return -EFAULT;
}
if (hx_self_test_file_name == NULL) {
E("file name is NULL\n");
hx_self_test_file_name = kzalloc(80, GFP_KERNEL);
snprintf(hx_self_test_file_name, 15, "hx_criteria.csv");
}
for (i = 0; i < 80; i++) {
if (buf[i] == ',' || buf[i] == '\n') {
memset(hx_self_test_file_name, 0x0, 80);
memcpy(hx_self_test_file_name, buf, i);
I("%s: Get name from Customer\n", __func__);
break;
}
}
if (i == 80) {
memset(hx_self_test_file_name, 0x0, 80);
snprintf(hx_self_test_file_name, 16, "hx_criteria.csv");
I("%s: Use default name\n", __func__);
}
I("file name = %s\n", hx_self_test_file_name);
return len;
}
static ssize_t himax_self_test_read(struct file *file, char *buf,
size_t len, loff_t *pos)
{
@ -240,6 +280,7 @@ static ssize_t himax_self_test_read(struct file *file, char *buf,
static struct file_operations himax_proc_self_test_ops = {
.owner = THIS_MODULE,
.read = himax_self_test_read,
.write = himax_self_test_write,
};
static void *himax_self_raw_seq_start(struct seq_file *s, loff_t *pos)

View file

@ -50,7 +50,7 @@
#include <linux/of_gpio.h>
#endif
#define HIMAX_DRIVER_VER "1.2.2.50_moto_02"
#define HIMAX_DRIVER_VER "1.2.2.50_moto_05"
#define FLASH_DUMP_FILE "/sdcard/HX_Flash_Dump.bin"

View file

@ -1,5 +1,7 @@
#include "himax_inspection.h"
char *hx_self_test_file_name = NULL;
extern struct himax_core_fp g_core_fp;
extern struct himax_ts_data *private_ts;
extern struct himax_ic_data *ic_data;
@ -1021,7 +1023,6 @@ static int himax_parse_criteria_file(void)
{
int err = HX_INSPECT_OK;
const struct firmware *file_entry = NULL;
char *file_name = "hx_criteria.csv";
char **result;
int i = 0;
@ -1033,10 +1034,17 @@ static int himax_parse_criteria_file(void)
int file_size = 0;
I("%s,Entering \n", __func__);
I("file name = %s\n", file_name);
if (hx_self_test_file_name == NULL) {
E("file name is NULL\n");
hx_self_test_file_name = kzalloc(80, GFP_KERNEL);
snprintf(hx_self_test_file_name, 16, "hx_criteria.csv");
I("%s: Use default name\n", __func__);
}
I("file name = %s\n", hx_self_test_file_name);
/* default path is /system/etc/firmware */
err = request_firmware(&file_entry, file_name, private_ts->dev);
err = request_firmware(&file_entry, hx_self_test_file_name, private_ts->dev);
if (err < 0) {
E("%s,fail in line%d error code=%d\n", __func__, __LINE__, err);
err = HX_INSPECT_EFILE;