Add device property vendor/product id for USB 08/133508/2 accepted/tizen/unified/20170630.082938 submit/tizen/20170614.022225
authorJeongho Mok <jho.mok@samsung.com>
Mon, 12 Jun 2017 08:31:37 +0000 (17:31 +0900)
committerJeongho Mok <jho.mok@samsung.com>
Tue, 13 Jun 2017 02:21:22 +0000 (11:21 +0900)
[Version] 0.11.6
[Profile] Common
[Issue Type] Enhancement

Change-Id: Ifdfc3f47efd82c6097fa9ef5a4b539ca626bced3

include/mm_sound.h
include/mm_sound_client.h
include/mm_sound_device.h
mm_sound_client.c
mm_sound_device.c
mm_sound_proxy.c
packaging/libmm-sound.spec
testsuite/mm_sound_testsuite_simple.c

index adb0986..8caa3e0 100644 (file)
@@ -1031,6 +1031,8 @@ int mm_sound_get_device_io_direction(MMSoundDevice_t device_h, mm_sound_device_i
 int mm_sound_get_device_id(MMSoundDevice_t device_h, int *id);
 int mm_sound_get_device_state(MMSoundDevice_t device_h, mm_sound_device_state_e *state);
 int mm_sound_get_device_name(MMSoundDevice_t device_h, char **name);
+int mm_sound_get_device_vendor_id(MMSoundDevice_t device_h, int *vendor_id);
+int mm_sound_get_device_product_id(MMSoundDevice_t device_h, int *product_id);
 
 /**
  * Active device changed callback function type.
index 57da8b5..242b926 100644 (file)
@@ -82,11 +82,11 @@ int mm_sound_client_test(int a, int b, int* get);
 
 typedef void (*mm_sound_volume_changed_wrapper_cb)(const char *direction, const char *volume_type_str, int volume_level, void *userdata);
 typedef void (*mm_sound_device_connected_wrapper_cb)(int device_id, const char *device_type, int io_direction, int state,
-               const char *name, int *stream_id, int stream_num, gboolean is_connected, void *userdata);
+               const char *name, int *vendor_id, int *product_id, int *stream_id, int stream_num, gboolean is_connected, void *userdata);
 typedef void (*mm_sound_device_info_changed_wrapper_cb)(int device_id, const char *device_type, int io_direction, int state,
-               const char *name, int *stream_id, int stream_num, int changed_device_info_type, void *userdata);
+               const char *name, int *vendor_id, int *product_id, int *stream_id, int stream_num, int changed_device_info_type, void *userdata);
 typedef void (*mm_sound_device_state_changed_wrapper_cb)(int device_id, const char *device_type, int io_direction, int state,
-               const char *name, int *stream_id, int stream_num, void *userdata);
+               const char *name, int *vendor_id, int *product_id, int *stream_id, int stream_num, void *userdata);
 typedef void (*mm_sound_stop_callback_wrapper_func)(int id, void *userdata);
 
 #endif /* __MM_SOUND_CLIENT_H__ */
index a910d1b..fb52de5 100644 (file)
@@ -51,6 +51,10 @@ typedef struct {
        int stream_id[MAX_STREAM_ON_DEVICE];
        /* When this value is less than 0, should query to server-side */
        int stream_num;
+
+       /* For USB device from udev, if not -1 */
+       int vendor_id;
+       int product_id;
 } mm_sound_device_t;
 
 typedef struct {
index 1f1acbf..3df3767 100644 (file)
@@ -675,7 +675,8 @@ static bool device_is_match_with_mask(const char *type, int direction, int state
 }
 
 static int _fill_sound_device(mm_sound_device_t *device_h, int device_id, const char *device_type,
-               int direction, int state, const char *name, int *stream_id, int stream_num)
+               int direction, int state, const char *name, int vendor_id, int product_id,
+               int *stream_id, int stream_num)
 {
        int i;
 
@@ -694,6 +695,8 @@ static int _fill_sound_device(mm_sound_device_t *device_h, int device_id, const
        device_h->state = state;
        MMSOUND_STRNCPY(device_h->name, name, MAX_DEVICE_NAME_NUM);
        MMSOUND_STRNCPY(device_h->type, device_type, MAX_DEVICE_TYPE_STR_LEN);
+       device_h->vendor_id = vendor_id;
+       device_h->product_id = product_id;
 
        if (stream_num > 0) {
                device_h->stream_num = stream_num;
@@ -711,16 +714,16 @@ static int _fill_sound_device(mm_sound_device_t *device_h, int device_id, const
 }
 
 static void _mm_sound_device_connected_callback_wrapper_func(int device_id, const char *device_type, int io_direction,
-                                                                                                                       int state, const char *name, int *stream_id, int stream_num,
-                                                                                                                       gboolean is_connected, void *userdata)
+                                                       int state, const char *name, int vendor_id, int product_id, int *stream_id, int stream_num,
+                                                       gboolean is_connected, void *userdata)
 {
        mm_sound_device_t device_h;
        struct callback_data *cb_data = (struct callback_data*) userdata;
        int device_flags;
 
-       debug_log("[Device %s] id(%d) type(%s) direction(%d) state(%d) name(%s)",
+       debug_log("[Device %s] id(%d) type(%s) direction(%d) state(%d) name(%s) vendor-id(%04x) product-id(%04x)",
                          is_connected ? "Connected" : "Disconnected", device_id, device_type, io_direction,
-                         state, name, is_connected);
+                         state, name, vendor_id, product_id, is_connected);
 
        if (cb_data == NULL) {
                debug_warning("device connected changed callback data null");
@@ -731,7 +734,8 @@ static void _mm_sound_device_connected_callback_wrapper_func(int device_id, cons
        if (!device_is_match_with_mask(device_type, io_direction, state, device_flags))
                return;
 
-       if (_fill_sound_device(&device_h, device_id, device_type, io_direction, state, name, stream_id, stream_num) < 0) {
+       if (_fill_sound_device(&device_h, device_id, device_type, io_direction, state, name,
+                               vendor_id, product_id, stream_id, stream_num) < 0) {
                debug_error("Failed to fill sound device");
                return;
        }
@@ -771,15 +775,16 @@ int mm_sound_client_remove_device_connected_callback(unsigned int subs_id)
 }
 
 static void _mm_sound_device_info_changed_callback_wrapper_func(int device_id, const char *device_type, int io_direction,
-                                                                                                                               int state, const char *name, int *stream_id, int stream_num,
-                                                                                                                               int changed_device_info_type, void *userdata)
+                                                       int state, const char *name, int vendor_id, int product_id, int *stream_id, int stream_num,
+                                                       int changed_device_info_type, void *userdata)
 {
        mm_sound_device_t device_h;
        struct callback_data *cb_data = (struct callback_data*) userdata;
        int device_flags;
 
-       debug_log("[Device Info Changed] id(%d) type(%s) direction(%d) state(%d) name(%s) changed_info_type(%d)",
-                         device_id, device_type, io_direction, state, name, changed_device_info_type);
+       debug_log("[Device Info Changed] id(%d) type(%s) direction(%d) state(%d) name(%s) "
+                       "vendor-id(%04x) product-id(%04x) changed_info_type(%d)",
+                       device_id, device_type, io_direction, state, name, vendor_id, product_id, changed_device_info_type);
 
        if (cb_data == NULL) {
                debug_warning("device info changed callback data null");
@@ -790,7 +795,8 @@ static void _mm_sound_device_info_changed_callback_wrapper_func(int device_id, c
        if (!device_is_match_with_mask(device_type, io_direction, state, device_flags))
                return;
 
-       if (_fill_sound_device(&device_h, device_id, device_type, io_direction, state, name, stream_id, stream_num) < 0) {
+       if (_fill_sound_device(&device_h, device_id, device_type, io_direction, state, name,
+                               vendor_id, product_id, stream_id, stream_num) < 0) {
                debug_error("Failed to fill sound device");
                return;
        }
@@ -829,15 +835,16 @@ int mm_sound_client_remove_device_info_changed_callback(unsigned int subs_id)
 }
 
 static void _mm_sound_device_state_changed_callback_wrapper_func(int device_id, const char *device_type,
-                                                                                                                               int io_direction, int state, const char *name,
-                                                                                                                               int *stream_id, int stream_num, void *userdata)
+                                                               int io_direction, int state, const char *name, int vendor_id, int product_id,
+                                                               int *stream_id, int stream_num, void *userdata)
 {
        mm_sound_device_t device_h;
        struct callback_data *cb_data = (struct callback_data*) userdata;
        int device_flags;
 
-       debug_log("[Device State Changed] id(%d) type(%s) direction(%d) state(%d) name(%s)",
-                         device_id, device_type, io_direction, state, name);
+       debug_log("[Device State Changed] id(%d) type(%s) direction(%d) state(%d) name(%s)"
+                       "vendor-id(%04x), product-id(%04x)",
+                       device_id, device_type, io_direction, state, name, vendor_id, product_id);
 
        if (cb_data == NULL) {
                debug_warning("device state changed callback data null");
@@ -849,7 +856,8 @@ static void _mm_sound_device_state_changed_callback_wrapper_func(int device_id,
        if (!device_is_match_with_mask(device_type, io_direction, state, device_flags))
                return;
 
-       if (_fill_sound_device(&device_h, device_id, device_type, io_direction, state, name, stream_id, stream_num) < 0) {
+       if (_fill_sound_device(&device_h, device_id, device_type, io_direction, state, name,
+                               vendor_id, product_id, stream_id, stream_num) < 0) {
                debug_error("Failed to fill sound device");
                return;
        }
index fc72e58..fd1eb33 100644 (file)
@@ -437,6 +437,34 @@ int mm_sound_get_device_name(MMSoundDevice_t device_h, char **name)
 }
 
 EXPORT_API
+int mm_sound_get_device_vendor_id(MMSoundDevice_t device_h, int *vendor_id)
+{
+       mm_sound_device_t *device = (mm_sound_device_t*)device_h;
+       if(!device) {
+               debug_error("invalid handle\n");
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+       *vendor_id = device->vendor_id;
+       debug_log("device_handle:0x%x, vendor id:%04x\n", device, *vendor_id);
+
+       return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int mm_sound_get_device_product_id(MMSoundDevice_t device_h, int *product_id)
+{
+       mm_sound_device_t *device = (mm_sound_device_t*)device_h;
+       if(!device) {
+               debug_error("invalid handle\n");
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+       *product_id = device->product_id;
+       debug_log("device_handle:0x%x, product id:%04x\n", device, *product_id);
+
+       return MM_ERROR_NONE;
+}
+
+EXPORT_API
 int mm_sound_is_stream_on_device(int stream_id, MMSoundDevice_t device_h, bool *is_on)
 {
        int ret = MM_ERROR_NONE;
index f560397..9eb678b 100644 (file)
@@ -80,7 +80,7 @@ static int _notify_signal_handled(audio_event_t event, uint32_t event_id, uint32
 }
 
 static int parse_device_variant(GVariant *v, int *device_id, const char **device_type, int *direction, int *state,
-                                                               const char **device_name, int *stream_id, int *stream_num)
+                                               const char **device_name, int *vendor_id, int *product_id, int *stream_id, int *stream_num)
 {
        const char *v_type;
        GVariant *array_v;
@@ -94,7 +94,7 @@ static int parse_device_variant(GVariant *v, int *device_id, const char **device
        }
 
        v_type = g_variant_get_type_string(v);
-       if (g_variant_type_equal(v_type, "(isiisai)") == FALSE) {
+       if (g_variant_type_equal(v_type, "(isiisiiai)") == FALSE) {
                debug_error("device variant type not matching '%s'", v_type);
                return MM_ERROR_NONE;
        }
@@ -105,6 +105,8 @@ static int parse_device_variant(GVariant *v, int *device_id, const char **device
        g_variant_iter_next(&iter, "i", direction);
        g_variant_iter_next(&iter, "i", state);
        g_variant_iter_next(&iter, "&s", device_name);
+       g_variant_iter_next(&iter, "i", vendor_id);
+       g_variant_iter_next(&iter, "i", product_id);
 
        array_v = g_variant_iter_next_value(&iter);
        *stream_num = g_variant_iter_init(&array_iter, array_v);
@@ -134,6 +136,7 @@ static void dbus_callback(audio_event_t event, GVariant *params, void *userdata)
        GVariant *device_v;
        int stream_id[MAX_STREAM_ON_DEVICE];
        int stream_num;
+       int vendor_id, product_id;
 
        v_type = g_variant_get_type_string(params);
 
@@ -146,7 +149,7 @@ static void dbus_callback(audio_event_t event, GVariant *params, void *userdata)
        } else if (event == AUDIO_EVENT_DEVICE_CONNECTED) {
                gboolean is_connected = FALSE;
 
-               if (g_variant_type_equal(v_type, "(u(isiisai)b)") == FALSE) {
+               if (g_variant_type_equal(v_type, "(u(isiisiiai)b)") == FALSE) {
                        debug_error("Device connection changed signature not matching : %s", v_type);
                        return ;
                }
@@ -154,19 +157,19 @@ static void dbus_callback(audio_event_t event, GVariant *params, void *userdata)
                g_variant_iter_next(&iter, "u", &event_id);
                device_v = g_variant_iter_next_value(&iter);
                if (parse_device_variant(device_v, &device_id, &device_type, &direction, &state,
-                                                       &name, stream_id, &stream_num) < 0) {
+                                                       &name, &vendor_id, &product_id, stream_id, &stream_num) < 0) {
                        debug_error("Failed to parse device variant");
                        return ;
                }
                g_variant_iter_next(&iter, "b", &is_connected);
 
                ((mm_sound_device_connected_wrapper_cb)(cb_data->user_cb))(device_id, device_type, direction,
-                       state, name, stream_id, stream_num, is_connected, cb_data->user_data);
+                       state, name, vendor_id, product_id, stream_id, stream_num, is_connected, cb_data->user_data);
                _notify_signal_handled(event, event_id, cb_data->subs_id, g_variant_new("(ib)", device_id, is_connected));
        } else if (event == AUDIO_EVENT_DEVICE_INFO_CHANGED) {
                int changed_device_info_type = 0;
 
-               if (g_variant_type_equal(v_type, "(u(isiisai)i)") == FALSE) {
+               if (g_variant_type_equal(v_type, "(u(isiisiiai)i)") == FALSE) {
                        debug_error("Device information changed signature not matching : %s", v_type);
                        return ;
                }
@@ -175,17 +178,17 @@ static void dbus_callback(audio_event_t event, GVariant *params, void *userdata)
                g_variant_iter_next(&iter, "u", &event_id);
                device_v = g_variant_iter_next_value(&iter);
                if (parse_device_variant(device_v, &device_id, &device_type, &direction, &state,
-                                                       &name, stream_id, &stream_num) < 0) {
+                                                       &name, &vendor_id, &product_id, stream_id, &stream_num) < 0) {
                        debug_error("Failed to parse device variant");
                        return ;
                }
                g_variant_iter_next(&iter, "i", &changed_device_info_type);
 
                ((mm_sound_device_info_changed_wrapper_cb)(cb_data->user_cb))(device_id, device_type, direction,
-                       state, name, stream_id, stream_num, changed_device_info_type, cb_data->user_data);
+                       state, name, vendor_id, product_id, stream_id, stream_num, changed_device_info_type, cb_data->user_data);
        } else if (event == AUDIO_EVENT_DEVICE_STATE_CHANGED) {
 
-               if (g_variant_type_equal(v_type, "(u(isiisai))") == FALSE) {
+               if (g_variant_type_equal(v_type, "(u(isiisiiai))") == FALSE) {
                        debug_error("Device state changed signature not matching : %s", v_type);
                        return ;
                }
@@ -194,13 +197,13 @@ static void dbus_callback(audio_event_t event, GVariant *params, void *userdata)
                g_variant_iter_next(&iter, "u", &event_id);
                device_v = g_variant_iter_next_value(&iter);
                if (parse_device_variant(device_v, &device_id, &device_type, &direction, &state,
-                                                       &name, stream_id, &stream_num) < 0) {
+                                                       &name, &vendor_id, &product_id, stream_id, &stream_num) < 0) {
                        debug_error("Failed to parse device variant");
                        return ;
                }
 
                ((mm_sound_device_state_changed_wrapper_cb)(cb_data->user_cb))(device_id, device_type, direction,
-                       state, name, stream_id, stream_num, cb_data->user_data);
+                       state, name, vendor_id, product_id, stream_id, stream_num, cb_data->user_data);
        } else if (event == AUDIO_EVENT_FOCUS_CHANGED) {
        } else if (event == AUDIO_EVENT_FOCUS_WATCH) {
        } else if (event == AUDIO_EVENT_TEST) {
@@ -365,15 +368,15 @@ int mm_sound_proxy_get_current_connected_device_list(int device_flags, GList** d
        g_variant_iter_init(&iter, child);
        while (1) {
                device_item = g_malloc0(sizeof(mm_sound_device_t));
-               if (device_item && g_variant_iter_loop(&iter, "(i&sii&s)",
+               if (device_item && g_variant_iter_loop(&iter, "(i&sii&sii)",
                                        &device_item->id, &device_type_tmp, &device_item->io_direction, &device_item->state,
-                                       &device_name_tmp)) {
+                                       &device_name_tmp, &device_item->vendor_id, &device_item->product_id)) {
                        MMSOUND_STRNCPY(device_item->name, device_name_tmp, MAX_DEVICE_NAME_NUM);
                        MMSOUND_STRNCPY(device_item->type, device_type_tmp, MAX_DEVICE_TYPE_STR_LEN);
                        *device_list = g_list_append(*device_list, device_item);
-                       debug_log("Added device id(%d) type(%17s) direction(%d) state(%d) name(%s)",
+                       debug_log("Added device id(%d) type(%17s) direction(%d) state(%d) name(%s) vendor-id(%04x), product-id(%04x)",
                                        device_item->id, device_item->type,device_item->io_direction, device_item->state,
-                                       device_item->name);
+                                       device_item->name, device_item->vendor_id, device_item->product_id);
                        device_item->stream_num = -1;
                } else {
                        if (device_item)
@@ -422,14 +425,16 @@ int mm_sound_proxy_get_device_by_id(int device_id, mm_sound_device_t **device)
                        goto cleanup;
                }
 
-               g_variant_get(result, "(i&sii&s)",
+               g_variant_get(result, "(i&sii&sii)",
                                &device_item->id, &device_type_tmp, &device_item->io_direction,
-                               &device_item->state, &device_name_tmp);
+                               &device_item->state, &device_name_tmp,
+                               &device_item->vendor_id, &device_item->product_id);
                MMSOUND_STRNCPY(device_item->name, device_name_tmp, MAX_DEVICE_NAME_NUM);
                MMSOUND_STRNCPY(device_item->type, device_type_tmp, MAX_DEVICE_TYPE_STR_LEN);
-               debug_log("Get device id(%d) type(%17s) direction(%d) state(%d) name(%s)",
+               debug_log("Get device id(%d) type(%17s) direction(%d) state(%d) name(%s) vendor-id(%04x) product-id(%04x)",
                                device_item->id, device_item->type, device_item->io_direction,
-                               device_item->state, device_item->name);
+                               device_item->state, device_item->name,
+                               device_item->vendor_id, device_item->product_id);
                device_item->stream_num = -1;
                *device = device_item;
        } else {
index 8b3cc42..c229e31 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.11.5
+Version:    0.11.6
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 1ad8977..2fddd97 100755 (executable)
@@ -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) {