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)
- [b]CODE WITH BUGS!!![/b]
- static const int16_t sine_int16[] = {
- 0, 2057, 4107, 6140, 8149, 10126, 12062, 13952, 15786, 17557,
- 19260, 20886, 22431, 23886, 25247, 26509, 27666, 28714, 29648, 30466,
- 31163, 31738, 32187, 32509, 32702, 32767, 32702, 32509, 32187, 31738,
- 31163, 30466, 29648, 28714, 27666, 26509, 25247, 23886, 22431, 20886,
- 19260, 17557, 15786, 13952, 12062, 10126, 8149, 6140, 4107, 2057,
- 0, -2057, -4107, -6140, -8149, -10126, -12062, -13952, -15786, -17557,
- -19260, -20886, -22431, -23886, -25247, -26509, -27666, -28714, -29648, -30466,
- -31163, -31738, -32187, -32509, -32702, -32767, -32702, -32509, -32187, -31738,
- -31163, -30466, -29648, -28714, -27666, -26509, -25247, -23886, -22431, -20886,
- -19260, -17557, -15786, -13952, -12062, -10126, -8149, -6140, -4107, -2057,
- };
- #define TABLE_SIZE_CVSD 100
- static uint32_t bt_app_hf_outgoing_cb(uint8_t *p_buf, uint32_t sz)
- {
- int sine_phase = esp_random();
- for (int i = 0; i < TABLE_SIZE_CVSD; i++) {[b]// BUG: Correct: sz WRONG: ABLE_SIZE_CVSD[/b]
- p_buf[i * 2] = sine_int16[sine_phase]; [b]//BUG if sz is < 2*100, we access bejond the Buffer!!![/b]
- p_buf[i * 2 + 1] = sine_int16[sine_phase];[b]//BUG; we do not use Highbyte of the Sinus!!![/b]
- ++sine_phase;
- if (sine_phase >= TABLE_SIZE_CVSD) {
- sine_phase -= TABLE_SIZE_CVSD;
- }
- }
- return sz; [b]//Bug: 200 Bytes are modified in buffer, not sz[/b]
- }
- [b]// Expected some Code like this - from bt_app_a2d example[/b]
- static int32_t bt_app_a2d_data_cb(uint8_t *data, int32_t len)
- {
- if (len < 0 || data == NULL) {
- return 0;
- }
- // generate random sequence
- int val = rand() % (1 << 16);
- for (int i = 0; i < (len >> 1); i++) {
- data[(i << 1)] = val & 0xff;
- data[(i << 1) + 1] = (val >> 8) & 0xff;
- }
- return len;
- }