mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-18 09:25:06 +00:00
* **New Features** * Added a HAL device module providing device enumeration, type queries and a HAL↔kernel bridge. * **Improvements** * Integrated HAL module into startup; standardized module names, includes and lifecycle logging; safer file append behavior; broader build support. * **API Changes** * Driver lifecycle now uses explicit add/remove semantics; C and HAL device type/lookup APIs clarified. * **Chores** * Added module README and Apache‑2.0 license; updated build configuration to include the new module. * **Fixes** * Updated tests and object file handling to behave correctly.
27 lines
621 B
C++
27 lines
621 B
C++
#include <tactility/hal/Device.h>
|
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
|
|
namespace tt::hal::sdcard {
|
|
|
|
std::shared_ptr<SdCardDevice> _Nullable find(const std::string& path) {
|
|
auto sdcards = findDevices<SdCardDevice>(Device::Type::SdCard);
|
|
for (auto& sdcard : sdcards) {
|
|
if (sdcard->isMounted() && path.starts_with(sdcard->getMountPath())) {
|
|
return sdcard;
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
std::shared_ptr<Lock> findSdCardLock(const std::string& path) {
|
|
auto sdcard = find(path);
|
|
if (sdcard != nullptr) {
|
|
return sdcard->getLock();
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
}
|