Open Giotino opened 11 months ago
Thank you for the tips, indeed the SD detection requires some improvements. Updated here : https://github.com/schmurtzm/Onion-Desktop-Tools/commit/29710a2bde4e3fcbc78a56eb4555e54fa4816eac let me know if it's better for you.
While RMPARTUSB
seems to be a good software, wouldn't it be better to use something more PowerShell-style to do the enumeration and formatting of the drive?
The code below list all the USB Devices (https://learn.microsoft.com/en-us/powershell/module/storage/get-disk) (BusTypes https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddstor/ne-ntddstor-storage_bus_type)
$usbDevices = Get-Disk | Where-Object -FilterScript {$_.Bustype -Eq "USB" -Or $_.Bustype -Eq "SD" }
foreach ($device in $usbDevices) {
Write-Host "[$($device.Number)] $($device.Manufacturer) - $($device.Model) | Size: $($device.Size / 1GB) GB"
}
In my case
[4] TS-RDF5 - SD Transcend | Size: 119.375 GB
Then with the number we can format the drive
$usbDeviceNumber = 9999
Clear-Disk -Number $usbDeviceNumber -RemoveData -Confirm:$false
New-Partition -DiskNumber $usbDeviceNumber -UseMaximumSize
Format-Volume -DriveLetter (Get-Partition -DiskNumber $usbDeviceNumber).DriveLetter -FileSystem FAT32 -NewFileSystemLabel "OnionOS" -Confirm:$false
I would also recommend to double check the device serial number between the enumeration and the formatting because the user could have connected and disconnected some devices on its PC and we don't want to format a random drive.
Yes powershell can do that in an easier way but as ODT use RMPARTUSB to format the SD card in FAT32 it makes sense to see first if the SD card is well detected by this one first. Because no use to engage the user to a process where the SD card must be fomated if RMPARTUSB doesn't detect this one correctly. It could be an alternative for other tasks (like simple install, emulators and applications manager or checkdisk) which don't require any formating. However once the Regex will be good enough, it should be OK for most of the cases 🤞🏻
The Regex still doesn't work in my case because the firmware version (Fw
) is alphanumeric and not only numeric (TS37
).
Yes powershell can do that in an easier way but as ODT use RMPARTUSB to format the SD card in FAT32 it makes sense to see first if the SD card is well detected by this one first.
In my previous message I suggested to also use PowerShell to format the SD and since RMPARTUSB is only used to enumerate and format it should be no longer be necessary.
I see another "issue": the name RMPARTUSB suggest to me that it only detects USB, meanwhile with powershell SD and USB can be filtered.
Probably a different issue but related. My AZUS G14 (2022) laptop has a built in SD card reader, which is reasonable fast, so I use it rather than a USB stick. The Onions Tools can't detect it is available. I suspect outside the scope to read SD cards computer slots. Easy to work around use a USB SD card reader. Just reporting it if late decide to support built in SD card slots.
This regex fixed it for me. replace the to if statements in the Disk_Selector script.
if ($drive -match '*?DRIVE (\d+) -\s+([\d.]+[KMGTP]?iB)?\s+(.*?)\s+Fw=(\w+)\s+Sno=(\S+)\s+(\w):') {
My SD Card is not detected.
This is the output of
.\RMPARTUSB.exe LIST
:The regex at https://github.com/schmurtzm/Onion-Desktop-Tools/blob/a47445a8511b906a4af4147902e23d47ba157f4d/Disk_selector.ps1#L52 doesn't match the
@
in theSno
, I fixed it by replacing it withI don't know if
Sno
can contain more special characters.