xref: /aosp_15_r20/external/rmi4utils/f54test/testutil.cpp (revision a248dafd7653b99fc45f9d29e5f139b04f2f28bc)
1 /*
2  * Copyright (C) 2014 Satoshi Noguchi
3  * Copyright (C) 2014 Synaptics Inc
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #include <sys/types.h>
19 
20 #include "testutil.h"
21 
22 const char *test_error_str[] = {
23 	"success",							// TEST_SUCCESS
24 	"failed",							// TEST_FAIL
25 	"timeout",							// TEST_FAIL_TIMEOUT
26 	"failed to find F01 on device",					// TEST_FAIL_NO_FUNCTION_01
27 	"failed to find F54 on device",					// TEST_FAIL_NO_FUNCTION_54
28 	"failed to find F55 on device",					// TEST_FAIL_NO_FUNCTION_55
29 	"failed to query the basic properties in F01",			// TEST_FAIL_QUERY_BASIC_PROPERTIES
30 	"failed to read F54 query registers",				// TEST_FAIL_READ_F54_QUERIES
31 	"failed to read F54 control registers",				// TEST_FAIL_READ_F54_CONTROLS
32 	"failed to scan the PDT",					// TEST_FAIL_SCAN_PDT
33 	"failed to read the device status",				// TEST_FAIL_READ_DEVICE_STATUS
34 	"failed to read F01 control 0 register",			// TEST_FAIL_READ_F01_CONTROL_0
35 	"failed to write F01 control 0 register",			// TEST_FAIL_WRITE_F01_CONTROL_0
36 	"timeout waiting for attn",					// TEST_FAIL_TIMEOUT_WAITING_FOR_ATTN
37 	"invalid parameter",						// TEST_FAIL_INVALID_PARAMETER
38 	"memory allocation failure",					// TEST_FAIL_MEMORY_ALLOCATION
39 };
40 
test_err_to_string(int err)41 const char * test_err_to_string(int err)
42 {
43 	return test_error_str[err];
44 }