Compare commits

...

7 Commits

Author SHA1 Message Date
wizmo2
dc66d9e9dc Bluetooth Source mods (#204)
* support legacy bt pairing

* extend bt source support
2022-11-25 13:55:01 -05:00
Sebastien L
8462de1c16 Fix spotify configuration UI- release 2022-11-25 13:48:32 -05:00
Sébastien
37f48d4bc8 Align versionning in firmware - release 2022-11-24 10:07:13 -05:00
github-actions
ec019f98f3 Update prebuilt objects [skip actions] 2022-11-24 14:15:09 +00:00
Sebastien
5e5c7e0c80 Merge branch 'master-v4.3' of https://github.com/sle118/squeezelite-esp32 into master-v4.3 2022-11-24 09:07:45 -05:00
Sebastien
3144cf5f91 Change auth methods for pushing 2022-11-24 09:07:35 -05:00
github-actions
18cc0adfb4 Update prebuilt objects [skip actions] 2022-11-22 15:28:59 +00:00
29 changed files with 124 additions and 75 deletions

View File

@@ -65,7 +65,7 @@ jobs:
BUILD_NUMBER=${{ needs.job1.outputs.build_number }}
echo "BUILD_NUMBER=${BUILD_NUMBER}" >> $GITHUB_ENV
echo "DOCKER_IMAGE_NAME=sle118/squeezelite-esp32-idfv4-master" >> $GITHUB_ENV
tag="${TARGET_BUILD_NAME}.${{matrix.depth}}.${BUILD_NUMBER}.${branch_name}"
tag="${TARGET_BUILD_NAME}.${{matrix.depth}}.${build_version_prefix}${BUILD_NUMBER}.${branch_name}"
echo "tag=${tag}" >> $GITHUB_ENV
last_commit="$(git log --pretty=format:'%s' --max-count=1)"
if [[ "$last_commit" =~ .*"Release".* ]]; then echo "release_flag=1" >> $GITHUB_ENV; else echo "release_flag=0" >> $GITHUB_ENV; fi

View File

@@ -13,7 +13,7 @@ add_definitions(-DHIERARCHICAL_STATES=1)
#add_definitions(-DNETWORK_ETHERNET_LOG_LEVEL=ESP_LOG_DEBUG)
#uncomment line below to get network status debug logs
#add_definitions(-DNETWORK_STATUS_LOG_LEVEL=ESP_LOG_DEBUG)
#add_definitions(-DNETWORK_HANDLERS_LOG_LEVEL=ESP_LOG_DEBUG)
#add_definitions(-DNETWORK_HANDLERS_LOG_LEVEL=ESP_LOG_DEBUG)
#add_definitions(-DNETWORK_WIFI_LOG_LEVEL=ESP_LOG_DEBUG)
#add_definitions(-DNETWORK_MANAGER_LOG_LEVEL=ESP_LOG_DEBUG)
#add_definitions(-DNETWORK_HTTP_SERVER_LOG_LEVEL=ESP_LOG_DEBUG)

View File

@@ -90,6 +90,7 @@ RUN : \
&& pip show pygit2 \
&& python --version \
&& pip --version \
&& pip3 install protobuf grpcio-tools \
&& rm -rf $IDF_TOOLS_PATH/dist \
&& :

View File

@@ -83,25 +83,28 @@ static void bt_app_task_handler(void *arg)
esp_bt_controller_mem_release(ESP_BT_MODE_BLE);
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
if ((err = esp_bt_controller_init(&bt_cfg)) != ESP_OK) {
ESP_LOGE(TAG, "%s initialize controller failed: %s\n", __func__, esp_err_to_name(err));
goto exit;
}
if(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE ){
if ((err = esp_bt_controller_init(&bt_cfg)) != ESP_OK) {
ESP_LOGE(TAG, "%s initialize controller failed: %s\n", __func__, esp_err_to_name(err));
goto exit;
}
if ((err = esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT)) != ESP_OK) {
ESP_LOGE(TAG, "%s enable controller failed: %s\n", __func__, esp_err_to_name(err));
goto exit;
}
if ((err = esp_bt_controller_enable(ESP_BT_MODE_BTDM)) != ESP_OK) {
ESP_LOGE(TAG, "%s enable controller failed: %s\n", __func__, esp_err_to_name(err));
goto exit;
}
if ((err = esp_bluedroid_init()) != ESP_OK) {
ESP_LOGE(TAG, "%s initialize bluedroid failed: %s\n", __func__, esp_err_to_name(err));
goto exit;
}
if ((err = esp_bluedroid_init()) != ESP_OK) {
ESP_LOGE(TAG, "%s initialize bluedroid failed: %s\n", __func__, esp_err_to_name(err));
goto exit;
}
if ((err = esp_bluedroid_enable()) != ESP_OK) {
ESP_LOGE(TAG, "%s enable bluedroid failed: %s\n", __func__, esp_err_to_name(err));
goto exit;
if ((err = esp_bluedroid_enable()) != ESP_OK) {
ESP_LOGE(TAG, "%s enable bluedroid failed: %s\n", __func__, esp_err_to_name(err));
goto exit;
}
}
/* Bluetooth device name, connection mode and profile set up */
@@ -114,6 +117,14 @@ static void bt_app_task_handler(void *arg)
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
#endif
/*
* Set default parameters for Legacy Pairing
* Use variable pin, input pin code when pairing
*/
esp_bt_pin_type_t pin_type = ESP_BT_PIN_TYPE_VARIABLE;
esp_bt_pin_code_t pin_code;
esp_bt_gap_set_pin(pin_type, 0, pin_code);
running = true;
while (running) {

View File

@@ -672,9 +672,9 @@ static void filter_inquiry_scan_result(esp_bt_gap_cb_param_t *param)
ESP_LOGV(TAG,"--Invalid class of device. Skipping.\n");
return;
}
else if (!(esp_bt_gap_get_cod_srvc(cod) & ESP_BT_COD_SRVC_RENDERING))
else if (!(esp_bt_gap_get_cod_srvc(cod) & (ESP_BT_COD_SRVC_RENDERING | ESP_BT_COD_SRVC_AUDIO)))
{
ESP_LOGV(TAG,"--Not a rendering device. Skipping.\n");
ESP_LOGV(TAG,"--Not a rendering or audio device. Skipping.\n");
return;
}

View File

@@ -634,7 +634,7 @@ cJSON * config_alloc_get_cjson(const char *key){
}
return conf_json;
}
esp_err_t config_set_cjson_str(const char *key, cJSON *value){
esp_err_t config_set_cjson_str_and_free(const char *key, cJSON *value){
char * value_str = cJSON_PrintUnformatted(value);
if(value_str==NULL){
ESP_LOGE(TAG, "Unable to print cJSON for key [%s]", key);

View File

@@ -53,7 +53,7 @@ void config_init();
void * config_alloc_get_default(nvs_type_t type, const char *key, void * default_value, size_t blob_size);
void * config_alloc_get_str(const char *key, char *lead, char *fallback);
cJSON * config_alloc_get_cjson(const char *key);
esp_err_t config_set_cjson_str(const char *key, cJSON *value);
esp_err_t config_set_cjson_str_and_free(const char *key, cJSON *value);
void config_get_uint16t_from_str(const char *key, uint16_t *value, uint16_t default_value);
void config_delete_key(const char *key);
void config_set_default(nvs_type_t type, const char *key, void * default_value, size_t blob_size);

View File

@@ -593,7 +593,6 @@ static int is_valid_gpio_number(int gpio, const char * name, FILE *f, bool manda
return 0;
}
static int do_cspot_config(int argc, char **argv){
char * name = NULL;
int nerrors = arg_parse_msg(argc, argv,(struct arg_hdr **)&cspot_args);
if (nerrors != 0) {
return 1;
@@ -610,25 +609,30 @@ static int do_cspot_config(int argc, char **argv){
cJSON * cspot_config = config_alloc_get_cjson("cspot_config");
if(!cspot_config){
nerrors++;
fprintf(f,"error: Unable to get cspot config.\n");
fprintf(f,"error: Unable to get default cspot config.\n");
}
else {
cjson_update_string(&cspot_config,cspot_args.deviceName->hdr.longopts,cspot_args.deviceName->count>0?cspot_args.deviceName->sval[0]:NULL);
// cjson_update_number(&cspot_config,cspot_args.volume->hdr.longopts,cspot_args.volume->count>0?cspot_args.volume->ival[0]:0);
cjson_update_number(&cspot_config,cspot_args.bitrate->hdr.longopts,cspot_args.bitrate->count>0?cspot_args.bitrate->ival[0]:0);
if(cspot_args.deviceName->count>0){
cjson_update_string(&cspot_config,cspot_args.deviceName->hdr.longopts,cspot_args.deviceName->sval[0]);
}
if(cspot_args.bitrate->count>0){
cjson_update_number(&cspot_config,cspot_args.bitrate->hdr.longopts,cspot_args.bitrate->ival[0]);
}
if(!nerrors ){
fprintf(f,"Storing cspot parameters.\n");
nerrors+=(config_set_cjson_str("cspot_config",cspot_config) !=ESP_OK);
nerrors+=(config_set_cjson_str_and_free("cspot_config",cspot_config) !=ESP_OK);
}
if(nerrors==0){
fprintf(f,"Device name changed to %s\n",name);
if(nerrors==0 ){
if(cspot_args.deviceName->count>0){
fprintf(f,"Device name changed to %s\n",cspot_args.deviceName->sval[0]);
}
if(cspot_args.bitrate->count>0){
fprintf(f,"Bitrate changed to %u\n",cspot_args.bitrate->ival[0]);
}
}
if(!nerrors ){
fprintf(f,"Done.\n");
}
FREE_AND_NULL(name);
fflush (f);
cmd_send_messaging(argv[0],nerrors>0?MESSAGING_ERROR:MESSAGING_INFO,"%s", buf);
fclose(f);
@@ -761,10 +765,7 @@ cJSON * cspot_cb(){
if(cspot_values){
cJSON_AddNumberToObject(values,cspot_args.bitrate->hdr.longopts,cJSON_GetNumberValue(cspot_values));
}
// cspot_values = cJSON_GetObjectItem(cspot_config,cspot_args.volume->hdr.longopts);
// if(cspot_values){
// cJSON_AddNumberToObject(values,cspot_args.volume->hdr.longopts,cJSON_GetNumberValue(cspot_values));
// }
cJSON_Delete(cspot_config);
return values;
}

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -15,6 +15,8 @@ declare function getStatus(): {};
declare function getStatus(): {};
declare function getStatus(): {};
declare function getStatus(): {};
declare function getStatus(): {};
declare function getStatus(): {};
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
@@ -32,6 +34,10 @@ declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function pushStatus(): void;
declare function pushStatus(): void;
declare function pushStatus(): void;
declare function pushStatus(): void;
declare function pushStatus(): void;

View File

@@ -1,5 +1,5 @@
target_add_binary_data( __idf_wifi-manager webapp/dist/css/index.7964a13ec910c36040b8.css.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/favicon-32x32.png BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/index.html.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/js/index.9b00af.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/js/node_vendors.9b00af.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/js/index.fff661.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/js/node_vendors.fff661.bundle.js.gz BINARY)

View File

@@ -6,29 +6,29 @@ extern const uint8_t _favicon_32x32_png_start[] asm("_binary_favicon_32x32_png_s
extern const uint8_t _favicon_32x32_png_end[] asm("_binary_favicon_32x32_png_end");
extern const uint8_t _index_html_gz_start[] asm("_binary_index_html_gz_start");
extern const uint8_t _index_html_gz_end[] asm("_binary_index_html_gz_end");
extern const uint8_t _index_9b00af_bundle_js_gz_start[] asm("_binary_index_9b00af_bundle_js_gz_start");
extern const uint8_t _index_9b00af_bundle_js_gz_end[] asm("_binary_index_9b00af_bundle_js_gz_end");
extern const uint8_t _node_vendors_9b00af_bundle_js_gz_start[] asm("_binary_node_vendors_9b00af_bundle_js_gz_start");
extern const uint8_t _node_vendors_9b00af_bundle_js_gz_end[] asm("_binary_node_vendors_9b00af_bundle_js_gz_end");
extern const uint8_t _index_fff661_bundle_js_gz_start[] asm("_binary_index_fff661_bundle_js_gz_start");
extern const uint8_t _index_fff661_bundle_js_gz_end[] asm("_binary_index_fff661_bundle_js_gz_end");
extern const uint8_t _node_vendors_fff661_bundle_js_gz_start[] asm("_binary_node_vendors_fff661_bundle_js_gz_start");
extern const uint8_t _node_vendors_fff661_bundle_js_gz_end[] asm("_binary_node_vendors_fff661_bundle_js_gz_end");
const char * resource_lookups[] = {
"/css/index.7964a13ec910c36040b8.css.gz",
"/favicon-32x32.png",
"/index.html.gz",
"/js/index.9b00af.bundle.js.gz",
"/js/node_vendors.9b00af.bundle.js.gz",
"/js/index.fff661.bundle.js.gz",
"/js/node_vendors.fff661.bundle.js.gz",
""
};
const uint8_t * resource_map_start[] = {
_index_7964a13ec910c36040b8_css_gz_start,
_favicon_32x32_png_start,
_index_html_gz_start,
_index_9b00af_bundle_js_gz_start,
_node_vendors_9b00af_bundle_js_gz_start
_index_fff661_bundle_js_gz_start,
_node_vendors_fff661_bundle_js_gz_start
};
const uint8_t * resource_map_end[] = {
_index_7964a13ec910c36040b8_css_gz_end,
_favicon_32x32_png_end,
_index_html_gz_end,
_index_9b00af_bundle_js_gz_end,
_node_vendors_9b00af_bundle_js_gz_end
_index_fff661_bundle_js_gz_end,
_node_vendors_fff661_bundle_js_gz_end
};

View File

@@ -1,6 +1,6 @@
/***********************************
webpack_headers
dist/css/index.7964a13ec910c36040b8.css.gz,dist/favicon-32x32.png,dist/index.html.gz,dist/js/index.9b00af.bundle.js.gz,dist/js/node_vendors.9b00af.bundle.js.gz
dist/css/index.7964a13ec910c36040b8.css.gz,dist/favicon-32x32.png,dist/index.html.gz,dist/js/index.fff661.bundle.js.gz,dist/js/node_vendors.fff661.bundle.js.gz
***********************************/
#pragma once
#include <inttypes.h>

View File

@@ -517,7 +517,7 @@ class Releases():
print(f'Opening repository from {path}')
cls.repo = Repository(path=path)
except GitError as ex:
print_error(f"Unable to access the repository.\nContent of {path}:\n{NEWLINE_CHAR.join(get_file_list(path, 1))}")
print_error(f"Unable to access the repository({ex}).\nContent of {path}:\n{NEWLINE_CHAR.join(get_file_list(path, 1))}")
raise
return cls.repo
@@ -844,6 +844,14 @@ def get_changed_items(repo: Repository) -> Dict:
def is_dirty(repo: Repository) -> bool:
return len(get_changed_items(repo)) > 0
def push_with_method(auth_method:str,token:str,remote: Remote,reference):
success:bool = False
try:
remote.push(reference, callbacks=RemoteCallbacks(pygit2.UserPass(auth_method, token)))
success=True
except Exception as ex:
print_error(f'Error pushing with auth method {auth_method}: {ex}.')
return success
def push_if_change(repo: Repository, token: str, source_path: str, manif_json):
if is_dirty(repo):
@@ -861,15 +869,14 @@ def push_if_change(repo: Repository, token: str, source_path: str, manif_json):
origin: Remote = repo.remotes['origin']
print(
f'Pushing commit {format_commit(repo[commit])} to url {origin.url}')
credentials = UserPass(token, 'x-oauth-basic') # passing credentials
remote: Remote = repo.remotes['origin']
# remote.credentials = credentials
auth_method = 'x-access-token'
remote.push([reference], callbacks=RemoteCallbacks(
pygit2.UserPass(auth_method, token)))
print(
f'::notice Web installer updated for {format_artifact_from_manifest(manif_json)}')
auth_methods = ['x-access-token','x-oauth-basic']
for method in auth_methods:
if push_with_method('x-access-token', token, remote, [reference]):
print(f'::notice Web installer updated for {format_artifact_from_manifest(manif_json)}')
return
raise Exception('Unable to push web installer changes to installer repo')
else:
print(f'WARNING: No change found. Skipping update')

View File

@@ -281,28 +281,39 @@ void register_default_string_val(const char * key, char * value){
FREE_AND_NULL(existing);
}
void register_default_with_mac(const char* key, char* defval) {
char * alloc_get_string_with_mac(const char * val) {
uint8_t mac[6];
char macStr[LOCAL_MAC_SIZE + 1];
char* fullvalue = NULL;
esp_read_mac((uint8_t*)&mac, ESP_MAC_WIFI_STA);
snprintf(macStr, LOCAL_MAC_SIZE - 1, "-%x%x%x", mac[3], mac[4], mac[5]);
fullvalue = malloc_init_external(strlen(defval)+sizeof(macStr)+1);
fullvalue = malloc_init_external(strlen(val)+sizeof(macStr)+1);
if(fullvalue){
strcpy(fullvalue, defval);
strcpy(fullvalue, val);
strcat(fullvalue, macStr);
}
else {
ESP_LOGE(TAG,"Memory allocation failed when getting mac value for %s", val);
}
return fullvalue;
}
void register_default_with_mac(const char* key, char* defval) {
char * fullvalue=alloc_get_string_with_mac(defval);
if(fullvalue){
register_default_string_val(key,fullvalue);
FREE_AND_NULL(fullvalue);
}
else {
ESP_LOGE(TAG,"Memory allocation failed when registering default value for %s", key);
}
}
void register_default_nvs(){
#ifdef CONFIG_CSPOT_SINK
register_default_string_val("enable_cspot", STR(CONFIG_CSPOT_SINK));
#else
register_default_string_val("enable_cspot", "0");
#endif
#ifdef CONFIG_AIRPLAY_SINK
@@ -368,10 +379,23 @@ void register_default_nvs(){
register_default_string_val("ethtmout","8");
register_default_string_val("dhcp_tmout","8");
register_default_string_val("target", CONFIG_TARGET);
#ifdef CONFIG_CSPOT_SINK
register_default_string_val("enable_cspot", STR(CONFIG_CSPOT_SINK));
register_default_string_val("cspot_config", "");
#endif
cJSON * cspot_config=config_alloc_get_cjson("cspot_config");
if(!cspot_config){
char * name = alloc_get_string_with_mac(DEFAULT_HOST_NAME);
if(name){
cjson_update_string(&cspot_config,"deviceName",name);
cjson_update_number(&cspot_config,"bitrate",160);
// the call below saves the config and frees the json pointer
config_set_cjson_str_and_free("cspot_config",cspot_config);
FREE_AND_NULL(name);
}
else {
register_default_string_val("cspot_config", "");
}
}
wait_for_commit();
ESP_LOGD(TAG,"Done setting default values in nvs.");
}
@@ -523,8 +547,7 @@ void app_main()
network_register_state_callback(NETWORK_INITIALIZING_STATE,-1, "handle_ap_connect", &handle_ap_connect);
network_register_state_callback(NETWORK_ETH_ACTIVE_STATE,ETH_ACTIVE_LINKDOWN_STATE, "handle_network_up", &handle_network_up);
network_register_state_callback(NETWORK_WIFI_ACTIVE_STATE,WIFI_INITIALIZING_STATE, "handle_network_up", &handle_network_up);
MEMTRACE_PRINT_DELTA();
MEMTRACE_PRINT_DELTA();
}
MEMTRACE_PRINT_DELTA_MESSAGE("Starting Console");
console_start();

View File

@@ -134,7 +134,7 @@ buildMap(sdkconfig).then((sdkConfigResult ) => {
}
}
}
console.log(`\n\nproperties that are different between the 2 files \n**************************`);
console.log(`\n\nproperties that are different ${sdkconfig}<->${comparedFile} \n**************************`);
for (const prop in sdkconfigMap) {
entry = sdkconfigMap[prop];
if(entry.type==map_types.COMMENT) continue;
@@ -159,7 +159,7 @@ buildMap(sdkconfig).then((sdkConfigResult ) => {
}
});
console.log(`\n\${comparedFile} with missing properties\n**************************`);
console.log(`\n\n${comparedFile} with missing properties\n**************************`);
newlines.forEach(line => {
console.log(line);
});

Binary file not shown.

Binary file not shown.

BIN
server_certs/rootca1.cer.18 Normal file

Binary file not shown.

BIN
server_certs/rootca1.cer.19 Normal file

Binary file not shown.