6 #include <devman_plugin_intf.h>
10 #define TEST_GET(_func, _value) {\
11 if((err = _func(&(_value))) < 0) { \
12 printf("test "#_func" err:%d\n", err);\
14 printf(#_func" get value: %d OK\n", _value); \
18 #define TEST_SET(_func, _value) {\
19 if((err = _func(_value)) < 0) { \
20 printf("test "#_func" err:%d\n", err);\
22 printf("test "#_func" OK\n");\
26 #define TEST_INDEX_GET(_func, _index, _value) {\
27 if((err = _func(_index, &(_value))) < 0) { \
28 printf("test "#_func" ,index = %d err:%d\n", _index, err);\
30 printf(#_func" ,index = %d get value: %d OK\n", _index, _value); \
34 #define TEST_INDEX_SET(_func, _index, _value) {\
35 if((err = _func(_index, _value)) < 0) { \
36 printf("test "#_func" ,index = %d err:%d\n", _index, err);\
38 printf("test "#_func" ,index = %d OK\n", _index);\
44 void test_set_enable()
48 printf("set enable value (0:disable,1:enable,-1:quit):");
49 if((err = scanf("%d", &value)) <= 0) {
56 TEST_SET(OEM_sys_set_haptic_motor_enable, value);
59 void test_get_max_level()
63 TEST_GET(OEM_sys_get_haptic_motor_level_max, max_level);
71 printf("set level (-1:quit):");
72 if((err = scanf("%d", &level)) <= 0) {
78 TEST_SET(OEM_sys_set_haptic_motor_level, level);
79 printf("set level: %d\n", level);
92 TEST_GET(OEM_sys_get_haptic_motor_level, value);
99 printf("set oneshot times :");
100 if((err = scanf("%d", &value)) <= 0) {
101 printf("scanf failed %d\n", err);
105 TEST_SET(OEM_sys_set_haptic_motor_oneshot, value);
113 r = svi_init(&handle);
114 if (r != SVI_SUCCESS){
115 printf("Cannot initialize svi.\n");
118 r = svi_play (handle, SVI_VIB_TOUCH_TOUCH, SVI_SND_TOUCH_TOUCH1);
119 if (r != SVI_SUCCESS) {
120 printf("Cannot play sound or vibration.\n");
125 r = svi_play_sound (handle, SVI_SND_TOUCH_TOUCH1);
126 if (r != SVI_SUCCESS) {
127 printf("Cannot play sound.\n");
133 r = svi_play_vib (handle, SVI_VIB_OPERATION_VIBRATION);
134 if (r != SVI_SUCCESS) {
135 printf("Cannot play vibration.\n");
138 // don't close handle too fast, vibrator needs time to boost
141 r = svi_fini(handle);
142 if (r != SVI_SUCCESS) {
143 printf("Cannot close svi.\n");
153 printf("=======================1. vib_test==========================\n");
154 printf("1 : test OEM_sys_get_haptic_motor_level_max\n");
155 printf("2 : test OEM_sys_get_haptic_motor_level\n");
156 printf("3 : test OEM_sys_set_haptic_motor_level\n");
157 printf("4 : test OEM_sys_set_haptic_motor_enable\n");
158 printf("5 : test OEM_sys_set_haptic_motor_oneshot\n");
159 printf("q : quit\n");
160 printf("============================================================\n");
163 while((tmp = getchar()) != '\n');
167 test_get_max_level();
193 TEST_GET(OEM_sys_get_battery_capacity, value);
194 TEST_GET(OEM_sys_get_battery_capacity_raw, value);
195 TEST_GET(OEM_sys_get_battery_charge_full, value);
196 TEST_GET(OEM_sys_get_battery_charge_now, value);
197 TEST_GET(OEM_sys_get_battery_present, value);
198 TEST_GET(OEM_sys_get_battery_health, value);
199 TEST_GET(OEM_sys_get_battery_polling_required, value);
200 TEST_GET(OEM_sys_get_battery_support_insuspend_charging, value);
207 TEST_GET(OEM_sys_get_power_wakeup_count, value);
208 TEST_SET(OEM_sys_set_power_wakeup_count, value);
209 TEST_SET(OEM_sys_set_power_state, POWER_STATE_SUSPEND);
210 TEST_SET(OEM_sys_set_power_state, POWER_STATE_PRE_SUSPEND);
211 TEST_SET(OEM_sys_set_power_state, POWER_STATE_POST_RESUME);
218 TEST_GET(OEM_sys_get_cpufreq_cpuinfo_max_freq, value);
219 TEST_GET(OEM_sys_get_cpufreq_cpuinfo_min_freq, value);
220 TEST_GET(OEM_sys_get_cpufreq_scaling_max_freq, value);
221 TEST_SET(OEM_sys_set_cpufreq_scaling_max_freq, value);
222 TEST_GET(OEM_sys_get_cpufreq_scaling_min_freq, value);
223 TEST_SET(OEM_sys_set_cpufreq_scaling_min_freq, value);
230 TEST_GET(OEM_sys_get_jack_charger_online, value);
231 TEST_GET(OEM_sys_get_jack_earjack_online, value);
232 TEST_GET(OEM_sys_get_jack_earkey_online, value);
233 TEST_GET(OEM_sys_get_jack_hdmi_online, value);
234 TEST_GET(OEM_sys_get_jack_usb_online, value);
235 TEST_GET(OEM_sys_get_jack_cradle_online, value);
236 TEST_GET(OEM_sys_get_jack_tvout_online, value);
237 TEST_GET(OEM_sys_get_jack_keyboard_online, value);
240 void backlight_test()
242 int value, power_saving, index, i;
244 OEM_sys_get_display_count(&index);
246 for(i = 0; i < index; i++) {
247 printf("================= test index = %d ==================\n", i);
248 TEST_INDEX_GET(OEM_sys_get_backlight_min_brightness, i, value);
249 TEST_INDEX_GET(OEM_sys_get_backlight_max_brightness, i, value);
251 if((err = OEM_sys_get_backlight_brightness(i, &value, 0)) < 0) {
252 printf("test OEM_sys_get_backlight_brightness power_saving = 0 err:%d\n", err);
254 printf("OEM_sys_get_backlight_brightness power_saving = 0 get value: %d OK\n", value);
257 if((err = OEM_sys_get_backlight_brightness(i, &value, 1)) < 0) {
258 printf("test OEM_sys_get_backlight_brightness power_saving = 1 err:%d\n", err);
260 printf("OEM_sys_get_backlight_brightness power_saving = 1 get value: %d OK\n", value);
263 if((err = OEM_sys_set_backlight_brightness(i, &value, 0)) < 0) {
264 printf("test OEM_sys_set_backlight_brightness power_saving = 0 err:%d\n", err);
266 printf("OEM_sys_set_backlight_brightness power_saving = 0 get value: %d OK\n", value);
269 if((err = OEM_sys_set_backlight_brightness(i, &value, 1)) < 0) {
270 printf("test OEM_sys_set_backlight_brightness power_saving = 1 err:%d\n", err);
272 printf("OEM_sys_set_backlight_brightness power_saving = 1 get value: %d OK\n", value);
275 OEM_sys_get_backlight_brightness(i, &value, 1);
277 TEST_INDEX_SET(OEM_sys_set_backlight_dimming, i, 1);
278 TEST_INDEX_GET(OEM_sys_get_backlight_acl_control, i, value);
279 TEST_INDEX_SET(OEM_sys_set_backlight_acl_control, i, value)
287 OEM_sys_get_devman_plugin_interface();
290 printf("===================slp_device_manager_plugin test====================\n");
291 printf("1 : vib_test\n");
292 printf("2 : svi_test\n");
293 printf("3 : battery_test\n");
294 printf("4 : power_test\n");
295 printf("5 : cpufreq_test\n");
296 printf("6 : jack_test\n");
297 printf("7 : backlight\n");
298 printf("q : quit\n");
299 printf("=====================================================================\n");
302 while((tmp = getchar()) != '\n');