feat: added Files app USB medium detection
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user