feat: added Files app USB medium detection

This commit is contained in:
2026-05-18 20:00:42 +02:00
parent 2ceefaf1ca
commit 47e3bb54a5
14 changed files with 50 additions and 2 deletions
+9
View File
@@ -7,6 +7,8 @@
#pragma once
#include <Fs/Vfs.hpp>
#include <Fs/FsProbe.hpp>
#include <Drivers/Storage/BlockDevice.hpp>
#include <Sched/Scheduler.hpp>
#include <Memory/PageFrameAllocator.hpp>
#include <Memory/HHDM.hpp>
@@ -126,4 +128,11 @@ namespace Montauk {
static int Sys_DriveLabel(int driveNumber, char* outLabel, int maxLen) {
return Fs::Vfs::VfsDriveLabel(driveNumber, outLabel, maxLen);
}
static int Sys_DriveKind(int driveNumber) {
int blockDev = Fs::FsProbe::GetBlockDeviceForDrive(driveNumber);
if (blockDev < 0) return 0;
auto* dev = Drivers::Storage::GetBlockDevice(blockDev);
return dev ? (int)dev->Kind : 0;
}
};
+2
View File
@@ -217,6 +217,8 @@ namespace Montauk {
if ((int64_t)frame->arg3 <= 0) return -1;
if (!UserMemory::Range(frame->arg2, frame->arg3, true)) return -1;
return (int64_t)Sys_DriveLabel((int)frame->arg1, (char*)frame->arg2, (int)frame->arg3);
case SYS_DRIVEKIND:
return (int64_t)Sys_DriveKind((int)frame->arg1);
case SYS_TERMSCALE:
return Sys_TermScale(frame->arg1, frame->arg2);
case SYS_RESOLVE:
+1
View File
@@ -225,6 +225,7 @@ namespace Montauk {
/* Filesystem.hpp */
static constexpr uint64_t SYS_DRIVELABEL = 124;
static constexpr uint64_t SYS_DRIVEKIND = 127;
/* Net.hpp */
static constexpr uint64_t SYS_NETSTATUS = 125;