summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJeongho Mok <jho.mok@samsung.com>2017-06-12 17:31:37 +0900
committerJeongho Mok <jho.mok@samsung.com>2017-06-13 11:21:22 +0900
commit2ec8b68b7f4cc9cf64478879c9c1a284c86a3369 (patch)
tree0c730712cd73eaa73dd216921d8af89e9fdd9695 /testsuite
parent2483d5b5bd3121e2bacf46022b65b29023ad35e9 (diff)
downloadlibmm-sound-2ec8b68b7f4cc9cf64478879c9c1a284c86a3369.tar.gz
libmm-sound-2ec8b68b7f4cc9cf64478879c9c1a284c86a3369.tar.bz2
libmm-sound-2ec8b68b7f4cc9cf64478879c9c1a284c86a3369.zip
Add device property vendor/product id for USBsubmit/tizen/20170614.022225accepted/tizen/unified/20170630.082938
[Version] 0.11.6 [Profile] Common [Issue Type] Enhancement Change-Id: Ifdfc3f47efd82c6097fa9ef5a4b539ca626bced3
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/mm_sound_testsuite_simple.c102
1 files changed, 64 insertions, 38 deletions
diff --git a/testsuite/mm_sound_testsuite_simple.c b/testsuite/mm_sound_testsuite_simple.c
index 1ad8977..2fddd97 100755
--- a/testsuite/mm_sound_testsuite_simple.c
+++ b/testsuite/mm_sound_testsuite_simple.c
@@ -73,7 +73,7 @@ int g_focus_watch_index = -1;
#endif
GMainLoop* g_loop;
-unsigned int g_subs_id_test, g_subs_id_volume, g_subs_id_device_conn, g_subs_id_device_info;
+unsigned int g_subs_id_test, g_subs_id_volume, g_subs_id_device_conn, g_subs_id_device_state;
// Function
static void interpret (char *buf);
@@ -107,31 +107,36 @@ void device_connected_cb (MMSoundDevice_t device_h, bool is_connected, void *use
mm_sound_device_io_direction_e io_direction = 0;
mm_sound_device_state_e state = 0;
int id = 0;
+ int vendor_id = -1, product_id = -1;
char *name = NULL;
- debug_log("*** device_connected_cb is called, device_h[%p], is_connected[%d], user_date[%p]\n", device_h, is_connected, user_data);
+
+ debug_log("*** device_connected_cb is called, device_h[%p], is_connected[%d], user_data[%p]\n", device_h, is_connected, user_data);
ret = mm_sound_get_device_type(device_h, &device_type);
- if (ret) {
+ if (ret)
debug_error("failed to mm_sound_get_device_type()\n");
- }
ret = mm_sound_get_device_io_direction(device_h, &io_direction);
- if (ret) {
+ if (ret)
debug_error("failed to mm_sound_get_device_io_direction()\n");
- }
ret = mm_sound_get_device_state(device_h, &state);
- if (ret) {
+ if (ret)
debug_error("failed to mm_sound_get_device_state()\n");
- }
ret = mm_sound_get_device_id(device_h, &id);
- if (ret) {
+ if (ret)
debug_error("failed to mm_sound_get_device_id()\n");
- }
ret = mm_sound_get_device_name(device_h, &name);
- if (ret) {
+ if (ret)
debug_error("failed to mm_sound_get_device_name()\n");
- }
- debug_log("*** --- type[%d], id[%d], io_direction[%d], state[%d], name[%s]\n", device_type, id, io_direction, state, name);
+ ret = mm_sound_get_device_vendor_id(device_h, &vendor_id);
+ if (ret)
+ debug_error("failed to mm_sound_get_device_vendor_id()\n");
+ ret = mm_sound_get_device_product_id(device_h, &product_id);
+ if (ret)
+ debug_error("failed to mm_sound_get_device_produt_id()\n");
+ debug_log("*** --- type[%d], id[%d], io_direction[%d], state[%d], name[%s], "
+ "vendor-id(%04x) product-id(%04x)\n",
+ device_type, id, io_direction, state, name, vendor_id, product_id);
}
-void device_info_changed_cb (MMSoundDevice_t device_h, int changed_info_type, void *user_data)
+void device_state_changed_cb (MMSoundDevice_t device_h, mm_sound_device_state_e new_state, void *user_data)
{
int ret = 0;
mm_sound_device_type_e device_type = 0;
@@ -139,28 +144,33 @@ void device_info_changed_cb (MMSoundDevice_t device_h, int changed_info_type, vo
mm_sound_device_state_e state = 0;
int id = 0;
char *name = NULL;
- debug_log("*** device_info_changed_cb is called, device_h[%p], changed_info_type[%d], user_date[%p]\n", device_h, changed_info_type, user_data);
+ int vendor_id = -1, product_id = -1;
+
+ debug_log("*** device_state_changed_cb is called, device_h[%p], state[%d], user_data[%p]\n", device_h, new_state, user_data);
ret = mm_sound_get_device_type(device_h, &device_type);
- if (ret) {
+ if (ret)
debug_error("failed to mm_sound_get_device_type()\n");
- }
ret = mm_sound_get_device_io_direction(device_h, &io_direction);
- if (ret) {
+ if (ret)
debug_error("failed to mm_sound_get_device_io_direction()\n");
- }
ret = mm_sound_get_device_state(device_h, &state);
- if (ret) {
+ if (ret)
debug_error("failed to mm_sound_get_device_state()\n");
- }
ret = mm_sound_get_device_id(device_h, &id);
- if (ret) {
+ if (ret)
debug_error("failed to mm_sound_get_device_id()\n");
- }
ret = mm_sound_get_device_name(device_h, &name);
- if (ret) {
+ if (ret)
debug_error("failed to mm_sound_get_device_name()\n");
- }
- debug_log("*** --- type[%d], id[%d], io_direction[%d], state[%d], name[%s]\n", device_type, id, io_direction, state, name);
+ ret = mm_sound_get_device_vendor_id(device_h, &vendor_id);
+ if (ret)
+ debug_error("failed to mm_sound_get_device_vendor_id()\n");
+ ret = mm_sound_get_device_product_id(device_h, &product_id);
+ if (ret)
+ debug_error("failed to mm_sound_get_device_produt_id()\n");
+ debug_log("*** --- type[%d], id[%d], io_direction[%d], state[%d], name[%s], "
+ "vendor-id(%04x) product-id(%04x)\n",
+ device_type, id, io_direction, state, name, vendor_id, product_id);
}
#ifdef USE_FOCUS
void focus_cb0(int index, mm_sound_focus_type_e type, mm_sound_focus_state_e state, const char *reason_for_change, int option, const char *ext_info, void *user_data)
@@ -265,8 +275,8 @@ static void displaymenu()
g_print("I : Get device by id \n");
g_print("C : Add device connected callback \t");
g_print("D : Remove device connected callback \n");
- g_print("Q : Add device info. changed callback \t");
- g_print("W : Remove device info. changed callback \n");
+ g_print("Q : Add device state. changed callback \t");
+ g_print("W : Remove device state. changed callback \n");
g_print("==================================================================\n");
#ifdef USE_FOCUS
g_print(" Focus APIs\n");
@@ -1300,6 +1310,7 @@ static void interpret (char *cmd)
char *name = NULL;
MMSoundDevice_t device_h = NULL;
int dret = MM_ERROR_NONE;
+ int product_id = -1, vendor_id = -1;
ret = mm_sound_get_current_device_list(flags, &device_list);
if (ret) {
@@ -1331,7 +1342,15 @@ static void interpret (char *cmd)
if (ret) {
debug_error("failed to mm_sound_get_device_name()\n");
}
- debug_log("*** --- [NEXT DEVICE] type[%d], id[%d], io_direction[%d], state[%d], name[%s]\n", device_type, id, io_direction, state, name);
+ ret = mm_sound_get_device_vendor_id(device_h, &vendor_id);
+ if (ret)
+ debug_error("failed to mm_sound_get_device_vendor_id()\n");
+ ret = mm_sound_get_device_product_id(device_h, &product_id);
+ if (ret)
+ debug_error("failed to mm_sound_get_device_product_id()\n");
+ debug_log("*** --- [NEXT DEVICE] type[%d], id[%d], io_direction[%d], state[%d], "
+ "name[%s] vendor_id[%04x] product_id[%04x]\n",
+ device_type, id, io_direction, state, name, vendor_id, product_id);
}
} while (dret == MM_ERROR_NONE);
do {
@@ -1360,7 +1379,15 @@ static void interpret (char *cmd)
if (ret) {
debug_error("failed to mm_sound_get_device_name()\n");
}
- debug_log("*** --- [PREV DEVICE] type[%d], id[%d], io_direction[%d], state[%d], name[%s]\n", device_type, id, io_direction, state, name);
+ ret = mm_sound_get_device_vendor_id(device_h, &vendor_id);
+ if (ret)
+ debug_error("failed to mm_sound_get_device_vendor_id()\n");
+ ret = mm_sound_get_device_product_id(device_h, &product_id);
+ if (ret)
+ debug_error("failed to mm_sound_get_device_product_id()\n");
+ debug_log("*** --- [PREV DEVICE] type[%d], id[%d], io_direction[%d], state[%d], "
+ "name[%s] vendor_id[%04x] product_id[%04x]\n",
+ device_type, id, io_direction, state, name, vendor_id, product_id);
}
} while (dret == MM_ERROR_NONE);
}
@@ -1529,12 +1556,12 @@ static void interpret (char *cmd)
else if(flag_3 == '6') { device_flag_3 = MM_SOUND_DEVICE_STATE_DEACTIVATED_FLAG; }
else if(flag_3 == '7') { device_flag_3 = MM_SOUND_DEVICE_STATE_ACTIVATED_FLAG; }
else if(flag_3 == '8') { device_flag_3 = MM_SOUND_DEVICE_ALL_FLAG; }
- g_print("add_device_info_changed");
- ret = mm_sound_add_device_information_changed_callback(device_flag_1 | device_flag_2 | device_flag_3, device_info_changed_cb, NULL, &g_subs_id_device_info);
+ g_print("add_device_state_changed");
+ ret = mm_sound_add_device_state_changed_callback(device_flag_1 | device_flag_2 | device_flag_3, device_state_changed_cb, NULL, &g_subs_id_device_state);
if (ret) {
- g_print("failed to mm_sound_add_device_information_changed_callback(), ret[0x%x]\n", ret);
+ g_print("failed to mm_sound_add_device_state_changed_callback(), ret[0x%x]\n", ret);
} else {
- g_print("device_flags[0x%x], callback fun[%p], subs_id[%u]\n", device_flag_1|device_flag_2|device_flag_3, device_info_changed_cb, g_subs_id_device_info);
+ g_print("device_flags[0x%x], callback fun[%p], subs_id[%u]\n", device_flag_1|device_flag_2|device_flag_3, device_state_changed_cb, g_subs_id_device_state);
}
} else {
g_print ("### fgets return NULL\n");
@@ -1543,10 +1570,9 @@ static void interpret (char *cmd)
else if(strncmp(cmd, "W", 1) == 0) {
int ret = 0;
- ret = mm_sound_remove_device_information_changed_callback(g_subs_id_device_info);
- if (ret) {
- g_print("failed to mm_sound_remove_device_information_changed_callback(), ret[0x%x]\n", ret);
- }
+ ret = mm_sound_remove_device_state_changed_callback(g_subs_id_device_state);
+ if (ret)
+ g_print("failed to mm_sound_remove_device_state_changed_callback(), ret[0x%x]\n", ret);
}
else if (strncmp(cmd, "x", 1) == 0) {