Bluedroid source - where to sind?

ESPI_1
Posts: 10
Joined: Thu Feb 27, 2020 7:08 am

Bluedroid source - where to sind?

Postby ESPI_1 » Fri Apr 03, 2020 4:27 am

Where can I find the Bluedroid source that is used by espressif?

looking in "esp_idf_Tools_V2_2\components\bt", I find only header files and libraries *.a

I want to find the error by myself in the source, otherwise I 100% depend on the help from the espressif-team

the Code in "bt_app_hf.c" seems buggy to me
- I believe this constellation is not fully tested
see the code-extract below
( Bluetooth Profile; Handfree Audiogateway SCO-path ==HCI)

- I found 3 jears old bugfixes of bluedroid in the web,
https://gitlab.com/Codeaurora/platform_ ... c7b9332b1a
that obviosly are not in the fixed in the current espressif version
( produce irritating ESP_LOGE Error-Messages, but not relevant)

  1. [b]CODE WITH BUGS!!![/b]
  2. static const int16_t sine_int16[] = {
  3.      0,    2057,    4107,    6140,    8149,   10126,   12062,   13952,   15786,   17557,
  4.  19260,   20886,   22431,   23886,   25247,   26509,   27666,   28714,   29648,   30466,
  5.  31163,   31738,   32187,   32509,   32702,   32767,   32702,   32509,   32187,   31738,
  6.  31163,   30466,   29648,   28714,   27666,   26509,   25247,   23886,   22431,   20886,
  7.  19260,   17557,   15786,   13952,   12062,   10126,    8149,    6140,    4107,    2057,
  8.      0,   -2057,   -4107,   -6140,   -8149,  -10126,  -12062,  -13952,  -15786,  -17557,
  9. -19260,  -20886,  -22431,  -23886,  -25247,  -26509,  -27666,  -28714,  -29648,  -30466,
  10. -31163,  -31738,  -32187,  -32509,  -32702,  -32767,  -32702,  -32509,  -32187,  -31738,
  11. -31163,  -30466,  -29648,  -28714,  -27666,  -26509,  -25247,  -23886,  -22431,  -20886,
  12. -19260,  -17557,  -15786,  -13952,  -12062,  -10126,   -8149,   -6140,   -4107,   -2057,
  13. };
  14.  
  15. #define TABLE_SIZE_CVSD   100
  16.  
  17. static uint32_t bt_app_hf_outgoing_cb(uint8_t *p_buf, uint32_t sz)
  18. {
  19. int sine_phase = esp_random();
  20.  
  21.     for (int i = 0; i < TABLE_SIZE_CVSD; i++) {[b]// BUG: Correct: sz   WRONG: ABLE_SIZE_CVSD[/b]
  22.         p_buf[i * 2]      = sine_int16[sine_phase]; [b]//BUG if sz is < 2*100, we access bejond the Buffer!!![/b]
  23.         p_buf[i * 2 + 1] = sine_int16[sine_phase];[b]//BUG; we do not use Highbyte of the Sinus!!![/b]
  24.         ++sine_phase;
  25.         if (sine_phase >= TABLE_SIZE_CVSD) {
  26.             sine_phase -= TABLE_SIZE_CVSD;
  27.         }
  28.     }
  29.     return sz; [b]//Bug: 200 Bytes are modified in buffer, not sz[/b]
  30. }


  1. [b]// Expected some Code like this - from bt_app_a2d example[/b]
  2. static int32_t bt_app_a2d_data_cb(uint8_t *data, int32_t len)
  3. {
  4.     if (len < 0 || data == NULL) {
  5.         return 0;
  6.     }
  7.  
  8.     // generate random sequence
  9.     int val = rand() % (1 << 16);
  10.     for (int i = 0; i < (len >> 1); i++) {
  11.         data[(i << 1)] = val & 0xff;
  12.         data[(i << 1) + 1] = (val >> 8) & 0xff;
  13.     }
  14.  
  15.     return len;
  16. }

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Bluedroid source - where to sind?

Postby ESP_igrr » Sun Apr 05, 2020 10:46 am

You can find Bluedroid code at https://github.com/espressif/esp-idf/tr ... /bluedroid (for the latest IDF master branch).

I'm afraid I don't recognize what "esp_idf_Tools_V2_2", but Bluedroid code in IDF is always distributed in source form.

Who is online

Users browsing this forum: ESP_ondrej and 86 guests