mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Device: Find the VSA offset for Disk::Access::EntireDisk
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "icsneo/communication/command.h"
|
||||
#include "icsneo/device/extensions/deviceextension.h"
|
||||
#include "icsneo/platform/optional.h"
|
||||
#include "icsneo/disk/fat.h"
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -532,6 +533,20 @@ optional<uint64_t> Device::getLogicalDiskSize() {
|
||||
return info->getReportedSize();
|
||||
}
|
||||
|
||||
optional<uint64_t> Device::getVSAOffsetInLogicalDisk() {
|
||||
if(!isOpen()) {
|
||||
report(APIEvent::Type::DeviceCurrentlyClosed, APIEvent::Severity::Error);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (diskReadDriver->getAccess() == Disk::Access::VSA || diskReadDriver->getAccess() == Disk::Access::None)
|
||||
return 0ull;
|
||||
|
||||
return Disk::FindVSAInFAT([this](uint64_t pos, uint8_t *into, uint64_t amount) {
|
||||
return readLogicalDisk(pos, into, amount);
|
||||
});
|
||||
}
|
||||
|
||||
optional<bool> Device::getDigitalIO(IO type, size_t number /* = 1 */) {
|
||||
if(number == 0) { // Start counting from 1
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
|
||||
Reference in New Issue
Block a user