Fix returning from remote commands.

This commit is contained in:
2019-10-19 18:28:05 +01:00
parent 79c952d1ff
commit ee3702e44d
4 changed files with 21 additions and 15 deletions

View File

@@ -86,7 +86,12 @@ namespace DiscImageChef.Devices
uint timeout, bool transferBlocks, uint timeout, bool transferBlocks,
out double duration, out bool sense) out double duration, out bool sense)
{ {
if (!(remote is null)) throw new NotImplementedException("Remote CHS ATA commands not yet implemented..."); if (!(remote is null))
return remote.SendAtaCommand(registers, out errorRegisters,
protocol, transferRegister,
ref buffer,
timeout, transferBlocks,
out duration, out sense);
return Command.SendAtaCommand(PlatformId, FileHandle, registers, out errorRegisters, protocol, return Command.SendAtaCommand(PlatformId, FileHandle, registers, out errorRegisters, protocol,
transferRegister, transferRegister,
@@ -116,7 +121,7 @@ namespace DiscImageChef.Devices
out double duration, out bool sense) out double duration, out bool sense)
{ {
if (!(remote is null)) if (!(remote is null))
remote.SendAtaCommand(registers, out errorRegisters, return remote.SendAtaCommand(registers, out errorRegisters,
protocol, transferRegister, protocol, transferRegister,
ref buffer, ref buffer,
timeout, transferBlocks, timeout, transferBlocks,
@@ -150,7 +155,7 @@ namespace DiscImageChef.Devices
out double duration, out bool sense) out double duration, out bool sense)
{ {
if (!(remote is null)) if (!(remote is null))
remote.SendAtaCommand(registers, out errorRegisters, return remote.SendAtaCommand(registers, out errorRegisters,
protocol, transferRegister, protocol, transferRegister,
ref buffer, ref buffer,
timeout, transferBlocks, timeout, transferBlocks,
@@ -232,7 +237,7 @@ namespace DiscImageChef.Devices
} }
if (!(remote is null)) if (!(remote is null))
remote.SendMmcCommand(command, write, isApplication, flags, return remote.SendMmcCommand(command, write, isApplication, flags,
argument, argument,
blockSize, blocks, ref buffer, out response, blockSize, blocks, ref buffer, out response,
out duration, out sense, timeout); out duration, out sense, timeout);

View File

@@ -578,7 +578,7 @@ namespace DiscImageChef.Devices
if (!(remote is null)) if (!(remote is null))
{ {
if (remote.GetFirewireData(out firewireVendor, out firewireModel, if (remote.GetFireWireData(out firewireVendor, out firewireModel,
out firewireGuid, out var remoteFireWireVendorName, out var remoteFireWireModelName)) out firewireGuid, out var remoteFireWireVendorName, out var remoteFireWireModelName))
{ {
IsFireWire = true; IsFireWire = true;
@@ -656,7 +656,7 @@ namespace DiscImageChef.Devices
#region PCMCIA #region PCMCIA
if(remote is null) if (remote is null)
{ {
if (PlatformId == PlatformID.Linux) if (PlatformId == PlatformID.Linux)
{ {

View File

@@ -248,9 +248,9 @@ namespace DiscImageChef.Devices.Remote
return devices.ToArray(); return devices.ToArray();
} }
public bool Open(string devicePath, out int LastError) public bool Open(string devicePath, out int lastError)
{ {
LastError = 0; lastError = 0;
var cmdPkt = new DicPacketCommandOpenDevice var cmdPkt = new DicPacketCommandOpenDevice
{ {
@@ -271,7 +271,7 @@ namespace DiscImageChef.Devices.Remote
if (len != buf.Length) if (len != buf.Length)
{ {
DicConsole.ErrorWriteLine("Could not write to the network..."); DicConsole.ErrorWriteLine("Could not write to the network...");
LastError = -1; lastError = -1;
return false; return false;
} }
@@ -282,7 +282,7 @@ namespace DiscImageChef.Devices.Remote
if (len < hdrBuf.Length) if (len < hdrBuf.Length)
{ {
DicConsole.ErrorWriteLine("Could not read from the network..."); DicConsole.ErrorWriteLine("Could not read from the network...");
LastError = -1; lastError = -1;
return false; return false;
} }
@@ -291,7 +291,7 @@ namespace DiscImageChef.Devices.Remote
if (hdr.id != Consts.PacketId) if (hdr.id != Consts.PacketId)
{ {
DicConsole.ErrorWriteLine("Received data is not a DIC Remote Packet..."); DicConsole.ErrorWriteLine("Received data is not a DIC Remote Packet...");
LastError = -1; lastError = -1;
return false; return false;
} }
@@ -299,7 +299,7 @@ namespace DiscImageChef.Devices.Remote
{ {
DicConsole.ErrorWriteLine("Expected List Devices Response Packet, got packet type {0}...", DicConsole.ErrorWriteLine("Expected List Devices Response Packet, got packet type {0}...",
hdr.packetType); hdr.packetType);
LastError = -1; lastError = -1;
return false; return false;
} }
@@ -309,7 +309,7 @@ namespace DiscImageChef.Devices.Remote
if (len < buf.Length) if (len < buf.Length)
{ {
DicConsole.ErrorWriteLine("Could not read from the network..."); DicConsole.ErrorWriteLine("Could not read from the network...");
LastError = -1; lastError = -1;
return false; return false;
} }
@@ -324,7 +324,7 @@ namespace DiscImageChef.Devices.Remote
} }
DicConsole.ErrorWriteLine($"{nop.reason}"); DicConsole.ErrorWriteLine($"{nop.reason}");
LastError = nop.errno; lastError = nop.errno;
return false; return false;
} }
@@ -1038,7 +1038,7 @@ namespace DiscImageChef.Devices.Remote
return true; return true;
} }
public bool GetFirewireData(out uint idVendor, out uint idProduct, public bool GetFireWireData(out uint idVendor, out uint idProduct,
out ulong guid, out string vendor, out string model) out ulong guid, out string vendor, out string model)
{ {
idVendor = 0; idVendor = 0;

View File

@@ -188,5 +188,6 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=PCMCIA/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=PCMCIA/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Portillo/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Portillo/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Reiser/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Reiser/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=SDHCI/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=umounting/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=umounting/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xeto/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> <s:Boolean x:Key="/Default/UserDictionary/Words/=xeto/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>