mirror of
https://github.com/akuker/RASCSI.git
synced 2024-09-29 13:54:48 +00:00
PbDevice returns information on whether a device is removable (#167)
* PbDevice returns information on whether a device is removable * Fixed log message
This commit is contained in:
parent
eeef537bc0
commit
1ba3b6a2f6
@ -950,7 +950,7 @@ void Disk::GetPath(Filepath& path) const
|
|||||||
// Flush
|
// Flush
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
BOOL Disk::Flush()
|
bool Disk::Flush()
|
||||||
{
|
{
|
||||||
// Do nothing if there's nothing cached
|
// Do nothing if there's nothing cached
|
||||||
if (!disk.dcache) {
|
if (!disk.dcache) {
|
||||||
|
@ -201,14 +201,14 @@ public:
|
|||||||
virtual BOOL Open(const Filepath& path, BOOL attn = TRUE); // Open
|
virtual BOOL Open(const Filepath& path, BOOL attn = TRUE); // Open
|
||||||
void GetPath(Filepath& path) const; // Get the path
|
void GetPath(Filepath& path) const; // Get the path
|
||||||
void Eject(BOOL force); // Eject
|
void Eject(BOOL force); // Eject
|
||||||
BOOL IsReady() const { return disk.ready; } // Ready check
|
bool IsReady() const { return disk.ready; } // Ready check
|
||||||
void WriteP(BOOL flag); // Set Write Protect flag
|
void WriteP(BOOL flag); // Set Write Protect flag
|
||||||
BOOL IsWriteP() const { return disk.writep; } // Get write protect flag
|
bool IsWriteP() const { return disk.writep; } // Get write protect flag
|
||||||
BOOL IsReadOnly() const { return disk.readonly; } // Get read only flag
|
bool IsReadOnly() const { return disk.readonly; } // Get read only flag
|
||||||
BOOL IsRemovable() const { return disk.removable; } // Get is removable flag
|
bool IsRemovable() const { return disk.removable; } // Get is removable flag
|
||||||
BOOL IsLocked() const { return disk.lock; } // Get locked status
|
bool IsLocked() const { return disk.lock; } // Get locked status
|
||||||
BOOL IsAttn() const { return disk.attn; } // Get attention flag
|
bool IsAttn() const { return disk.attn; } // Get attention flag
|
||||||
BOOL Flush(); // Flush the cache
|
bool Flush(); // Flush the cache
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
void SetLUN(DWORD lun) { disk.lun = lun; } // LUN set
|
void SetLUN(DWORD lun) { disk.lun = lun; } // LUN set
|
||||||
|
@ -291,6 +291,8 @@ PbDevices GetDevices() {
|
|||||||
device->set_file(pUnit->IsRemovable() && !pUnit->IsReady() ? "NO MEDIA" : filepath.GetPath());
|
device->set_file(pUnit->IsRemovable() && !pUnit->IsReady() ? "NO MEDIA" : filepath.GetPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device->set_removable(pUnit->IsRemovable());
|
||||||
|
|
||||||
// Write protection status
|
// Write protection status
|
||||||
if (pUnit->IsRemovable() && pUnit->IsReady() && pUnit->IsWriteP()) {
|
if (pUnit->IsRemovable() && pUnit->IsReady() && pUnit->IsWriteP()) {
|
||||||
device->set_read_only(true);
|
device->set_read_only(true);
|
||||||
@ -686,7 +688,7 @@ bool ProcessCmd(int fd, const PbCommand &command)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EJECT:
|
case EJECT:
|
||||||
LOGINFO("rasctl commands eject %s ID: %d UN: %d", type_str, id, un);
|
LOGINFO("rasctl commanded eject for %s ID: %d UN: %d", pUnit->GetID().c_str(), id, un);
|
||||||
pUnit->Eject(TRUE);
|
pUnit->Eject(TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ message PbDevice {
|
|||||||
int32 un = 2;
|
int32 un = 2;
|
||||||
string type = 3;
|
string type = 3;
|
||||||
string file = 4;
|
string file = 4;
|
||||||
bool read_only = 5;
|
bool removable = 5;
|
||||||
|
bool read_only = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PbDevices {
|
message PbDevices {
|
||||||
|
Loading…
Reference in New Issue
Block a user