aboutsummaryrefslogtreecommitdiff
path: root/f54test
diff options
context:
space:
mode:
Diffstat (limited to 'f54test')
-rw-r--r--f54test/Android.bp1
-rw-r--r--f54test/f54test.cpp517
-rw-r--r--f54test/f54test.h346
-rw-r--r--f54test/main.cpp63
-rw-r--r--f54test/testutil.cpp28
-rw-r--r--f54test/testutil.h1
6 files changed, 879 insertions, 77 deletions
diff --git a/f54test/Android.bp b/f54test/Android.bp
index 71851d2..177fc15 100644
--- a/f54test/Android.bp
+++ b/f54test/Android.bp
@@ -19,6 +19,7 @@ cc_binary {
"-Wall",
"-Werror",
"-Wno-sometimes-uninitialized",
+ "-Wno-unused-private-field",
"-Wno-unused-parameter",
],
static_libs: ["rmidevice"],
diff --git a/f54test/f54test.cpp b/f54test/f54test.cpp
index 7c43574..4b4f6b1 100644
--- a/f54test/f54test.cpp
+++ b/f54test/f54test.cpp
@@ -34,6 +34,8 @@
#define RMI_F01_STATUS_CODE(status) ((status) & 0x0f)
/* Indicates that flash programming is enabled (bootloader mode). */
#define RMI_F01_STATUS_BOOTLOADER(status) (!!((status) & 0x40))
+#define NO_SLEEP_OFF (0 << 2)
+#define NO_SLEEP_ON (1 << 2)
/*
* Sleep mode controls power management on the device and affects all
@@ -91,6 +93,10 @@ int F54Test::Prepare(f54_report_types reportType)
if (retval != TEST_SUCCESS)
return retval;
+ retval = DoPreparation();
+ if (retval != TEST_SUCCESS)
+ return retval;
+
data = (unsigned char)m_reportType;
retval = m_device.Write(m_f54.GetDataBase(), &data, 1);
if (retval < 0)
@@ -145,6 +151,7 @@ int F54Test::SetF54ReportType(f54_report_types report_type)
case F54_TRX_SHORTS:
case F54_ABS_RAW_CAP:
case F54_ABS_DELTA_CAP:
+ case F54_GUARD_PIN_SHORT:
m_reportType = report_type;
return SetF54ReportSize(report_type);
default:
@@ -159,6 +166,7 @@ int F54Test::SetF54ReportSize(f54_report_types report_type)
int retval;
unsigned char tx = m_txAssigned;
unsigned char rx = m_rxAssigned;
+ char buf[256];
switch (report_type) {
case F54_8BIT_IMAGE:
@@ -223,7 +231,14 @@ int F54Test::SetF54ReportSize(f54_report_types report_type)
case F54_ABS_DELTA_CAP:
m_reportSize = 4 * (tx + rx);
break;
+ case F54_GUARD_PIN_SHORT:
+ sprintf(buf, "F54_GUARD_PIN_SHORT\n");
+ m_display.Output(buf);
+ m_reportSize = GUARD_PIN_SHORT_DATA_SIZE;
+ break;
default:
+ sprintf(buf, "invalid report type\n");
+ m_display.Output(buf);
m_reportSize = 0;
return TEST_FAIL_INVALID_PARAMETER;
}
@@ -534,6 +549,213 @@ int F54Test::ReadF54Queries()
offset += 1;
}
+ /* query 39 */
+ if (m_f54Query_38.has_query39) {
+ retval = m_device.Read(query_addr + offset,
+ m_f54Query_39.data,
+ sizeof(m_f54Query_39.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 40 */
+ if (m_f54Query_39.has_query40) {
+ retval = m_device.Read(query_addr + offset,
+ m_f54Query_40.data,
+ sizeof(m_f54Query_40.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 41 */
+ if (m_f54Query_40.has_ctrl163_query41)
+ offset += 1;
+
+ /* query 42 */
+ if (m_f54Query_40.has_ctrl165_query42)
+ offset += 1;
+
+ /* query 43 */
+ if (m_f54Query_40.has_query43) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_43.data,
+ sizeof(m_f54Query_43.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ if (m_f54Query_43.has_ctrl172_query44_query45)
+ offset += 2;
+
+ /* query 46 */
+ if (m_f54Query_43.has_query46) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_46.data,
+ sizeof(m_f54Query_46.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 47 */
+ if (m_f54Query_46.has_query47) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_47.data,
+ sizeof(m_f54Query_47.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 48 reserved */
+
+ /* query 49 */
+ if (m_f54Query_47.has_query49) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_49.data,
+ sizeof(m_f54Query_49.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 50 */
+ if (m_f54Query_49.has_query50) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_50.data,
+ sizeof(m_f54Query_50.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 51 */
+ if (m_f54Query_50.has_query51) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_51.data,
+ sizeof(m_f54Query_51.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 53 54 */
+ if (m_f54Query_51.has_query53_query54_ctrl198)
+ offset += 2;
+
+ /* query 55 */
+ if (m_f54Query_51.has_query55) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_55.data,
+ sizeof(m_f54Query_55.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 56 */
+ if (m_f54Query_55.has_query56)
+ offset += 1;
+
+ /* query 57 */
+ if (m_f54Query_55.has_query57) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_57.data,
+ sizeof(m_f54Query_57.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 58 */
+ if (m_f54Query_57.has_query58) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_58.data,
+ sizeof(m_f54Query_58.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 59 */
+ if (m_f54Query_58.has_query59)
+ offset += 1;
+
+ /* query 60 */
+ if (m_f54Query_58.has_query60)
+ offset += 1;
+
+ /* query 61 */
+ if (m_f54Query_58.has_query61) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_61.data,
+ sizeof(m_f54Query_61.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 62 63 */
+ if (m_f54Query_61.has_ctrl215_query62_query63)
+ offset += 2;
+
+ /* query 64 */
+ if (m_f54Query_61.has_query64) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_64.data,
+ sizeof(m_f54Query_64.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 65 */
+ if (m_f54Query_64.has_query65) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_65.data,
+ sizeof(m_f54Query_65.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 66 */
+ if (m_f54Query_65.has_query66_ctrl231)
+ offset += 1;
+
+ /* query 67 */
+ if (m_f54Query_65.has_query67) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_67.data,
+ sizeof(m_f54Query_67.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 68 */
+ if (m_f54Query_67.has_query68) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_68.data,
+ sizeof(m_f54Query_68.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
+ /* query 69 */
+ if (m_f54Query_68.has_query69) {
+ m_device.Read(query_addr + offset,
+ m_f54Query_69.data,
+ sizeof(m_f54Query_69.data));
+ if (retval < 0)
+ return retval;
+ offset += 1;
+ }
+
return TEST_SUCCESS;;
}
@@ -1213,6 +1435,129 @@ int F54Test::SetupF54Controls()
m_f54Control.reg_149.address = reg_addr;
reg_addr += CONTROL_149_SIZE;
}
+ /* control 150 */
+ if (m_f54Query_38.has_ctrl150)
+ reg_addr += CONTROL_150_SIZE;
+
+ /* control 151 */
+ if (m_f54Query_38.has_ctrl151)
+ reg_addr += CONTROL_151_SIZE;
+
+ /* control 152 */
+ if (m_f54Query_38.has_ctrl152)
+ reg_addr += CONTROL_152_SIZE;
+
+ /* control 153 */
+ if (m_f54Query_38.has_ctrl153)
+ reg_addr += CONTROL_153_SIZE;
+
+ /* control 154 */
+ if (m_f54Query_39.has_ctrl154)
+ reg_addr += CONTROL_154_SIZE;
+
+ /* control 155 */
+ if (m_f54Query_39.has_ctrl155)
+ reg_addr += CONTROL_155_SIZE;
+
+ /* control 156 */
+ if (m_f54Query_39.has_ctrl156)
+ reg_addr += CONTROL_156_SIZE;
+
+ /* controls 157 158 */
+ if (m_f54Query_39.has_ctrl157_ctrl158)
+ reg_addr += CONTROL_157_158_SIZE;
+
+ /* controls 159 to 162 reserved */
+
+ /* control 163 */
+ if (m_f54Query_40.has_ctrl163_query41)
+ reg_addr += CONTROL_163_SIZE;
+
+ /* control 164 reserved */
+
+ /* control 165 */
+ if (m_f54Query_40.has_ctrl165_query42)
+ reg_addr += CONTROL_165_SIZE;
+
+ /* control 166 */
+ if (m_f54Query_40.has_ctrl166)
+ reg_addr += CONTROL_166_SIZE;
+
+ /* control 167 */
+ if (m_f54Query_40.has_ctrl167)
+ reg_addr += CONTROL_167_SIZE;
+
+ /* control 168 */
+ if (m_f54Query_40.has_ctrl168)
+ reg_addr += CONTROL_168_SIZE;
+
+ /* control 169 */
+ if (m_f54Query_40.has_ctrl169)
+ reg_addr += CONTROL_169_SIZE;
+
+ /* control 170 reserved */
+
+ /* control 171 */
+ if (m_f54Query_43.has_ctrl171)
+ reg_addr += CONTROL_171_SIZE;
+
+ /* control 172 */
+ if (m_f54Query_43.has_ctrl172_query44_query45)
+ reg_addr += CONTROL_172_SIZE;
+
+ /* control 173 */
+ if (m_f54Query_43.has_ctrl173)
+ reg_addr += CONTROL_173_SIZE;
+
+ /* control 174 */
+ if (m_f54Query_43.has_ctrl174)
+ reg_addr += CONTROL_174_SIZE;
+
+ /* control 175 */
+ if (m_f54Query_43.has_ctrl175)
+ reg_addr += CONTROL_175_SIZE;
+
+ /* control 176 */
+ if (m_f54Query_46.has_ctrl176)
+ reg_addr += CONTROL_176_SIZE;
+
+ /* controls 177 178 */
+ if (m_f54Query_46.has_ctrl177_ctrl178)
+ reg_addr += CONTROL_177_178_SIZE;
+
+ /* control 179 */
+ if (m_f54Query_46.has_ctrl179)
+ reg_addr += CONTROL_179_SIZE;
+
+ /* controls 180 to 181 reserved */
+
+ /* control 182 */
+ if (m_f54Query_47.has_ctrl182)
+ reg_addr += CONTROL_182_SIZE;
+
+ /* control 183 */
+ if (m_f54Query_47.has_ctrl183)
+ reg_addr += CONTROL_183_SIZE;
+
+ /* control 184 reserved */
+
+ /* control 185 */
+ if (m_f54Query_47.has_ctrl185)
+ reg_addr += CONTROL_185_SIZE;
+
+ /* control 186 */
+ if (m_f54Query_47.has_ctrl186)
+ reg_addr += CONTROL_186_SIZE;
+
+ /* control 187 */
+ if (m_f54Query_47.has_ctrl187)
+ reg_addr += CONTROL_187_SIZE;
+
+ /* control 188 */
+ if (m_f54Query_49.has_ctrl188) {
+ m_f54Control.reg_188.address = reg_addr;
+ reg_addr += CONTROL_188_SIZE;
+ }
return TEST_SUCCESS;
}
@@ -1400,17 +1745,127 @@ exit:
return retval;
}
+#define disable_cbc(ctrl_num)\
+do {\
+ retval = m_device.Read(\
+ m_f54Control.ctrl_num.address,\
+ m_f54Control.ctrl_num.data,\
+ sizeof(m_f54Control.ctrl_num.data));\
+ if (retval < 0) {\
+ return retval;\
+ } \
+ m_f54Control.ctrl_num.cbc_tx_carrier_selection = 0;\
+ retval = m_device.Write(\
+ m_f54Control.ctrl_num.address,\
+ m_f54Control.ctrl_num.data,\
+ sizeof(m_f54Control.ctrl_num.data));\
+ if (retval < 0) {\
+ return retval;\
+ } \
+} while (0)
+
+int F54Test::DoPreparation()
+{
+ int retval;
+ unsigned char value;
+ unsigned char zero = 0x00;
+ unsigned char device_ctrl;
+
+ retval = m_device.Read(m_f54.GetControlBase(),
+ &device_ctrl,
+ sizeof(device_ctrl));
+ if (retval < 0) {
+ return retval;
+ }
+
+ device_ctrl |= NO_SLEEP_ON;
+
+ retval = m_device.Write(m_f54.GetControlBase(),
+ &device_ctrl,
+ sizeof(device_ctrl));
+ if (retval < 0) {
+ return retval;
+ }
+
+ switch (m_reportType) {
+ case F54_16BIT_IMAGE:
+ case F54_RAW_16BIT_IMAGE:
+ case F54_SENSOR_SPEED:
+ case F54_ADC_RANGE:
+ case F54_ABS_RAW_CAP:
+ case F54_ABS_DELTA_CAP:
+ break;
+ default:
+ if (m_f54Query.touch_controller_family == 1)
+ disable_cbc(reg_7);
+ else if (m_f54Query.has_ctrl88)
+ disable_cbc(reg_88);
+
+ if (m_f54Query.has_0d_acquisition_control)
+ disable_cbc(reg_57);
+
+ if ((m_f54Query.has_query15) &&
+ (m_f54Query_15.has_query25) &&
+ (m_f54Query_25.has_query27) &&
+ (m_f54Query_27.has_query29) &&
+ (m_f54Query_29.has_query30) &&
+ (m_f54Query_30.has_query32) &&
+ (m_f54Query_32.has_query33) &&
+ (m_f54Query_33.has_query36) &&
+ (m_f54Query_36.has_query38) &&
+ (m_f54Query_38.has_ctrl149)) {
+ retval = m_device.Write(m_f54Control.reg_149.address,
+ &zero,
+ sizeof(m_f54Control.reg_149.data));
+ if (retval < 0) {
+ return retval;
+ }
+ }
+
+ if (m_f54Query.has_signal_clarity) {
+ retval = m_device.Read(m_f54Control.reg_41.address,
+ &value,
+ sizeof(m_f54Control.reg_41.data));
+ if (retval < 0) {
+ return retval;
+ }
+ value |= 0x01;
+ retval = m_device.Write(m_f54Control.reg_41.address,
+ &value,
+ sizeof(m_f54Control.reg_41.data));
+ if (retval < 0) {
+ return retval;
+ }
+ }
+
+ retval = DoF54Command(COMMAND_FORCE_UPDATE);
+ if (retval < 0) {
+ return retval;
+ }
+
+ retval = DoF54Command(COMMAND_FORCE_CAL);
+ if (retval < 0) {
+ return retval;
+ }
+ }
+ return TEST_SUCCESS;
+}
+
int F54Test::ShowF54Report()
{
unsigned int ii;
unsigned int jj;
+ unsigned int kk;
unsigned int tx_num = m_txAssigned;
unsigned int rx_num = m_rxAssigned;
char *report_data_8;
short *report_data_16;
int *report_data_32;
unsigned int *report_data_u32;
+ unsigned char *report_data_u8;
char buf[256];
+ bool rt26_result = true;
+ unsigned char rt26_ng_num;
switch (m_reportType) {
case F54_8BIT_IMAGE:
@@ -1550,6 +2005,68 @@ int F54Test::ShowF54Report()
m_display.Output(buf);
break;
+ case F54_GUARD_PIN_SHORT:
+ report_data_u8 = (unsigned char *)m_reportData;
+ sprintf(buf, "Guard Pin Short Test:\n");
+ m_display.Output(buf);
+ for (ii = 0; ii < GUARD_PIN_SHORT_DATA_SIZE; ii++) {
+ sprintf(buf, "%03d: 0x%02x\n", ii, *(report_data_u8 + ii));
+ m_display.Output(buf);
+ }
+ sprintf(buf, "\n");
+ m_display.Output(buf);
+
+ if (report_data_u8[GUARD_PIN_SHORT_DATA_SIZE - 1] & 0xC0)
+ sprintf(buf, "Failed: pin %d\n",
+ (report_data_u8[GUARD_PIN_SHORT_DATA_SIZE - 1] & 0xC0) >> 7);
+ else
+ sprintf(buf, "Pass\n");
+ m_display.Output(buf);
+
+ break;
+ case F54_TRX_SHORTS:
+ report_data_u8 = (unsigned char *)m_reportData;
+ sprintf(buf, "Trx Short Test:\n");
+ m_display.Output(buf);
+
+ for (ii = 0; ii < m_reportSize; ii++) {
+ sprintf(buf, "%03d: 0x%02x\n", ii, *(report_data_u8 + ii));
+ m_display.Output(buf);
+ }
+ sprintf(buf, "\n");
+ m_display.Output(buf);
+
+ for (ii = 0; ii < m_reportSize; ii++) {
+ if (report_data_u8[ii] != 0) {
+ for (jj = 0; jj < sizeof(char); jj++) {
+ if (report_data_u8[ii] & (1 << jj)) {
+ rt26_ng_num = ii * 8 + jj;
+ for (kk = 0; kk < m_txAssigned; kk++) {
+ if (rt26_ng_num == m_txAssignment[kk]) {
+ rt26_result = false;
+ sprintf(buf, "Failed on %d\n", rt26_ng_num);
+ m_display.Output(buf);
+ }
+ }
+ for (kk = 0; kk < m_rxAssigned; kk++) {
+ if (rt26_ng_num == m_rxAssignment[kk]) {
+ rt26_result = false;
+ sprintf(buf, "Failed on %d\n", rt26_ng_num);
+ m_display.Output(buf);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (rt26_result) {
+ sprintf(buf, "Pass\n");
+ m_display.Output(buf);
+ }
+
+ break;
+
default:
for (ii = 0; ii < m_reportSize; ii++) {
sprintf(buf, "%03d: 0x%02x\n",
diff --git a/f54test/f54test.h b/f54test/f54test.h
index 6842cba..bc0b496 100644
--- a/f54test/f54test.h
+++ b/f54test/f54test.h
@@ -143,10 +143,39 @@
#define CONTROL_147_SIZE 1
#define CONTROL_148_SIZE 1
#define CONTROL_149_SIZE 1
+#define CONTROL_150_SIZE 1
+#define CONTROL_151_SIZE 1
+#define CONTROL_152_SIZE 1
+#define CONTROL_153_SIZE 1
+#define CONTROL_154_SIZE 1
+#define CONTROL_155_SIZE 1
+#define CONTROL_156_SIZE 1
+#define CONTROL_157_158_SIZE 2
+#define CONTROL_163_SIZE 1
+#define CONTROL_165_SIZE 1
+#define CONTROL_166_SIZE 1
+#define CONTROL_167_SIZE 1
+#define CONTROL_168_SIZE 1
+#define CONTROL_169_SIZE 1
+#define CONTROL_171_SIZE 1
+#define CONTROL_172_SIZE 1
+#define CONTROL_173_SIZE 1
+#define CONTROL_174_SIZE 1
+#define CONTROL_175_SIZE 1
+#define CONTROL_176_SIZE 1
+#define CONTROL_177_178_SIZE 2
+#define CONTROL_179_SIZE 1
+#define CONTROL_182_SIZE 1
+#define CONTROL_183_SIZE 1
+#define CONTROL_185_SIZE 1
+#define CONTROL_186_SIZE 1
+#define CONTROL_187_SIZE 1
+#define CONTROL_188_SIZE 1
#define HIGH_RESISTANCE_DATA_SIZE 6
#define FULL_RAW_CAP_MIN_MAX_DATA_SIZE 4
-#define TRX_OPEN_SHORT_DATA_SIZE 7
+#define TRX_OPEN_SHORT_DATA_SIZE 15
+#define GUARD_PIN_SHORT_DATA_SIZE 15
enum f54_report_types {
F54_8BIT_IMAGE = 1,
@@ -171,6 +200,7 @@ enum f54_report_types {
F54_TRX_SHORTS = 26,
F54_ABS_RAW_CAP = 38,
F54_ABS_DELTA_CAP = 40,
+ F54_GUARD_PIN_SHORT = 50,
INVALID_REPORT_TYPE = -1,
};
@@ -493,16 +523,281 @@ struct f54_query_38 {
unsigned char has_ctrl147:1;
unsigned char has_ctrl148:1;
unsigned char has_ctrl149:1;
- unsigned char f54_query38_b3:1;
- unsigned char f54_query38_b4:1;
- unsigned char f54_query38_b5:1;
- unsigned char f54_query38_b6:1;
- unsigned char f54_query38_b7:1;
+ unsigned char has_ctrl150:1;
+ unsigned char has_ctrl151:1;
+ unsigned char has_ctrl152:1;
+ unsigned char has_ctrl153:1;
+ unsigned char has_query39:1;
} __attribute__((packed));
unsigned char data[1];
};
};
+struct f54_query_39 {
+ union {
+ struct {
+ unsigned char has_ctrl154:1;
+ unsigned char has_ctrl155:1;
+ unsigned char has_ctrl156:1;
+ unsigned char has_ctrl160:1;
+ unsigned char has_ctrl157_ctrl158:1;
+ unsigned char f54_query39_b5__6:2;
+ unsigned char has_query40:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_40 {
+ union {
+ struct {
+ unsigned char has_ctrl169:1;
+ unsigned char has_ctrl163_query41:1;
+ unsigned char f54_query40_b2:1;
+ unsigned char has_ctrl165_query42:1;
+ unsigned char has_ctrl166:1;
+ unsigned char has_ctrl167:1;
+ unsigned char has_ctrl168:1;
+ unsigned char has_query43:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_43 {
+ union {
+ struct {
+ unsigned char f54_query43_b0__1:2;
+ unsigned char has_ctrl171:1;
+ unsigned char has_ctrl172_query44_query45:1;
+ unsigned char has_ctrl173:1;
+ unsigned char has_ctrl174:1;
+ unsigned char has_ctrl175:1;
+ unsigned char has_query46:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_46 {
+ union {
+ struct {
+ unsigned char has_ctrl176:1;
+ unsigned char has_ctrl177_ctrl178:1;
+ unsigned char has_ctrl179:1;
+ unsigned char f54_query46_b3:1;
+ unsigned char has_data27:1;
+ unsigned char has_data28:1;
+ unsigned char f54_query46_b6:1;
+ unsigned char has_query47:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_47 {
+ union {
+ struct {
+ unsigned char f54_query47_b0:1;
+ unsigned char has_ctrl182:1;
+ unsigned char has_ctrl183:1;
+ unsigned char f54_query47_b3:1;
+ unsigned char has_ctrl185:1;
+ unsigned char has_ctrl186:1;
+ unsigned char has_ctrl187:1;
+ unsigned char has_query49:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_49 {
+ union {
+ struct {
+ unsigned char f54_query49_b0__1:2;
+ unsigned char has_ctrl188:1;
+ unsigned char has_data31:1;
+ unsigned char f54_query49_b4__6:3;
+ unsigned char has_query50:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_50 {
+ union {
+ struct {
+ unsigned char f54_query50_b0__6:7;
+ unsigned char has_query51:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_51 {
+ union {
+ struct {
+ unsigned char f54_query51_b0__4:5;
+ unsigned char has_query53_query54_ctrl198:1;
+ unsigned char has_ctrl199:1;
+ unsigned char has_query55:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_55 {
+ union {
+ struct {
+ unsigned char has_query56:1;
+ unsigned char has_data33_data34:1;
+ unsigned char has_alt_report_rate:1;
+ unsigned char has_ctrl200:1;
+ unsigned char has_ctrl201_ctrl202:1;
+ unsigned char has_ctrl203:1;
+ unsigned char has_ctrl204:1;
+ unsigned char has_query57:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_57 {
+ union {
+ struct {
+ unsigned char has_ctrl205:1;
+ unsigned char has_ctrl206:1;
+ unsigned char has_usb_bulk_read:1;
+ unsigned char has_ctrl207:1;
+ unsigned char has_ctrl208:1;
+ unsigned char has_ctrl209:1;
+ unsigned char has_ctrl210:1;
+ unsigned char has_query58:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_58 {
+ union {
+ struct {
+ unsigned char has_query59:1;
+ unsigned char has_query60:1;
+ unsigned char has_ctrl211:1;
+ unsigned char has_ctrl212:1;
+ unsigned char has_hybrid_abs_tx_axis_filtering:1;
+ unsigned char has_hybrid_abs_tx_interpolation:1;
+ unsigned char has_ctrl213:1;
+ unsigned char has_query61:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_61 {
+ union {
+ struct {
+ unsigned char has_ctrl214:1;
+ unsigned char has_ctrl215_query62_query63:1;
+ unsigned char f54_query_61_b2:1;
+ unsigned char has_ctrl216:1;
+ unsigned char has_ctrl217:1;
+ unsigned char has_misc_host_ctrl:1;
+ unsigned char hybrid_abs_buttons:1;
+ unsigned char has_query64:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_64 {
+ union {
+ struct {
+ unsigned char has_ctrl101_sub1:1;
+ unsigned char has_ctrl220:1;
+ unsigned char has_ctrl221:1;
+ unsigned char has_ctrl222:1;
+ unsigned char has_ctrl219_sub1:1;
+ unsigned char has_ctrl103_sub3:1;
+ unsigned char has_ctrl224_ctrl226_ctrl227:1;
+ unsigned char has_query65:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_65 {
+ union {
+ struct {
+ unsigned char f54_query_65_b0__1:2;
+ unsigned char has_ctrl101_sub2:1;
+ unsigned char f54_query_65_b3__4:2;
+ unsigned char has_query66_ctrl231:1;
+ unsigned char has_ctrl232:1;
+ unsigned char has_query67:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_67 {
+ union {
+ struct {
+ unsigned char has_abs_doze_spatial_filter_en:1;
+ unsigned char has_abs_doze_avg_filter_enhancement_en:1;
+ unsigned char has_single_display_pulse:1;
+ unsigned char f54_query_67_b3__4:2;
+ unsigned char has_ctrl235_ctrl236:1;
+ unsigned char f54_query_67_b6:1;
+ unsigned char has_query68:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_68 {
+ union {
+ struct {
+ unsigned char f54_query_68_b0:1;
+ unsigned char has_ctrl238:1;
+ unsigned char has_ctrl238_sub1:1;
+ unsigned char has_ctrl238_sub2:1;
+ unsigned char has_ctrl239:1;
+ unsigned char has_freq_filter_bw_ext:1;
+ unsigned char is_tddi_hic:1;
+ unsigned char has_query69:1;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_query_69 {
+ union {
+ struct {
+ unsigned char has_ctrl240_sub0:1;
+ unsigned char has_ctrl240_sub1_sub2:1;
+ unsigned char has_ctrl240_sub3:1;
+ unsigned char has_ctrl240_sub4:1;
+ unsigned char f54_query_69_b4__7:4;
+ } __attribute__((packed));
+ unsigned char data[1];
+ };
+};
+
+struct f54_data_31 {
+ union {
+ struct {
+ unsigned char is_calibration_crc:1;
+ unsigned char calibration_crc:1;
+ unsigned char short_test_row_number:5;
+ } __attribute__((packed));
+ struct {
+ unsigned char data[1];
+ unsigned short address;
+ } __attribute__((packed));
+ };
+};
+
struct f54_control_7 {
union {
struct {
@@ -602,6 +897,23 @@ struct f54_control_149 {
};
};
+struct f54_control_188 {
+ union {
+ struct {
+ unsigned char start_calibration:1;
+ unsigned char start_is_calibration:1;
+ unsigned char frequency:2;
+ unsigned char start_production_test:1;
+ unsigned char short_test_calibration:1;
+ unsigned char f54_ctrl188_b7:1;
+ } __attribute__((packed));
+ struct {
+ unsigned char data[1];
+ unsigned short address;
+ } __attribute__((packed));
+ };
+};
+
struct f54_control {
struct f54_control_7 reg_7;
struct f54_control_41 reg_41;
@@ -609,8 +921,10 @@ struct f54_control {
struct f54_control_88 reg_88;
struct f54_control_110 reg_110;
struct f54_control_149 reg_149;
+ struct f54_control_188 reg_188;
};
+
struct f55_query {
union {
struct {
@@ -663,6 +977,7 @@ private:
int WaitForF54CommandCompletion();
int ReadF54Report();
int ShowF54Report();
+ int DoPreparation();
private:
RMIDevice & m_device;
@@ -687,9 +1002,26 @@ private:
f54_query_35 m_f54Query_35;
f54_query_36 m_f54Query_36;
f54_query_38 m_f54Query_38;
+ f54_query_39 m_f54Query_39;
+ f54_query_40 m_f54Query_40;
+ f54_query_43 m_f54Query_43;
+ f54_query_46 m_f54Query_46;
+ f54_query_47 m_f54Query_47;
+ f54_query_49 m_f54Query_49;
+ f54_query_50 m_f54Query_50;
+ f54_query_51 m_f54Query_51;
+ f54_query_55 m_f54Query_55;
+ f54_query_57 m_f54Query_57;
+ f54_query_58 m_f54Query_58;
+ f54_query_61 m_f54Query_61;
+ f54_query_64 m_f54Query_64;
+ f54_query_65 m_f54Query_65;
+ f54_query_67 m_f54Query_67;
+ f54_query_68 m_f54Query_68;
+ f54_query_69 m_f54Query_69;
f54_control m_f54Control;
-
+ f54_data_31 m_f54Data_31;
f55_query m_f55Query;
f54_report_types m_reportType;
diff --git a/f54test/main.cpp b/f54test/main.cpp
index d0cf8f7..9b6486a 100644
--- a/f54test/main.cpp
+++ b/f54test/main.cpp
@@ -34,7 +34,7 @@
#include "f54test.h"
#include "display.h"
-#define F54TEST_GETOPTS "hd:r:cn"
+#define F54TEST_GETOPTS "hd:r:cnt:"
static bool stopRequested;
@@ -46,12 +46,12 @@ void printHelp(const char *prog_name)
fprintf(stdout, "\t-r, --report_type\tReport type.\n");
fprintf(stdout, "\t-c, --continuous\tContinuous mode.\n");
fprintf(stdout, "\t-n, --no_reset\tDo not reset after the report.\n");
+ fprintf(stdout, "\t-t, --device-type\t\t\tFilter by device type [touchpad or touchscreen].\n");
}
-int RunF54Test(const char * deviceFile, f54_report_types reportType, bool continuousMode, bool noReset)
+int RunF54Test(RMIDevice & rmidevice, f54_report_types reportType, bool continuousMode, bool noReset)
{
int rc;
- HIDDevice rmidevice;
Display * display;
if (continuousMode)
@@ -65,10 +65,6 @@ int RunF54Test(const char * deviceFile, f54_report_types reportType, bool contin
display->Clear();
- rc = rmidevice.Open(deviceFile);
- if (rc)
- return rc;
-
F54Test f54Test(rmidevice, *display);
rc = f54Test.Prepare(reportType);
@@ -85,8 +81,6 @@ int RunF54Test(const char * deviceFile, f54_report_types reportType, bool contin
if (!noReset)
rmidevice.Reset();
- rmidevice.Close();
-
delete display;
return rc;
@@ -109,13 +103,14 @@ int main(int argc, char **argv)
{"report_type", 1, NULL, 'r'},
{"continuous", 0, NULL, 'c'},
{"no_reset", 0, NULL, 'n'},
+ {"device-type", 1, NULL, 't'},
{0, 0, 0, 0},
};
- struct dirent * devDirEntry;
- DIR * devDir;
f54_report_types reportType = F54_16BIT_IMAGE;
bool continuousMode = false;
bool noReset = false;
+ HIDDevice device;
+ enum RMIDeviceType deviceType = RMI_DEVICE_TYPE_ANY;
while ((opt = getopt_long(argc, argv, F54TEST_GETOPTS, long_options, &index)) != -1) {
switch (opt) {
@@ -134,6 +129,12 @@ int main(int argc, char **argv)
case 'n':
noReset = true;
break;
+ case 't':
+ if (!strcasecmp(optarg, "touchpad"))
+ deviceType = RMI_DEVICE_TYPE_TOUCHPAD;
+ else if (!strcasecmp(optarg, "touchscreen"))
+ deviceType = RMI_DEVICE_TYPE_TOUCHSCREEN;
+ break;
default:
break;
@@ -148,38 +149,16 @@ int main(int argc, char **argv)
}
if (deviceName) {
- rc = RunF54Test(deviceName, reportType, continuousMode, noReset);
- if (rc)
- return rc;
-
- return rc;
- } else {
- char rawDevice[PATH_MAX];
- char deviceFile[PATH_MAX];
- bool found = false;
-
- devDir = opendir("/dev");
- if (!devDir)
- return -1;
-
- while ((devDirEntry = readdir(devDir)) != NULL) {
- if (strstr(devDirEntry->d_name, "hidraw")) {
- strncpy(rawDevice, devDirEntry->d_name, PATH_MAX);
- snprintf(deviceFile, PATH_MAX, "/dev/%s", devDirEntry->d_name);
- rc = RunF54Test(deviceFile, reportType, continuousMode, noReset);
- if (rc != 0) {
- continue;
- } else {
- found = true;
- break;
- }
- }
+ rc = device.Open(deviceName);
+ if (rc) {
+ fprintf(stderr, "%s: failed to initialize rmi device (%d): %s\n", argv[0], errno,
+ strerror(errno));
+ return 1;
}
- closedir(devDir);
-
- if (!found)
- return rc;
+ } else {
+ if (!device.FindDevice(deviceType))
+ return 1;
}
- return 0;
+ return RunF54Test(device, reportType, continuousMode, noReset);
}
diff --git a/f54test/testutil.cpp b/f54test/testutil.cpp
index 6de56b1..a49307c 100644
--- a/f54test/testutil.cpp
+++ b/f54test/testutil.cpp
@@ -41,30 +41,4 @@ const char *test_error_str[] = {
const char * test_err_to_string(int err)
{
return test_error_str[err];
-}
-
-unsigned long extract_long(const unsigned char *data)
-{
- return (unsigned long)data [0]
- + (unsigned long)data [1] * 0x100
- + (unsigned long)data [2] * 0x10000
- + (unsigned long)data [3] * 0x1000000;
-}
-
-unsigned short extract_short(const unsigned char *data)
-{
- return (unsigned long)data [0]
- + (unsigned long)data [1] * 0x100;
-}
-
-const char * StripPath(const char * path, ssize_t size)
-{
- int i;
- const char * str;
-
- for (i = size - 1, str = &path[size - 1]; i > 0; --i, --str)
- if (path[i - 1] == '/')
- break;
-
- return str;
-}
+} \ No newline at end of file
diff --git a/f54test/testutil.h b/f54test/testutil.h
index 3004299..d7c1433 100644
--- a/f54test/testutil.h
+++ b/f54test/testutil.h
@@ -41,6 +41,5 @@ const char * test_err_to_string(int err);
unsigned long extract_long(const unsigned char *data);
unsigned short extract_short(const unsigned char *data);
-const char * StripPath(const char * path, ssize_t size);
#endif // _TESTUTIL_H_