From fecc923b73da140e37177d4f0c3b76edbcb874f6 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 22 Dec 2016 17:54:09 +0100 Subject: [PATCH 1/4] avoid warning in battery_service_server --- src/ble/gatt-service/battery_service_server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ble/gatt-service/battery_service_server.c b/src/ble/gatt-service/battery_service_server.c index d8bc6cc23..7149428c9 100644 --- a/src/ble/gatt-service/battery_service_server.c +++ b/src/ble/gatt-service/battery_service_server.c @@ -93,8 +93,8 @@ void battery_service_server_init(uint8_t value){ battery_value = value; // get service handle range - uint16_t start_handle; - uint16_t end_handle; + uint16_t start_handle = 0; + uint16_t end_handle = 0xfff; int service_found = gatt_server_get_get_handle_range_for_service_with_uuid16(ORG_BLUETOOTH_SERVICE_BATTERY_SERVICE, &start_handle, &end_handle); if (!service_found) return; From 9ec2630ce4bfd36adcb438d2e8ba6fc26890f857 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 22 Dec 2016 22:16:16 +0100 Subject: [PATCH 2/4] fix unused parameters warning --- 3rd-party/mbedtls/library/ecp.c | 3 +++ example/ancs_client_demo.c | 10 +++++++++ example/gap_dedicated_bonding.c | 5 +++++ example/gap_inquiry.c | 5 +++++ example/gap_le_advertisements.c | 3 +++ example/gatt_battery_query.c | 7 +++++++ example/gatt_browser.c | 7 +++++++ example/hfp_ag_demo.c | 9 ++++++++ example/hfp_hf_demo.c | 7 ++++++- example/hsp_ag_demo.c | 5 +++++ example/hsp_hs_demo.c | 6 ++++++ example/le_counter.c | 9 ++++++++ example/le_streamer.c | 8 ++++++- example/led_counter.c | 7 ++++++- example/sco_demo_util.c | 5 +++++ example/sdp_bnep_query.c | 10 +++++++++ example/sdp_general_query.c | 11 +++++++++- example/sdp_rfcomm_query.c | 10 +++++++++ example/sm_pairing_central.c | 3 +++ example/sm_pairing_peripheral.c | 3 +++ example/spp_and_le_counter.c | 4 ++++ example/spp_counter.c | 5 +++++ example/spp_streamer.c | 11 +++++++++- platform/libusb/hci_transport_h2_libusb.c | 10 +++++++++ port/libusb/Makefile | 2 +- port/libusb/main.c | 5 ++++- src/ble/ancs_client.c | 4 ++++ src/ble/att_db.c | 21 +++++++++++++++++++ src/ble/att_server.c | 3 +++ src/ble/gatt-service/battery_service_server.c | 8 +++++++ src/ble/gatt_client.c | 4 ++++ src/ble/sm.c | 11 ++++++++++ src/btstack_debug.h | 4 +++- src/classic/bnep.c | 2 ++ src/classic/btstack_link_key_db_memory.c | 1 + src/classic/btstack_sbc_bludroid.c | 2 ++ src/classic/hfp.c | 6 ++++++ src/classic/hfp_ag.c | 4 ++++ src/classic/hfp_hf.c | 2 ++ src/classic/hsp_ag.c | 15 ++++++++++++- src/classic/hsp_hs.c | 13 +++++++++++- src/classic/rfcomm.c | 6 +++++- src/classic/sdp_client.c | 2 ++ src/classic/sdp_client_rfcomm.c | 5 +++++ src/classic/sdp_server.c | 2 ++ src/classic/sdp_util.c | 16 ++++++++++++++ src/hci.c | 7 +++++++ src/l2cap.c | 12 ++++++++++- 48 files changed, 308 insertions(+), 12 deletions(-) diff --git a/3rd-party/mbedtls/library/ecp.c b/3rd-party/mbedtls/library/ecp.c index 822f8c731..8cdb3603c 100644 --- a/3rd-party/mbedtls/library/ecp.c +++ b/3rd-party/mbedtls/library/ecp.c @@ -1446,6 +1446,9 @@ static int ecp_mul_naive( mbedtls_ecp_group *grp, mbedtls_ecp_point *R, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng ) { + (void) f_rng; + (void) p_rng; + int ret; int i; diff --git a/example/ancs_client_demo.c b/example/ancs_client_demo.c index 3db168f8e..9fd0fadc4 100644 --- a/example/ancs_client_demo.c +++ b/example/ancs_client_demo.c @@ -85,6 +85,9 @@ static btstack_packet_callback_registration_t hci_event_callback_registration; static btstack_packet_callback_registration_t sm_event_callback_registration; static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + switch (packet_type) { case HCI_EVENT_PACKET: switch (hci_event_packet_get_type(packet)) { @@ -101,6 +104,10 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * } static void ancs_callback(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(size); + const char * attribute_name; if (hci_event_packet_get_type(packet) != HCI_EVENT_ANCS_META) return; switch (hci_event_ancs_meta_get_subevent_code(packet)){ @@ -123,6 +130,9 @@ static void ancs_callback(uint8_t packet_type, uint16_t channel, uint8_t *packet int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ + UNUSED(argc); + (void)argv; + printf("BTstack ANCS Client starting up...\n"); // register for HCI events diff --git a/example/gap_dedicated_bonding.c b/example/gap_dedicated_bonding.c index 25fd67f78..392b9d534 100644 --- a/example/gap_dedicated_bonding.c +++ b/example/gap_dedicated_bonding.c @@ -47,6 +47,9 @@ static bd_addr_t remote = {0x84, 0x38, 0x35, 0x65, 0xD1, 0x15}; static btstack_packet_callback_registration_t hci_event_callback_registration; static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + if (packet_type != HCI_EVENT_PACKET) return; switch (hci_event_packet_get_type(packet)) { @@ -65,6 +68,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ + (void)argc; + (void)argv; hci_event_callback_registration.callback = &packet_handler; hci_add_event_handler(&hci_event_callback_registration); diff --git a/example/gap_inquiry.c b/example/gap_inquiry.c index 657a483d2..80cb8b1af 100644 --- a/example/gap_inquiry.c +++ b/example/gap_inquiry.c @@ -129,6 +129,9 @@ static void continue_remote_names(void){ */ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + bd_addr_t addr; int i; int numResponses; @@ -272,6 +275,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe /* LISTING_START(MainConfiguration): Setup packet handler for GAP inquiry */ int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]) { + (void)argc; + (void)argv; hci_event_callback_registration.callback = &packet_handler; hci_add_event_handler(&hci_event_callback_registration); diff --git a/example/gap_le_advertisements.c b/example/gap_le_advertisements.c index bf8fb98b0..cb4b9e4db 100644 --- a/example/gap_le_advertisements.c +++ b/example/gap_le_advertisements.c @@ -231,6 +231,9 @@ static void dump_advertisement_data(const uint8_t * adv_data, uint8_t adv_size){ /* LISTING_START(GAPLEAdvPacketHandler): Scanning and receiving advertisements */ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + if (packet_type != HCI_EVENT_PACKET) return; switch (hci_event_packet_get_type(packet)) { diff --git a/example/gatt_battery_query.c b/example/gatt_battery_query.c index e063c57b8..f78edd655 100644 --- a/example/gatt_battery_query.c +++ b/example/gatt_battery_query.c @@ -140,6 +140,10 @@ static void dump_service(gatt_client_service_t * service){ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(size); + int status; uint8_t battery_level; @@ -236,6 +240,9 @@ static void fill_advertising_report_from_packet(advertising_report_t * adv_repor } static void hci_event_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + if (packet_type != HCI_EVENT_PACKET) return; uint8_t event = hci_event_packet_get_type(packet); diff --git a/example/gatt_browser.c b/example/gatt_browser.c index 5dc23acae..f61bfb3fa 100644 --- a/example/gatt_browser.c +++ b/example/gatt_browser.c @@ -164,6 +164,9 @@ static void fill_advertising_report_from_packet(advertising_report_t * report, u /* LISTING_START(GATTBrowserHCIPacketHandler): Connecting and disconnecting from the GATT client */ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + if (packet_type != HCI_EVENT_PACKET) return; advertising_report_t report; @@ -221,6 +224,10 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac static int search_services = 1; static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(size); + gatt_client_service_t service; gatt_client_characteristic_t characteristic; switch(hci_event_packet_get_type(packet)){ diff --git a/example/hfp_ag_demo.c b/example/hfp_ag_demo.c index bf24a0455..15d211fd9 100644 --- a/example/hfp_ag_demo.c +++ b/example/hfp_ag_demo.c @@ -202,6 +202,8 @@ static void continue_remote_names(void){ } static void inquiry_packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size){ + UNUSED(size); + bd_addr_t addr; int i; int numResponses; @@ -329,6 +331,9 @@ static void show_usage(void){ } static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){ + UNUSED(ds); + UNUSED(callback_type); + cmd = btstack_stdin_read(); switch (cmd){ case 'a': @@ -549,6 +554,8 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac #endif static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t event_size){ + UNUSED(channel); + switch (packet_type){ case HCI_EVENT_PACKET: switch (event[0]){ @@ -678,6 +685,8 @@ static hfp_phone_number_t subscriber_number = { int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ + (void)argc; + (void)argv; sco_demo_init(); diff --git a/example/hfp_hf_demo.c b/example/hfp_hf_demo.c index 458110279..98a957922 100644 --- a/example/hfp_hf_demo.c +++ b/example/hfp_hf_demo.c @@ -152,6 +152,8 @@ static void show_usage(void){ } static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){ + UNUSED(ds); + UNUSED(callback_type); cmd = btstack_stdin_read(); @@ -433,7 +435,8 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac #endif static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t event_size){ - + UNUSED(channel); + switch (packet_type){ case HCI_SCO_DATA_PACKET: @@ -552,6 +555,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even /* LISTING_START(MainConfiguration): Setup HFP Hands-Free unit */ int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ + (void)argc; + (void)argv; sco_demo_init(); diff --git a/example/hsp_ag_demo.c b/example/hsp_ag_demo.c index 8aeb22519..9da3ccaa7 100644 --- a/example/hsp_ag_demo.c +++ b/example/hsp_ag_demo.c @@ -121,6 +121,8 @@ static void show_usage(void){ #ifdef HAVE_POSIX_STDIN static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){ + UNUSED(ds); + UNUSED(callback_type); char buffer = btstack_stdin_read(); @@ -178,6 +180,7 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac #endif static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t event_size){ + UNUSED(channel); switch (packet_type){ @@ -273,6 +276,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even /* LISTING_START(MainConfiguration): Setup HSP Audio Gateway */ int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ + (void)argc; + (void)argv; sco_demo_init(); diff --git a/example/hsp_hs_demo.c b/example/hsp_hs_demo.c index fcdd238ae..52f5bd8f5 100644 --- a/example/hsp_hs_demo.c +++ b/example/hsp_hs_demo.c @@ -121,6 +121,8 @@ static void show_usage(void){ #ifdef HAVE_POSIX_STDIN static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){ + UNUSED(ds); + UNUSED(callback_type); char buffer = btstack_stdin_read(); @@ -178,6 +180,8 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac #endif static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t event_size){ + UNUSED(channel); + switch (packet_type){ case HCI_SCO_DATA_PACKET: sco_demo_receive(event, event_size); @@ -275,6 +279,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even /* LISTING_START(MainConfiguration): Setup HSP Headset */ int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ + (void)argc; + (void)argv; sco_demo_init(); diff --git a/example/le_counter.c b/example/le_counter.c index c435bf159..99bc111b9 100644 --- a/example/le_counter.c +++ b/example/le_counter.c @@ -176,6 +176,9 @@ static void heartbeat_handler(struct btstack_timer_source *ts){ /* LISTING_START(packetHandler): Packet Handler */ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + switch (packet_type) { case HCI_EVENT_PACKET: switch (hci_event_packet_get_type(packet)) { @@ -207,6 +210,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack // - if buffer != NULL, copy data and return number bytes copied // @param offset defines start of attribute value static uint16_t att_read_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size){ + UNUSED(connection_handle); + if (att_handle == ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_VALUE_HANDLE){ if (buffer){ memcpy(buffer, &counter_string[offset], buffer_size); @@ -230,6 +235,10 @@ static uint16_t att_read_callback(hci_con_handle_t connection_handle, uint16_t a /* LISTING_START(attWrite): ATT Write */ static int att_write_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size){ + UNUSED(transaction_mode); + UNUSED(offset); + UNUSED(buffer_size); + if (att_handle != ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_CLIENT_CONFIGURATION_HANDLE) return 0; le_notification_enabled = little_endian_read_16(buffer, 0) == GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION; con_handle = connection_handle; diff --git a/example/le_streamer.c b/example/le_streamer.c index f9d1b0e70..398529c8f 100644 --- a/example/le_streamer.c +++ b/example/le_streamer.c @@ -135,7 +135,7 @@ static void test_reset(void){ } static void test_track_sent(int bytes_sent){ - test_data_sent += test_data_len; + test_data_sent += bytes_sent; // evaluate uint32_t now = btstack_run_loop_get_time_ms(); uint32_t time_passed = now - test_data_start; @@ -160,6 +160,9 @@ static void test_track_sent(int bytes_sent){ /* LISTING_START(packetHandler): Packet Handler */ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + int mtu; switch (packet_type) { case HCI_EVENT_PACKET: @@ -229,6 +232,9 @@ static void streamer(void){ /* LISTING_START(attWrite): ATT Write */ static int att_write_callback(hci_con_handle_t con_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size){ + UNUSED(con_handle); + UNUSED(offset); + // printf("att_write_callback att_handle %04x, transaction mode %u\n", att_handle, transaction_mode); if (transaction_mode != ATT_TRANSACTION_MODE_NONE) return 0; switch(att_handle){ diff --git a/example/led_counter.c b/example/led_counter.c index a0ca5aaf8..d940907af 100644 --- a/example/led_counter.c +++ b/example/led_counter.c @@ -49,6 +49,7 @@ #include #include "btstack_run_loop.h" +#include "btstack_defines.h" #include "hal_led.h" #define HEARTBEAT_PERIOD_MS 1000 @@ -65,7 +66,9 @@ static btstack_timer_source_t heartbeat; */ /* LISTING_START(LEDToggler): Periodic counter */ -static void heartbeat_handler(btstack_timer_source_t *ts){ +static void heartbeat_handler(btstack_timer_source_t *ts){ + UNUSED(ts); + // increment counter char lineBuffer[30]; sprintf(lineBuffer, "BTstack counter %04u\n\r", ++counter); @@ -89,6 +92,8 @@ static void heartbeat_handler(btstack_timer_source_t *ts){ /* LISTING_START(MainConfiguration): Setup heartbeat timer */ int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ + (void)argc; + (void)argv; // set one-shot timer heartbeat.process = &heartbeat_handler; diff --git a/example/sco_demo_util.c b/example/sco_demo_util.c index 1d3b61dd2..3d9a19502 100644 --- a/example/sco_demo_util.c +++ b/example/sco_demo_util.c @@ -208,6 +208,9 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer, #endif static void handle_pcm_data(int16_t * data, int num_samples, int num_channels, int sample_rate, void * context){ + UNUSED(context); + UNUSED(sample_rate); + // printf("handle_pcm_data num samples %u, sample rate %d\n", num_samples, num_channels); #ifdef USE_PORTAUDIO if (!pa_stream_started && btstack_ring_buffer_bytes_available(&ring_buffer) >= MSBC_PREBUFFER_BYTES){ @@ -221,6 +224,8 @@ static void handle_pcm_data(int16_t * data, int num_samples, int num_channels, i } btstack_ring_buffer_write(&ring_buffer, (uint8_t *)data, num_samples*num_channels*2); // printf("bytes avail after write: %d\n", btstack_ring_buffer_bytes_available(&ring_buffer)); +#else + UNUSED(num_channels); #endif if (!num_samples_to_write) return; diff --git a/example/sdp_bnep_query.c b/example/sdp_bnep_query.c index 3f3d363cb..db49fb82d 100644 --- a/example/sdp_bnep_query.c +++ b/example/sdp_bnep_query.c @@ -112,6 +112,9 @@ static void sdp_client_init(void){ /* LISTING_START(SDPQueryUUID): Querying the a list of service records on a remote device. */ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + if (packet_type != HCI_EVENT_PACKET) return; uint8_t event = hci_event_packet_get_type(packet); @@ -161,6 +164,10 @@ static char * get_string_from_data_element(uint8_t * element){ /* LISTING_START(HandleSDPQUeryResult): Extracting BNEP Protcol UUID and L2CAP PSM */ static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(size); + /* LISTING_PAUSE */ des_iterator_t des_list_it; des_iterator_t prot_it; @@ -266,6 +273,9 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ + (void)argc; + (void)argv; + printf("Client HCI init done\r\n"); sdp_client_init(); diff --git a/example/sdp_general_query.c b/example/sdp_general_query.c index 6e0cc7ead..5872e8eec 100644 --- a/example/sdp_general_query.c +++ b/example/sdp_general_query.c @@ -107,6 +107,9 @@ static bd_addr_t remote = {0x04,0x0C,0xCE,0xE4,0x85,0xD3}; /* LISTING_START(SDPQueryUUID): Querying a list of service records on a remote device. */ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + if (packet_type != HCI_EVENT_PACKET) return; uint8_t event = hci_event_packet_get_type(packet); @@ -144,6 +147,10 @@ static void assertBuffer(int size){ /* LISTING_START(HandleSDPQUeryResult): Handling query result chunks. */ static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(size); + switch (packet[0]){ case SDP_EVENT_QUERY_ATTRIBUTE_VALUE: // handle new record @@ -170,7 +177,9 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ - + (void)argc; + (void)argv; + printf("Client HCI init done\r\n"); sdp_client_init(); diff --git a/example/sdp_rfcomm_query.c b/example/sdp_rfcomm_query.c index bd222bf28..866e741ab 100644 --- a/example/sdp_rfcomm_query.c +++ b/example/sdp_rfcomm_query.c @@ -71,6 +71,9 @@ static btstack_packet_callback_registration_t hci_event_callback_registration; static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + if (packet_type != HCI_EVENT_PACKET) return; uint8_t event = hci_event_packet_get_type(packet); @@ -110,6 +113,10 @@ static void report_found_services(void){ } static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(size); + switch (packet[0]){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: store_found_service(sdp_event_query_rfcomm_service_get_name(packet), @@ -124,6 +131,9 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uin int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ + (void)argc; + (void)argv; + printf("Client HCI init done\r\n"); // register for HCI events diff --git a/example/sm_pairing_central.c b/example/sm_pairing_central.c index 6b0f2bfd9..09db3d134 100644 --- a/example/sm_pairing_central.c +++ b/example/sm_pairing_central.c @@ -129,6 +129,9 @@ static void sm_pairing_central_setup(void){ /* LISTING_START(GAPLEAdvPacketHandler): Scanning and receiving advertisements */ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + if (packet_type != HCI_EVENT_PACKET) return; hci_con_handle_t con_handle; diff --git a/example/sm_pairing_peripheral.c b/example/sm_pairing_peripheral.c index e94c69659..b752bb468 100644 --- a/example/sm_pairing_peripheral.c +++ b/example/sm_pairing_peripheral.c @@ -147,6 +147,9 @@ static void sm_peripheral_setup(void){ /* LISTING_START(packetHandler): Packet Handler */ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + bd_addr_t addr; switch (packet_type) { case HCI_EVENT_PACKET: diff --git a/example/spp_and_le_counter.c b/example/spp_and_le_counter.c index a594a820f..6b7f7cb67 100644 --- a/example/spp_and_le_counter.c +++ b/example/spp_and_le_counter.c @@ -99,6 +99,8 @@ uint8_t adv_data_len = sizeof(adv_data); */ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + bd_addr_t event_addr; uint8_t rfcomm_channel_nr; uint16_t mtu; @@ -180,6 +182,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack // - if buffer != NULL, copy data and return number bytes copied // @param offset defines start of attribute value static uint16_t att_read_callback(hci_con_handle_t con_handle, uint16_t att_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size){ + UNUSED(con_handle); + if (att_handle == ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_VALUE_HANDLE){ if (buffer){ memcpy(buffer, &counter_string[offset], buffer_size); diff --git a/example/spp_counter.c b/example/spp_counter.c index 98cddd378..1553eabe1 100644 --- a/example/spp_counter.c +++ b/example/spp_counter.c @@ -170,6 +170,8 @@ static void one_shot_timer_setup(void){ /* LISTING_START(SppServerPacketHandler): SPP Server - Heartbeat Counter over RFCOMM */ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + /* LISTING_PAUSE */ bd_addr_t event_addr; uint8_t rfcomm_channel_nr; @@ -244,6 +246,9 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ + (void)argc; + (void)argv; + one_shot_timer_setup(); spp_service_setup(); diff --git a/example/spp_streamer.c b/example/spp_streamer.c index 01c3f6984..ee889ad6a 100644 --- a/example/spp_streamer.c +++ b/example/spp_streamer.c @@ -107,7 +107,7 @@ static void test_reset(void){ } static void test_track_sent(int bytes_sent){ - test_data_sent += test_data_len; + test_data_sent += bytes_sent; // evaluate uint32_t now = btstack_run_loop_get_time_ms(); uint32_t time_passed = now - test_data_start; @@ -150,6 +150,9 @@ static void send_packet(void){ } static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + if (packet_type != HCI_EVENT_PACKET) return; uint8_t event = hci_event_packet_get_type(packet); switch (event) { @@ -204,6 +207,10 @@ static void handle_found_service(const char * name, uint8_t port){ } static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(size); + switch (packet[0]){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: handle_found_service(sdp_event_query_rfcomm_service_get_name(packet), @@ -226,6 +233,8 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uin int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ + (void)argc; + (void)argv; create_test_data(); diff --git a/platform/libusb/hci_transport_h2_libusb.c b/platform/libusb/hci_transport_h2_libusb.c index dc415200b..aff5adf59 100644 --- a/platform/libusb/hci_transport_h2_libusb.c +++ b/platform/libusb/hci_transport_h2_libusb.c @@ -470,6 +470,10 @@ static void handle_completed_transfer(struct libusb_transfer *transfer){ } static void usb_process_ds(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type) { + + UNUSED(ds); + UNUSED(callback_type); + if (libusb_state != LIB_USB_TRANSFERS_ALLOCATED) return; // log_info("begin usb_process_ds"); @@ -497,6 +501,9 @@ static void usb_process_ds(btstack_data_source_t *ds, btstack_data_source_callba } static void usb_process_ts(btstack_timer_source_t *timer) { + + UNUSED(timer); + // log_info("in usb_process_ts"); // timer is deactive, when timer callback gets called @@ -1171,6 +1178,9 @@ static void usb_register_packet_handler(void (*handler)(uint8_t packet_type, uin } static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(packet); + UNUSED(size); } // get usb singleton diff --git a/port/libusb/Makefile b/port/libusb/Makefile index c38f611a1..c2370465e 100644 --- a/port/libusb/Makefile +++ b/port/libusb/Makefile @@ -8,7 +8,7 @@ COMMON += hci_transport_h2_libusb.c btstack_run_loop_posix.c le_device_db_fs.c include ${BTSTACK_ROOT}/example/Makefile.inc # CC = gcc-fsf-4.9 -CFLAGS += -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Werror +CFLAGS += -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Werror -Wunused-parameter # CFLAGS += -Werror CFLAGS += -I${BTSTACK_ROOT}/platform/posix \ diff --git a/port/libusb/main.c b/port/libusb/main.c index 90e0ffaf5..92852c9b1 100644 --- a/port/libusb/main.c +++ b/port/libusb/main.c @@ -65,6 +65,8 @@ int btstack_main(int argc, const char * argv[]); static btstack_packet_callback_registration_t hci_event_callback_registration; static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); if (packet_type != HCI_EVENT_PACKET) return; if (hci_event_packet_get_type(packet) != BTSTACK_EVENT_STATE) return; if (btstack_event_state_get_state(packet) != HCI_STATE_WORKING) return; @@ -72,7 +74,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack } static void sigint_handler(int param){ - + UNUSED(param); + #ifndef _WIN32 // reset anyway btstack_stdin_reset(); diff --git a/src/ble/ancs_client.c b/src/ble/ancs_client.c index 06a7fac78..65c4bd626 100644 --- a/src/ble/ancs_client.c +++ b/src/ble/ancs_client.c @@ -181,6 +181,10 @@ static void ancs_chunk_parser_handle_byte(uint8_t data){ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(size); + int connection_encrypted; // handle connect / disconncet events first diff --git a/src/ble/att_db.c b/src/ble/att_db.c index 53d7a5036..fb8df605a 100644 --- a/src/ble/att_db.c +++ b/src/ble/att_db.c @@ -323,6 +323,8 @@ static uint8_t att_validate_security(att_connection_t * att_connection, att_iter static uint16_t handle_exchange_mtu_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len, uint8_t * response_buffer){ + UNUSED(request_len); + uint16_t client_rx_mtu = little_endian_read_16(request_buffer, 1); // find min(local max mtu, remote mtu) and use as mtu for this connection @@ -346,6 +348,8 @@ static uint16_t handle_exchange_mtu_request(att_connection_t * att_connection, u static uint16_t handle_find_information_request2(att_connection_t * att_connection, uint8_t * response_buffer, uint16_t response_buffer_size, uint16_t start_handle, uint16_t end_handle){ + UNUSED(att_connection); + log_info("ATT_FIND_INFORMATION_REQUEST: from %04X to %04X", start_handle, end_handle); uint8_t request_type = ATT_FIND_INFORMATION_REQUEST; @@ -404,6 +408,7 @@ static uint16_t handle_find_information_request2(att_connection_t * att_connecti static uint16_t handle_find_information_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len, uint8_t * response_buffer, uint16_t response_buffer_size){ + UNUSED(request_len); return handle_find_information_request2(att_connection, response_buffer, response_buffer_size, little_endian_read_16(request_buffer, 1), little_endian_read_16(request_buffer, 3)); } @@ -423,6 +428,8 @@ static uint16_t handle_find_by_type_value_request2(att_connection_t * att_connec uint16_t start_handle, uint16_t end_handle, uint16_t attribute_type, uint16_t attribute_len, uint8_t* attribute_value){ + UNUSED(att_connection); + log_info("ATT_FIND_BY_TYPE_VALUE_REQUEST: from %04X to %04X, type %04X, value: ", start_handle, end_handle, attribute_type); log_info_hexdump(attribute_value, attribute_len); uint8_t request_type = ATT_FIND_BY_TYPE_VALUE_REQUEST; @@ -635,6 +642,7 @@ static uint16_t handle_read_request2(att_connection_t * att_connection, uint8_t static uint16_t handle_read_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len, uint8_t * response_buffer, uint16_t response_buffer_size){ + UNUSED(request_len); return handle_read_request2(att_connection, response_buffer, response_buffer_size, little_endian_read_16(request_buffer, 1)); } @@ -684,6 +692,7 @@ static uint16_t handle_read_blob_request2(att_connection_t * att_connection, uin static uint16_t handle_read_blob_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len, uint8_t * response_buffer, uint16_t response_buffer_size){ + UNUSED(request_len); return handle_read_blob_request2(att_connection, response_buffer, response_buffer_size, little_endian_read_16(request_buffer, 1), little_endian_read_16(request_buffer, 3)); } @@ -773,6 +782,8 @@ static uint16_t handle_read_by_group_type_request2(att_connection_t * att_connec uint16_t start_handle, uint16_t end_handle, uint16_t attribute_type_len, uint8_t * attribute_type){ + UNUSED(att_connection); + log_info("ATT_READ_BY_GROUP_TYPE_REQUEST: from %04X to %04X, buffer size %u, type: ", start_handle, end_handle, response_buffer_size); log_info_hexdump(attribute_type, attribute_type_len); uint8_t request_type = ATT_READ_BY_GROUP_TYPE_REQUEST; @@ -876,6 +887,8 @@ static uint16_t handle_read_by_group_type_request(att_connection_t * att_connect static uint16_t handle_write_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len, uint8_t * response_buffer, uint16_t response_buffer_size){ + UNUSED(response_buffer_size); + uint8_t request_type = ATT_WRITE_REQUEST; uint16_t handle = little_endian_read_16(request_buffer, 1); @@ -912,6 +925,8 @@ static uint16_t handle_write_request(att_connection_t * att_connection, uint8_t static uint16_t handle_prepare_write_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len, uint8_t * response_buffer, uint16_t response_buffer_size){ + UNUSED(response_buffer_size); + uint8_t request_type = ATT_PREPARE_WRITE_REQUEST; uint16_t handle = little_endian_read_16(request_buffer, 1); @@ -981,6 +996,9 @@ void att_clear_transaction_queue(att_connection_t * att_connection){ static uint16_t handle_execute_write_request(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len, uint8_t * response_buffer, uint16_t response_buffer_size){ + UNUSED(request_len); + UNUSED(response_buffer_size); + uint8_t request_type = ATT_EXECUTE_WRITE_REQUEST; if (request_buffer[1]) { // deliver queued errors @@ -1005,6 +1023,9 @@ static uint16_t handle_execute_write_request(att_connection_t * att_connection, static void handle_write_command(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len, uint8_t * response_buffer, uint16_t response_buffer_size){ + UNUSED(response_buffer); + UNUSED(response_buffer_size); + uint16_t handle = little_endian_read_16(request_buffer, 1); att_write_callback_t callback = att_write_callback_for_handle(handle); if (!callback) return; diff --git a/src/ble/att_server.c b/src/ble/att_server.c index 09da317e0..aba1e01d8 100644 --- a/src/ble/att_server.c +++ b/src/ble/att_server.c @@ -132,6 +132,9 @@ static void att_handle_value_indication_timeout(btstack_timer_source_t *ts){ } static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + + UNUSED(channel); + UNUSED(size); att_server_t * att_server; hci_con_handle_t con_handle; diff --git a/src/ble/gatt-service/battery_service_server.c b/src/ble/gatt-service/battery_service_server.c index 7149428c9..757814410 100644 --- a/src/ble/gatt-service/battery_service_server.c +++ b/src/ble/gatt-service/battery_service_server.c @@ -60,6 +60,9 @@ static uint16_t battery_value_handle_client_configuration; static uint16_t battery_service_read_callback(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size){ + UNUSED(offset); + UNUSED(buffer_size); + if (attribute_handle == battery_value_handle_value){ if (buffer) { buffer[0] = battery_value; @@ -77,6 +80,11 @@ static uint16_t battery_service_read_callback(hci_con_handle_t con_handle, uint1 } static int battery_service_write_callback(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size){ + UNUSED(con_handle); + UNUSED(transaction_mode); + UNUSED(offset); + UNUSED(buffer_size); + if (attribute_handle == battery_value_handle_client_configuration){ battery_value_client_configuration = little_endian_read_16(buffer, 0); } diff --git a/src/ble/gatt_client.c b/src/ble/gatt_client.c index c8d76eb29..7b7f108bd 100644 --- a/src/ble/gatt_client.c +++ b/src/ble/gatt_client.c @@ -682,6 +682,7 @@ static void report_gatt_long_characteristic_value_blob(gatt_client_t * periphera } static void report_gatt_characteristic_descriptor(gatt_client_t * peripheral, uint16_t descriptor_handle, uint8_t *value, uint16_t value_length, uint16_t value_offset){ + UNUSED(value_offset); uint8_t * packet = setup_characteristic_value_packet(GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT, peripheral->con_handle, descriptor_handle, value, value_length); emit_event_new(peripheral->callback, packet, value_length + 8); } @@ -996,6 +997,9 @@ static void gatt_client_report_error_if_pending(gatt_client_t *peripheral, uint8 } static void gatt_client_hci_event_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + if (packet_type != HCI_EVENT_PACKET) return; switch (hci_event_packet_get_type(packet)) { diff --git a/src/ble/sm.c b/src/ble/sm.c index 703b08730..652a7bb03 100644 --- a/src/ble/sm.c +++ b/src/ble/sm.c @@ -454,6 +454,8 @@ static void gap_random_address_trigger(void){ } static void gap_random_address_update_handler(btstack_timer_source_t * timer){ + UNUSED(timer); + log_info("GAP Random Address Update due"); btstack_run_loop_set_timer(&gap_random_address_update_timer, gap_random_adress_update_period); btstack_run_loop_add_timer(&gap_random_address_update_timer); @@ -667,6 +669,8 @@ static void sm_setup_event_base(uint8_t * event, int event_size, uint8_t type, h } static void sm_dispatch_event(uint8_t packet_type, uint16_t channel, uint8_t * packet, uint16_t size){ + UNUSED(channel); + // log event hci_dump_packet(packet_type, 1, packet, size); // dispatch to all event handlers @@ -2706,6 +2710,8 @@ static void sm_handle_encryption_result(uint8_t * data){ #ifdef USE_MBEDTLS_FOR_ECDH static int sm_generate_f_rng(void * context, unsigned char * buffer, size_t size){ + UNUSED(context); + int offset = setup->sm_passkey_bit; log_info("sm_generate_f_rng: size %u - offset %u", (int) size, offset); while (size) { @@ -2872,6 +2878,9 @@ static void sm_handle_random_result(uint8_t * data){ static void sm_event_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + UNUSED(size); + sm_connection_t * sm_conn; hci_con_handle_t con_handle; @@ -3182,6 +3191,8 @@ static int sm_validate_stk_generation_method(void){ static void sm_pdu_handler(uint8_t packet_type, hci_con_handle_t con_handle, uint8_t *packet, uint16_t size){ + UNUSED(size); + if (packet_type == HCI_EVENT_PACKET && packet[0] == L2CAP_EVENT_CAN_SEND_NOW){ sm_run(); } diff --git a/src/btstack_debug.h b/src/btstack_debug.h index 963054342..4e482459a 100644 --- a/src/btstack_debug.h +++ b/src/btstack_debug.h @@ -55,7 +55,9 @@ #endif // Avoid complaints of unused arguments when log levels are disabled. -static inline void __log_unused(const char *format, ...) {} +static inline void __log_unused(const char *format, ...) { + UNUSED(format); +} // allow to provide port specific printf #ifndef BTSTACK_PRINTF diff --git a/src/classic/bnep.c b/src/classic/bnep.c index 8ba02ffd4..9e5b2ed38 100644 --- a/src/classic/bnep.c +++ b/src/classic/bnep.c @@ -1170,6 +1170,8 @@ static int bnep_handle_control_packet(bnep_channel_t *channel, uint8_t *packet, */ static int bnep_hci_event_handler(uint8_t *packet, uint16_t size) { + UNUSED(size); + bd_addr_t event_addr; uint16_t psm; uint16_t l2cap_cid; diff --git a/src/classic/btstack_link_key_db_memory.c b/src/classic/btstack_link_key_db_memory.c index 4a2edf67a..a91b66abe 100644 --- a/src/classic/btstack_link_key_db_memory.c +++ b/src/classic/btstack_link_key_db_memory.c @@ -54,6 +54,7 @@ static void db_open(void){ } static void db_set_local_bd_addr(bd_addr_t bd_addr){ + (void)bd_addr; } static void db_close(void){ diff --git a/src/classic/btstack_sbc_bludroid.c b/src/classic/btstack_sbc_bludroid.c index 9a585dc0d..da12533de 100644 --- a/src/classic/btstack_sbc_bludroid.c +++ b/src/classic/btstack_sbc_bludroid.c @@ -503,6 +503,8 @@ void btstack_sbc_decoder_process_data(btstack_sbc_decoder_state_t * state, int p void btstack_sbc_encoder_init(btstack_sbc_encoder_state_t * state, btstack_sbc_mode_t mode, int blocks, int subbands, int allmethod, int sample_rate, int bitpool){ + UNUSED(bitpool); + if (sbc_encoder_state_singleton && sbc_encoder_state_singleton != state ){ log_error("SBC encoder: different sbc decoder state is allready registered"); } diff --git a/src/classic/hfp.c b/src/classic/hfp.c index b3d4372fa..9bb8c2308 100644 --- a/src/classic/hfp.c +++ b/src/classic/hfp.c @@ -455,6 +455,10 @@ void hfp_create_sdp_record(uint8_t * service, uint32_t service_record_handle, ui static hfp_connection_t * connection_doing_sdp_query = NULL; static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(size); + hfp_connection_t * hfp_connection = connection_doing_sdp_query; if ( hfp_connection->state != HFP_W4_SDP_QUERY_COMPLETE) return; @@ -528,6 +532,8 @@ static void hfp_handle_failed_sco_connection(uint8_t status){ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + bd_addr_t event_addr; uint16_t rfcomm_cid, handle; hfp_connection_t * hfp_connection = NULL; diff --git a/src/classic/hfp_ag.c b/src/classic/hfp_ag.c index 8e98c8010..901823dca 100644 --- a/src/classic/hfp_ag.c +++ b/src/classic/hfp_ag.c @@ -436,6 +436,8 @@ static int hfp_ag_retrieve_indicators_status_cmd(uint16_t cid){ } static int hfp_ag_set_indicator_status_update_cmd(uint16_t cid, uint8_t activate){ + UNUSED(activate); + // AT\r\n%s:3,0,0,%d\r\n return hfp_ag_ok(cid); } @@ -1815,6 +1817,8 @@ static hfp_generic_status_indicator_t *get_hf_indicator_by_number(int number){ } static void hfp_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + hfp_connection_t * hfp_connection = get_hfp_connection_context_for_rfcomm_cid(channel); if (!hfp_connection) return; diff --git a/src/classic/hfp_hf.c b/src/classic/hfp_hf.c index 3a80ab5ef..d9c059fab 100644 --- a/src/classic/hfp_hf.c +++ b/src/classic/hfp_hf.c @@ -982,6 +982,8 @@ static void hfp_hf_switch_on_ok(hfp_connection_t *hfp_connection){ static void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + hfp_connection_t * hfp_connection = get_hfp_connection_context_for_rfcomm_cid(channel); if (!hfp_connection) return; diff --git a/src/classic/hsp_ag.c b/src/classic/hsp_ag.c index f1464fdc9..b2eb4a91b 100644 --- a/src/classic/hsp_ag.c +++ b/src/classic/hsp_ag.c @@ -131,7 +131,12 @@ static void hsp_run(void); static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size); static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size); -static void dummy_notify(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t size){} +static void dummy_notify(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(event); + UNUSED(size); +} void hsp_ag_register_packet_handler(btstack_packet_handler_t callback){ if (callback == NULL){ @@ -344,6 +349,8 @@ void hsp_ag_set_speaker_gain(uint8_t gain){ } static void hsp_ringing_timeout_handler(btstack_timer_source_t * timer){ + UNUSED(timer); + ag_ring = 1; btstack_run_loop_set_timer(&hs_timeout, 2000); // 2 seconds timeout btstack_run_loop_add_timer(&hs_timeout); @@ -531,6 +538,8 @@ static void hsp_run(void){ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + if (packet_type == RFCOMM_DATA_PACKET){ while (size > 0 && (packet[0] == '\n' || packet[0] == '\r')){ size--; @@ -696,6 +705,10 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack } static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(size); + switch (packet[0]){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: channel_nr = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet); diff --git a/src/classic/hsp_hs.c b/src/classic/hsp_hs.c index a4c7b0663..c98dba223 100644 --- a/src/classic/hsp_hs.c +++ b/src/classic/hsp_hs.c @@ -124,7 +124,12 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size); static btstack_packet_handler_t hsp_hs_callback; -static void dummy_notify(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t size){} +static void dummy_notify(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(event); + UNUSED(size); +} void hsp_hs_register_packet_handler(btstack_packet_handler_t callback){ if (callback == NULL){ @@ -442,6 +447,8 @@ static void hsp_run(void){ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(channel); + // printf("packet_handler type %u, packet[0] %x\n", packet_type, packet[0]); if (packet_type == RFCOMM_DATA_PACKET){ // skip over leading newline @@ -598,6 +605,10 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack } static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + UNUSED(size); + switch (hci_event_packet_get_type(packet)){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: channel_nr = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet); diff --git a/src/classic/rfcomm.c b/src/classic/rfcomm.c index 4ddcc5170..196dcb0b0 100644 --- a/src/classic/rfcomm.c +++ b/src/classic/rfcomm.c @@ -909,6 +909,8 @@ static void rfcomm_multiplexer_set_state_and_request_can_send_now_event(rfcomm_m * @return handled packet */ static int rfcomm_hci_event_handler(uint8_t *packet, uint16_t size){ + UNUSED(size); + bd_addr_t event_addr; uint16_t psm; uint16_t l2cap_cid; @@ -1038,6 +1040,7 @@ static int rfcomm_hci_event_handler(uint8_t *packet, uint16_t size){ } static int rfcomm_multiplexer_l2cap_packet_handler(uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(size); // get or create a multiplexer for a certain device rfcomm_multiplexer_t *multiplexer = rfcomm_multiplexer_for_l2cap_cid(channel); @@ -1403,7 +1406,8 @@ static void rfcomm_channel_state_machine_with_dlci(rfcomm_multiplexer_t * multip } static void rfcomm_channel_packet_handler(rfcomm_multiplexer_t * multiplexer, uint8_t *packet, uint16_t size){ - + UNUSED(size); + // rfcomm: (0) addr [76543 server channel] [2 direction: initiator uses 1] [1 C/R: CMD by initiator = 1] [0 EA=1] const uint8_t frame_dlci = packet[0] >> 2; uint8_t message_dlci; // used by commands in UIH(_PF) packets diff --git a/src/classic/sdp_client.c b/src/classic/sdp_client.c index c82760bab..4daf85cf2 100644 --- a/src/classic/sdp_client.c +++ b/src/classic/sdp_client.c @@ -385,6 +385,8 @@ static void sdp_client_parse_service_search_attribute_response(uint8_t* packet){ } void sdp_client_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(size); + // uint16_t handle; if (packet_type == L2CAP_DATA_PACKET){ uint16_t responseTransactionID = big_endian_read_16(packet,1); diff --git a/src/classic/sdp_client_rfcomm.c b/src/classic/sdp_client_rfcomm.c index c0ee1faa6..40652f229 100644 --- a/src/classic/sdp_client_rfcomm.c +++ b/src/classic/sdp_client_rfcomm.c @@ -100,6 +100,8 @@ static void sdp_rfcomm_query_emit_service(void){ } static void sdp_client_query_rfcomm_handle_protocol_descriptor_list_data(uint32_t attribute_value_length, uint32_t data_offset, uint8_t data){ + UNUSED(attribute_value_length); + // init state on first byte if (data_offset == 0){ pdl_state = GET_PROTOCOL_LIST_LENGTH; @@ -241,6 +243,9 @@ static void sdp_client_query_rfcomm_handle_service_name_data(uint32_t attribute_ } static void sdp_client_query_rfcomm_handle_sdp_parser_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(packet_type); + UNUSED(channel); + switch (hci_event_packet_get_type(packet)){ case SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE: // handle service without a name diff --git a/src/classic/sdp_server.c b/src/classic/sdp_server.c index dc6e9989d..3afbfa221 100644 --- a/src/classic/sdp_server.c +++ b/src/classic/sdp_server.c @@ -448,6 +448,8 @@ static void sdp_respond(void){ // we assume that we don't get two requests in a row static void sdp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ + UNUSED(size); + uint16_t transaction_id; SDP_PDU_ID_t pdu_id; uint16_t remote_mtu; diff --git a/src/classic/sdp_util.c b/src/classic/sdp_util.c index 45ea0e996..4c1aca5e6 100644 --- a/src/classic/sdp_util.c +++ b/src/classic/sdp_util.c @@ -371,6 +371,8 @@ struct sdp_context_append_attributes { }; static int sdp_traversal_append_attributes(uint16_t attributeID, uint8_t * attributeValue, de_type_t type, de_size_t size, void *my_context){ + UNUSED(type); + UNUSED(size); struct sdp_context_append_attributes * context = (struct sdp_context_append_attributes *) my_context; if (sdp_attribute_list_constains_id(context->attributeIDList, attributeID)) { // DES_HEADER(3) + DES_DATA + (UINT16(3) + attribute) @@ -429,6 +431,9 @@ static int spd_append_range(struct sdp_context_filter_attributes* context, uint1 } static int sdp_traversal_filter_attributes(uint16_t attributeID, uint8_t * attributeValue, de_type_t type, de_size_t size, void *my_context){ + UNUSED(type); + UNUSED(size); + struct sdp_context_filter_attributes * context = (struct sdp_context_filter_attributes *) my_context; if (!sdp_attribute_list_constains_id(context->attributeIDList, attributeID)) return 0; @@ -488,6 +493,9 @@ struct sdp_context_get_filtered_size { }; static int sdp_traversal_get_filtered_size(uint16_t attributeID, uint8_t * attributeValue, de_type_t type, de_size_t size, void *my_context){ + UNUSED(type); + UNUSED(size); + struct sdp_context_get_filtered_size * context = (struct sdp_context_get_filtered_size *) my_context; if (sdp_attribute_list_constains_id(context->attributeIDList, attributeID)) { context->size += 3 + de_get_len(attributeValue); @@ -510,6 +518,9 @@ struct sdp_context_attribute_by_id { uint8_t * attributeValue; }; static int sdp_traversal_attribute_by_id(uint16_t attributeID, uint8_t * attributeValue, de_type_t attributeType, de_size_t size, void *my_context){ + UNUSED(attributeType); + UNUSED(size); + struct sdp_context_attribute_by_id * context = (struct sdp_context_attribute_by_id *) my_context; if (attributeID == context->attributeID) { context->attributeValue = attributeValue; @@ -574,6 +585,8 @@ struct sdp_context_contains_uuid128 { }; int sdp_record_contains_UUID128(uint8_t *record, uint8_t *uuid128); static int sdp_traversal_contains_UUID128(uint8_t * element, de_type_t type, de_size_t size, void *my_context){ + UNUSED(size); + struct sdp_context_contains_uuid128 * context = (struct sdp_context_contains_uuid128 *) my_context; uint8_t normalizedUUID[16]; if (type == DE_UUID){ @@ -602,6 +615,9 @@ struct sdp_context_match_pattern { }; int sdp_traversal_match_pattern(uint8_t * element, de_type_t attributeType, de_size_t size, void *my_context){ + UNUSED(attributeType); + UNUSED(size); + struct sdp_context_match_pattern * context = (struct sdp_context_match_pattern *) my_context; uint8_t normalizedUUID[16]; uint8_t uuidOK = de_get_normalized_uuid(normalizedUUID, element); diff --git a/src/hci.c b/src/hci.c index ee1767215..b8d7a20ab 100644 --- a/src/hci.c +++ b/src/hci.c @@ -859,6 +859,9 @@ void gap_advertisements_get_address(uint8_t * addr_type, bd_addr_t addr){ #ifdef ENABLE_BLE void le_handle_advertisement_report(uint8_t *packet, int size){ + + UNUSED(size); + int offset = 3; int num_reports = packet[offset]; offset += 1; @@ -896,6 +899,8 @@ static uint32_t hci_transport_uart_get_main_baud_rate(void){ } static void hci_initialization_timeout_handler(btstack_timer_source_t * ds){ + UNUSED(ds); + switch (hci_stack->substate){ case HCI_INIT_W4_SEND_RESET: log_info("Resend HCI Reset"); @@ -1168,6 +1173,8 @@ static void hci_init_done(void){ } static void hci_initializing_event_handler(uint8_t * packet, uint16_t size){ + UNUSED(size); + uint8_t command_completed = 0; if (hci_event_packet_get_type(packet) == HCI_EVENT_COMMAND_COMPLETE){ diff --git a/src/l2cap.c b/src/l2cap.c index 9a542b26c..2ebbde98b 100644 --- a/src/l2cap.c +++ b/src/l2cap.c @@ -197,6 +197,8 @@ void l2cap_register_packet_handler(void (*handler)(uint8_t packet_type, uint16_t } void l2cap_request_can_send_fix_channel_now_event(hci_con_handle_t con_handle, uint16_t channel_id){ + UNUSED(con_handle); + int index = l2cap_fixed_channel_table_index_for_channel_id(channel_id); if (index < 0) return; fixed_channels[index].waiting_for_can_send_now = 1; @@ -204,6 +206,8 @@ void l2cap_request_can_send_fix_channel_now_event(hci_con_handle_t con_handle, u } int l2cap_can_send_fixed_channel_packet_now(hci_con_handle_t con_handle, uint16_t channel_id){ + UNUSED(channel_id); + return hci_can_send_acl_packet_now(con_handle); } @@ -1070,6 +1074,10 @@ static void l2cap_notify_channel_can_send(void){ } static void l2cap_hci_event_handler(uint8_t packet_type, uint16_t cid, uint8_t *packet, uint16_t size){ + + UNUSED(packet_type); + UNUSED(cid); + UNUSED(size); bd_addr_t address; hci_con_handle_t handle; @@ -1842,7 +1850,9 @@ static int l2cap_le_signaling_handler_dispatch(hci_con_handle_t handle, uint8_t #endif static void l2cap_acl_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size ){ - + UNUSED(packet_type); + UNUSED(channel); + l2cap_channel_t * l2cap_channel; UNUSED(l2cap_channel); From d0662982995562848649863322e67482762239f5 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 22 Dec 2016 22:44:50 +0100 Subject: [PATCH 3/4] fix unused params warnings --- src/ble/le_device_db_memory.c | 1 + src/ble/sm.c | 4 ++++ src/btstack_util.c | 6 ++++++ src/hci_dump.c | 3 +++ src/l2cap.c | 3 ++- 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/ble/le_device_db_memory.c b/src/ble/le_device_db_memory.c index 822364f2e..b016a571f 100644 --- a/src/ble/le_device_db_memory.c +++ b/src/ble/le_device_db_memory.c @@ -83,6 +83,7 @@ void le_device_db_init(void){ } void le_device_db_set_local_bd_addr(bd_addr_t bd_addr){ + (void)bd_addr; } // @returns number of device in db diff --git a/src/ble/sm.c b/src/ble/sm.c index 652a7bb03..52c443692 100644 --- a/src/ble/sm.c +++ b/src/ble/sm.c @@ -3688,6 +3688,10 @@ void sm_use_fixed_ec_keypair(uint8_t * qx, uint8_t * qy, uint8_t * d){ memcpy(ec_d, d, 32); sm_have_ec_keypair = 1; ec_key_generation_state = EC_KEY_GENERATION_DONE; +#else + UNUSED(qx); + UNUSED(qy); + UNUSED(d); #endif } diff --git a/src/btstack_util.c b/src/btstack_util.c index c6a8d19fb..0ff1e7327 100644 --- a/src/btstack_util.c +++ b/src/btstack_util.c @@ -214,6 +214,9 @@ void log_info_hexdump(const void *data, int size){ buffer[j] = 0; log_info("%s", buffer); } +#else + UNUSED(data); + UNUSED(size); #endif } @@ -229,6 +232,9 @@ void log_info_key(const char * name, sm_key_t key){ } buffer[j] = 0; log_info("%-6s %s", name, buffer); +#else + UNUSED(name); + UNUSED(key); #endif } diff --git a/src/hci_dump.c b/src/hci_dump.c index 90c18a5ff..543bf54e2 100644 --- a/src/hci_dump.c +++ b/src/hci_dump.c @@ -115,6 +115,9 @@ void hci_dump_open(const char *filename, hci_dump_format_t format){ } #else + UNUSED(filename); + UNUSED(format); + dump_file = 1; #endif } diff --git a/src/l2cap.c b/src/l2cap.c index 2ebbde98b..a0a8be304 100644 --- a/src/l2cap.c +++ b/src/l2cap.c @@ -1130,8 +1130,8 @@ static void l2cap_hci_event_handler(uint8_t packet_type, uint16_t cid, uint8_t * // handle disconnection complete events case HCI_EVENT_DISCONNECTION_COMPLETE: // send l2cap disconnect events for all channels on this handle and free them - handle = little_endian_read_16(packet, 3); #ifdef ENABLE_CLASSIC + handle = little_endian_read_16(packet, 3); btstack_linked_list_iterator_init(&it, &l2cap_channels); while (btstack_linked_list_iterator_has_next(&it)){ l2cap_channel_t * channel = (l2cap_channel_t *) btstack_linked_list_iterator_next(&it); @@ -1143,6 +1143,7 @@ static void l2cap_hci_event_handler(uint8_t packet_type, uint16_t cid, uint8_t * } #endif #ifdef ENABLE_LE_DATA_CHANNELS + handle = little_endian_read_16(packet, 3); btstack_linked_list_iterator_init(&it, &l2cap_le_channels); while (btstack_linked_list_iterator_has_next(&it)){ l2cap_channel_t * channel = (l2cap_channel_t *) btstack_linked_list_iterator_next(&it); From f22209df62951ebbb970879c69ffa7a3a7c0eac8 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 22 Dec 2016 22:46:20 +0100 Subject: [PATCH 4/4] fix unused params warnings --- src/l2cap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/l2cap.c b/src/l2cap.c index a0a8be304..3f1740f64 100644 --- a/src/l2cap.c +++ b/src/l2cap.c @@ -1088,7 +1088,8 @@ static void l2cap_hci_event_handler(uint8_t packet_type, uint16_t cid, uint8_t * UNUSED(address); UNUSED(hci_con_used); UNUSED(it); - + UNUSED(handle); + switch(hci_event_packet_get_type(packet)){ // Notify channel packet handler if they can send now