Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SD Card not detected #3

Open
Giotino opened this issue Dec 6, 2023 · 6 comments
Open

SD Card not detected #3

Giotino opened this issue Dec 6, 2023 · 6 comments

Comments

@Giotino
Copy link

Giotino commented Dec 6, 2023

My SD Card is not detected.

This is the output of .\RMPARTUSB.exe LIST:

*DRIVE 5 -    59.6GiB TS-RDF5 SD  Transcend           Fw=TS37  Sno=d@             G:

The regex at

if ($drive -match '\*?DRIVE (\d+) -\s+([\d.]+[KMGTP]?iB)\s+(.*?)\s+Fw=(\w+)*\s+Sno=(\w+)*\s+(\w+):') {
doesn't match the @ in the Sno, I fixed it by replacing it with

'\*?DRIVE (\d+) -\s+([\d.]+[KMGTP]?iB)\s+(.*?)\s+Fw=(\w+)*\s+Sno=([\w@]+)*\s+(\w+):'

I don't know if Sno can contain more special characters.

@schmurtzm
Copy link
Owner

Thank you for the tips, indeed the SD detection requires some improvements.
Updated here : 29710a2 let me know if it's better for you.

@Giotino
Copy link
Author

Giotino commented Jan 7, 2024

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.

@schmurtzm
Copy link
Owner

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 🤞🏻

@Giotino
Copy link
Author

Giotino commented Jan 8, 2024

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.

@AnthRD-retro
Copy link

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.

@Riseoftheslug
Copy link

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):') {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants