mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Implement USB device info in GUI.
This commit is contained in:
@@ -76,16 +76,50 @@
|
|||||||
<TextBox ID="txtScsiType" ReadOnly="True"/>
|
<TextBox ID="txtScsiType" ReadOnly="True"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayoutItem>
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<CheckBox ID="chkRemovable" Text="Removable media" Enabled="False"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<CheckBox ID="chkUsb" Text="Connected by USB" Enabled="False"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
</TabPage>
|
||||||
|
<TabPage ID="tabUsb" Text="USB" Visible="False">
|
||||||
|
<StackLayout Orientation="Vertical">
|
||||||
<StackLayoutItem HorizontalAlignment="Stretch">
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
<StackLayout Orientation="Horizontal">
|
<StackLayout Orientation="Horizontal">
|
||||||
<CheckBox ID="chkRemovable" Text="Removable media" Enabled="False"/>
|
<Label ID="lblUsbVendorId" Text="Device type"/>
|
||||||
|
<TextBox ID="txtUsbVendorId" ReadOnly="True"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayoutItem>
|
</StackLayoutItem>
|
||||||
<StackLayoutItem HorizontalAlignment="Stretch">
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
<StackLayout Orientation="Horizontal">
|
<StackLayout Orientation="Horizontal">
|
||||||
<CheckBox ID="chkUsb" Text="Connected by USB" Enabled="False"/>
|
<Label ID="lblUsbProductId" Text="Device type"/>
|
||||||
|
<TextBox ID="txtUsbProductId" ReadOnly="True"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayoutItem>
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Label ID="lblUsbManufacturer" Text="Device type"/>
|
||||||
|
<TextBox ID="txtUsbManufacturer" ReadOnly="True"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Label ID="lblUsbProduct" Text="Device type"/>
|
||||||
|
<TextBox ID="txtUsbProduct" ReadOnly="True"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Label ID="lblUsbSerial" Text="Device type"/>
|
||||||
|
<TextBox ID="txtUsbSerial" ReadOnly="True"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Right">
|
||||||
|
<Button Text="Save descriptors to file" Click="OnBtnSaveUsbDescriptors"
|
||||||
|
ID="btnSaveUsbDescriptors"/>
|
||||||
|
</StackLayoutItem>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</TabPage>
|
</TabPage>
|
||||||
<TabPage ID="tabAta" Text="ATA/ATAPI" Visible="False">
|
<TabPage ID="tabAta" Text="ATA/ATAPI" Visible="False">
|
||||||
|
|||||||
@@ -65,6 +65,17 @@ namespace DiscImageChef.Gui
|
|||||||
chkRemovable.Checked = devInfo.IsRemovable;
|
chkRemovable.Checked = devInfo.IsRemovable;
|
||||||
chkUsb.Checked = devInfo.IsUsb;
|
chkUsb.Checked = devInfo.IsUsb;
|
||||||
|
|
||||||
|
if(devInfo.IsUsb)
|
||||||
|
{
|
||||||
|
tabUsb.Visible = true;
|
||||||
|
btnSaveUsbDescriptors.Enabled = devInfo.UsbDescriptors != null;
|
||||||
|
txtUsbVendorId.Text = $"{devInfo.UsbVendorId:X4}";
|
||||||
|
txtUsbProductId.Text = $"{devInfo.UsbProductId:X4}";
|
||||||
|
txtUsbManufacturer.Text = devInfo.UsbManufacturerString;
|
||||||
|
txtUsbProduct.Text = devInfo.UsbProductString;
|
||||||
|
txtUsbSerial.Text = devInfo.UsbSerialString;
|
||||||
|
}
|
||||||
|
|
||||||
if(devInfo.AtaIdentify != null || devInfo.AtapiIdentify != null)
|
if(devInfo.AtaIdentify != null || devInfo.AtapiIdentify != null)
|
||||||
{
|
{
|
||||||
tabAta.Visible = true;
|
tabAta.Visible = true;
|
||||||
@@ -1044,25 +1055,25 @@ namespace DiscImageChef.Gui
|
|||||||
if(devInfo.CID != null)
|
if(devInfo.CID != null)
|
||||||
{
|
{
|
||||||
txtCid.Visible = true;
|
txtCid.Visible = true;
|
||||||
txtCid.Text = Decoders.MMC.Decoders.PrettifyCID(devInfo.CID);
|
txtCid.Text = Decoders.MMC.Decoders.PrettifyCID(devInfo.CID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(devInfo.CSD != null)
|
if(devInfo.CSD != null)
|
||||||
{
|
{
|
||||||
txtCsd.Visible = true;
|
txtCsd.Visible = true;
|
||||||
txtCid.Text = Decoders.MMC.Decoders.PrettifyCSD(devInfo.CSD);
|
txtCid.Text = Decoders.MMC.Decoders.PrettifyCSD(devInfo.CSD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(devInfo.OCR != null)
|
if(devInfo.OCR != null)
|
||||||
{
|
{
|
||||||
txtOcr.Visible = true;
|
txtOcr.Visible = true;
|
||||||
txtCid.Text = Decoders.MMC.Decoders.PrettifyOCR(devInfo.OCR);
|
txtCid.Text = Decoders.MMC.Decoders.PrettifyOCR(devInfo.OCR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(devInfo.ExtendedCSD != null)
|
if(devInfo.ExtendedCSD != null)
|
||||||
{
|
{
|
||||||
txtExtendedCsd.Visible = true;
|
txtExtendedCsd.Visible = true;
|
||||||
txtCid.Text = Decoders.MMC.Decoders.PrettifyExtendedCSD(devInfo.ExtendedCSD);
|
txtCid.Text = Decoders.MMC.Decoders.PrettifyExtendedCSD(devInfo.ExtendedCSD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1086,22 +1097,20 @@ namespace DiscImageChef.Gui
|
|||||||
if(devInfo.OCR != null)
|
if(devInfo.OCR != null)
|
||||||
{
|
{
|
||||||
txtOcr.Visible = true;
|
txtOcr.Visible = true;
|
||||||
txtCid.Text = Decoders.SecureDigital.Decoders.PrettifyOCR(devInfo.OCR);
|
txtCid.Text = Decoders.SecureDigital.Decoders.PrettifyOCR(devInfo.OCR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(devInfo.SCR != null)
|
if(devInfo.SCR != null)
|
||||||
{
|
{
|
||||||
txtScr.Visible = true;
|
txtScr.Visible = true;
|
||||||
txtCid.Text = Decoders.SecureDigital.Decoders.PrettifySCR(devInfo.SCR);
|
txtCid.Text = Decoders.SecureDigital.Decoders.PrettifySCR(devInfo.SCR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tabSecureDigital.Visible = txtCid.Visible || txtCsd.Visible || txtOcr.Visible || txtExtendedCsd.Visible ||
|
tabSecureDigital.Visible = txtCid.Visible || txtCsd.Visible || txtOcr.Visible || txtExtendedCsd.Visible ||
|
||||||
txtScr.Visible;
|
txtScr.Visible;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnBtnSaveAtaBinary(object sender, EventArgs e)
|
protected void OnBtnSaveAtaBinary(object sender, EventArgs e)
|
||||||
@@ -1241,6 +1250,20 @@ namespace DiscImageChef.Gui
|
|||||||
saveFs.Close();
|
saveFs.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void OnBtnSaveUsbDescriptors(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SaveFileDialog dlgSaveBinary = new SaveFileDialog();
|
||||||
|
dlgSaveBinary.Filters.Add(new FileFilter {Extensions = new[] {"*.bin"}, Name = "Binary"});
|
||||||
|
DialogResult result = dlgSaveBinary.ShowDialog(this);
|
||||||
|
|
||||||
|
if(result != DialogResult.Ok) return;
|
||||||
|
|
||||||
|
FileStream saveFs = new FileStream(dlgSaveBinary.FileName, FileMode.Create);
|
||||||
|
saveFs.Write(devInfo.UsbDescriptors, 0, devInfo.UsbDescriptors.Length);
|
||||||
|
|
||||||
|
saveFs.Close();
|
||||||
|
}
|
||||||
|
|
||||||
#region XAML controls
|
#region XAML controls
|
||||||
#pragma warning disable 169
|
#pragma warning disable 169
|
||||||
#pragma warning disable 649
|
#pragma warning disable 649
|
||||||
@@ -1366,17 +1389,29 @@ namespace DiscImageChef.Gui
|
|||||||
Label lblMediumTypes;
|
Label lblMediumTypes;
|
||||||
TextArea txtMediumTypes;
|
TextArea txtMediumTypes;
|
||||||
TextArea txtMediumDensity;
|
TextArea txtMediumDensity;
|
||||||
TabPage tabSecureDigital;
|
TabPage tabSecureDigital;
|
||||||
TabPage tabCid;
|
TabPage tabCid;
|
||||||
TextArea txtCid;
|
TextArea txtCid;
|
||||||
TabPage tabCsd;
|
TabPage tabCsd;
|
||||||
TextArea txtCsd;
|
TextArea txtCsd;
|
||||||
TabPage tabOcr;
|
TabPage tabOcr;
|
||||||
TextArea txtOcr;
|
TextArea txtOcr;
|
||||||
TabPage tabExtendedCsd;
|
TabPage tabExtendedCsd;
|
||||||
TextArea txtExtendedCsd;
|
TextArea txtExtendedCsd;
|
||||||
TabPage tabScr;
|
TabPage tabScr;
|
||||||
TextArea txtScr;
|
TextArea txtScr;
|
||||||
|
TabPage tabUsb;
|
||||||
|
Label lblUsbVendorId;
|
||||||
|
TextBox txtUsbVendorId;
|
||||||
|
Label lblUsbProductId;
|
||||||
|
TextBox txtUsbProductId;
|
||||||
|
Label lblUsbManufacturer;
|
||||||
|
TextBox txtUsbManufacturer;
|
||||||
|
Label lblUsbProduct;
|
||||||
|
TextBox txtUsbProduct;
|
||||||
|
Label lblUsbSerial;
|
||||||
|
TextBox txtUsbSerial;
|
||||||
|
Button btnSaveUsbDescriptors;
|
||||||
#pragma warning restore 169
|
#pragma warning restore 169
|
||||||
#pragma warning restore 649
|
#pragma warning restore 649
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user