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