mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Implemente remote Get PCMCIA Data packet.
This commit is contained in:
@@ -656,6 +656,8 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
#region PCMCIA
|
#region PCMCIA
|
||||||
|
|
||||||
|
if(remote is null)
|
||||||
|
{
|
||||||
if (PlatformId == PlatformID.Linux)
|
if (PlatformId == PlatformID.Linux)
|
||||||
{
|
{
|
||||||
if (devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
if (devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||||
@@ -702,6 +704,15 @@ namespace DiscImageChef.Devices
|
|||||||
{
|
{
|
||||||
IsPcmcia = false;
|
IsPcmcia = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (remote.GetPcmciaData(out var cisBuf))
|
||||||
|
{
|
||||||
|
IsPcmcia = true;
|
||||||
|
Cis = cisBuf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion PCMCIA
|
#endregion PCMCIA
|
||||||
|
|
||||||
|
|||||||
@@ -751,7 +751,7 @@ namespace DiscImageChef.Devices.Remote
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr.packetType != DicPacketType.ResponseGetUsbData)
|
if (hdr.packetType != DicPacketType.ResponseGetFireWireData)
|
||||||
{
|
{
|
||||||
DicConsole.ErrorWriteLine("Expected FireWire Data Response Packet, got packet type {0}...",
|
DicConsole.ErrorWriteLine("Expected FireWire Data Response Packet, got packet type {0}...",
|
||||||
hdr.packetType);
|
hdr.packetType);
|
||||||
@@ -783,7 +783,71 @@ namespace DiscImageChef.Devices.Remote
|
|||||||
|
|
||||||
public bool GetPcmciaData(out byte[] cis)
|
public bool GetPcmciaData(out byte[] cis)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException("Getting PCMCIA data not yet implemented...");
|
cis = null;
|
||||||
|
|
||||||
|
var cmdPkt = new DicPacketCmdGetPcmciaData()
|
||||||
|
{
|
||||||
|
hdr = new DicPacketHeader
|
||||||
|
{
|
||||||
|
id = Consts.PacketId,
|
||||||
|
len = (uint) Marshal.SizeOf<DicPacketCmdGetPcmciaData>(),
|
||||||
|
version = Consts.PacketVersion,
|
||||||
|
packetType = DicPacketType.CommandGetPcmciaData
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var buf = Marshal.StructureToByteArrayLittleEndian(cmdPkt);
|
||||||
|
|
||||||
|
var len = _socket.Send(buf, SocketFlags.None);
|
||||||
|
|
||||||
|
if (len != buf.Length)
|
||||||
|
{
|
||||||
|
DicConsole.ErrorWriteLine("Could not write to the network...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hdrBuf = new byte[Marshal.SizeOf<DicPacketHeader>()];
|
||||||
|
|
||||||
|
len = _socket.Receive(hdrBuf, hdrBuf.Length, SocketFlags.Peek);
|
||||||
|
|
||||||
|
if (len < hdrBuf.Length)
|
||||||
|
{
|
||||||
|
DicConsole.ErrorWriteLine("Could not read from the network...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hdr = Marshal.ByteArrayToStructureLittleEndian<DicPacketHeader>(hdrBuf);
|
||||||
|
|
||||||
|
if (hdr.id != Consts.PacketId)
|
||||||
|
{
|
||||||
|
DicConsole.ErrorWriteLine("Received data is not a DIC Remote Packet...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hdr.packetType != DicPacketType.ResponseGetPcmciaData)
|
||||||
|
{
|
||||||
|
DicConsole.ErrorWriteLine("Expected PCMCIA Data Response Packet, got packet type {0}...",
|
||||||
|
hdr.packetType);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = new byte[hdr.len];
|
||||||
|
len = _socket.Receive(buf, buf.Length, SocketFlags.None);
|
||||||
|
|
||||||
|
if (len < buf.Length)
|
||||||
|
{
|
||||||
|
DicConsole.ErrorWriteLine("Could not read from the network...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var res = Marshal.ByteArrayToStructureLittleEndian<DicPacketResGetPcmciaData>(buf);
|
||||||
|
|
||||||
|
if (!res.isPcmcia)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
cis = res.cis;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user