mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-17 02:45:05 +00:00
Fixes
This commit is contained in:
parent
15735af476
commit
4022f206e4
7
.github/actions/build-simulator/action.yml
vendored
7
.github/actions/build-simulator/action.yml
vendored
@ -40,6 +40,13 @@ runs:
|
|||||||
uses: jwlawson/actions-setup-cmake@v2
|
uses: jwlawson/actions-setup-cmake@v2
|
||||||
with:
|
with:
|
||||||
cmake-version: '3.31.x'
|
cmake-version: '3.31.x'
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
- name: Install mbedtls codegen Python dependencies
|
||||||
|
shell: bash
|
||||||
|
run: pip install -r Libraries/mbedtls/scripts/driver.requirements.txt
|
||||||
- name: "Prepare Project"
|
- name: "Prepare Project"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake -S ./ -B buildsim
|
run: cmake -S ./ -B buildsim
|
||||||
|
|||||||
@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES source/*.c*)
|
|||||||
idf_component_register(
|
idf_component_register(
|
||||||
SRCS ${SOURCE_FILES}
|
SRCS ${SOURCE_FILES}
|
||||||
INCLUDE_DIRS "source"
|
INCLUDE_DIRS "source"
|
||||||
REQUIRES TactilityKernel TactilityFreeRtos bq24295-module driver
|
REQUIRES TactilityKernel TactilityFreeRtos bq24295-module driver esp_driver_gpio
|
||||||
)
|
)
|
||||||
|
|||||||
@ -156,19 +156,17 @@ static void getKey(uint8_t key[32]) {
|
|||||||
// psa_crypto_init() is safe to call more than once (subsequent calls are a cheap no-op); ESP-IDF
|
// psa_crypto_init() is safe to call more than once (subsequent calls are a cheap no-op); ESP-IDF
|
||||||
// calls it during startup already, but the simulator has no equivalent, so call it here too
|
// calls it during startup already, but the simulator has no equivalent, so call it here too
|
||||||
// rather than depend on init order across callers.
|
// rather than depend on init order across callers.
|
||||||
static void ensure_psa_crypto_init() {
|
static psa_status_t ensure_psa_crypto_init() {
|
||||||
static bool initialized = false;
|
return psa_crypto_init();
|
||||||
if (!initialized) {
|
|
||||||
psa_crypto_init();
|
|
||||||
initialized = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypt_get_iv(const void* data, size_t dataLength, uint8_t iv[16]) {
|
void crypt_get_iv(const void* data, size_t dataLength, uint8_t iv[16]) {
|
||||||
ensure_psa_crypto_init();
|
check(ensure_psa_crypto_init() == PSA_SUCCESS);
|
||||||
uint8_t hash[32];
|
uint8_t hash[32];
|
||||||
size_t hash_length;
|
size_t hash_length;
|
||||||
psa_hash_compute(PSA_ALG_SHA_256, static_cast<const uint8_t*>(data), dataLength, hash, sizeof(hash), &hash_length);
|
check(psa_hash_compute(PSA_ALG_SHA_256, static_cast<const uint8_t*>(data),
|
||||||
|
dataLength, hash, sizeof(hash), &hash_length) == PSA_SUCCESS);
|
||||||
|
check(hash_length == sizeof(hash));
|
||||||
memcpy(iv, hash, 16);
|
memcpy(iv, hash, 16);
|
||||||
mbedtls_platform_zeroize(hash, sizeof(hash));
|
mbedtls_platform_zeroize(hash, sizeof(hash));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -688,13 +688,22 @@ static void dispatch_enable(BleCtx* ctx) {
|
|||||||
}
|
}
|
||||||
esp_hosted_bt_host_stack_cfg_t hosted_bt_cfg = ESP_HOSTED_BT_HOST_STACK_CONFIG_DEFAULT();
|
esp_hosted_bt_host_stack_cfg_t hosted_bt_cfg = ESP_HOSTED_BT_HOST_STACK_CONFIG_DEFAULT();
|
||||||
if (esp_hosted_bt_host_stack_setup(&hosted_bt_cfg) != ESP_OK) {
|
if (esp_hosted_bt_host_stack_setup(&hosted_bt_cfg) != ESP_OK) {
|
||||||
LOG_W(TAG, "esp_hosted_bt_host_stack_setup failed");
|
LOG_E(TAG, "esp_hosted_bt_host_stack_setup failed");
|
||||||
|
ctx->radio_state.store(BT_RADIO_STATE_OFF);
|
||||||
|
struct BtEvent e = {};
|
||||||
|
e.type = BT_EVENT_RADIO_STATE_CHANGED;
|
||||||
|
e.radio_state = BT_RADIO_STATE_OFF;
|
||||||
|
ble_publish_event(ctx->device, e);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int rc = nimble_port_init();
|
int rc = nimble_port_init();
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
LOG_E(TAG, "nimble_port_init failed (rc=%d)", rc);
|
LOG_E(TAG, "nimble_port_init failed (rc=%d)", rc);
|
||||||
|
#if defined(CONFIG_ESP_HOSTED_HOST)
|
||||||
|
esp_hosted_bt_host_stack_teardown();
|
||||||
|
#endif
|
||||||
ctx->radio_state.store(BT_RADIO_STATE_OFF);
|
ctx->radio_state.store(BT_RADIO_STATE_OFF);
|
||||||
struct BtEvent e = {};
|
struct BtEvent e = {};
|
||||||
e.type = BT_EVENT_RADIO_STATE_CHANGED;
|
e.type = BT_EVENT_RADIO_STATE_CHANGED;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
|
|
||||||
|
#include <cerrno>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -195,7 +196,10 @@ static bool findOrCreateDirectoryInternal(const std::string& path, mode_t mode)
|
|||||||
return S_ISDIR(dir_stat.st_mode);
|
return S_ISDIR(dir_stat.st_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mkdir(path.c_str(), mode) == 0;
|
if (mkdir(path.c_str(), mode) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return errno == EEXIST && stat(path.c_str(), &dir_stat) == 0 && S_ISDIR(dir_stat.st_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getLastPathSegment(const std::string& path) {
|
std::string getLastPathSegment(const std::string& path) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user