X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bt-oal%2Foal-hid-host.c;h=0458b41eb00a33093f83f85bd059d0220e9d2d02;hb=00cc8b49438e9807518aea60220bb5fb99485f2c;hp=2fc5ac088de47ee3e8afbdb147884b5422f0c6d5;hpb=96e67a02816e81a31f8a37e188de0f3bbb13429b;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/bt-oal/oal-hid-host.c b/bt-oal/oal-hid-host.c index 2fc5ac0..0458b41 100755 --- a/bt-oal/oal-hid-host.c +++ b/bt-oal/oal-hid-host.c @@ -40,7 +40,7 @@ } while (0) static void connection_state_callback(bt_bdaddr_t *bd_addr, bthh_connection_state_t state); -static void hid_info_callback(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info); +static void hid_info_callback(bt_bdaddr_t *bd_addr, bthh_hid_info_t *hid_info); static void get_protocol_mode_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, bthh_protocol_mode_t mode); static void idle_time_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, int idle_rate); static void get_report_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, uint8_t* rpt_data, int rpt_size); @@ -50,14 +50,14 @@ static void handshake_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status); static const bthh_interface_t * hid_api; static bthh_callbacks_t sBluetoothHidCallbacks = { - sizeof(sBluetoothHidCallbacks), - connection_state_callback, - hid_info_callback, - get_protocol_mode_callback, - idle_time_callback, - get_report_callback, - virtual_unplug_callback, - handshake_callback, + .size = sizeof(sBluetoothHidCallbacks), + .connection_state_cb = connection_state_callback, + .hid_info_cb = hid_info_callback, + .protocol_mode_cb = get_protocol_mode_callback, + .idle_time_cb = idle_time_callback, + .get_report_cb = get_report_callback, + .virtual_unplug_cb = virtual_unplug_callback, + .handshake_cb = handshake_callback, }; oal_status_t hid_enable(void) @@ -152,7 +152,7 @@ oal_status_t hid_set_report(bt_address_t *address, int ret; bdstr_t bdstr; - API_TRACE("len: %d", strlen(report)); + API_TRACE("len: %zd", strlen(report)); CHECK_OAL_HID_ENABLED(); OAL_CHECK_PARAMETER(address, return); OAL_CHECK_PARAMETER(report, return); @@ -194,6 +194,8 @@ static void connection_state_callback(bt_bdaddr_t *bd_addr, bthh_connection_stat BT_DBG("%d", state); + if (!event) + return; memcpy(event->address.addr, bd_addr->address, BT_ADDRESS_BYTES_NUM); event->status = OAL_STATUS_SUCCESS; @@ -207,6 +209,7 @@ static void connection_state_callback(bt_bdaddr_t *bd_addr, bthh_connection_stat break; case BTHH_CONN_STATE_CONNECTING: case BTHH_CONN_STATE_DISCONNECTING: + g_free(event); return; case BTHH_CONN_STATE_FAILED_MOUSE_FROM_HOST: event_type = OAL_EVENT_HID_DISCONNECTED; @@ -223,13 +226,14 @@ static void connection_state_callback(bt_bdaddr_t *bd_addr, bthh_connection_stat case BTHH_CONN_STATE_UNKNOWN: default: BT_ERR("Unhandled Connection state %d", state); + g_free(event); return; } send_event_bda_trace(event_type, event, sizeof(event_hid_conn_t), (bt_address_t*)bd_addr); } -static void hid_info_callback(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info) +static void hid_info_callback(bt_bdaddr_t *bd_addr, bthh_hid_info_t *hid_info) { BT_INFO(""); }