Open laszewsk opened 3 years ago
cms burn info reports the sd card size on linux
# ----------------------------------------------------------------------
# SD Cards Found
# ----------------------------------------------------------------------+----------+----------------------------------------------+-------------+------------------+--------------+------------+---------+----------+-------------+-------------+
| Path | Info | Formatted | Size | Plugged-in | Readable | Empty | Access | Removable | Writeable |
|----------+----------------------------------------------+-------------+------------------+--------------+------------+---------+----------+-------------+-------------|
| /dev/sdb | Generic- USB3.0 CRW-SD/MS 1.00 PQ: 0 ANSI: 6 | True | 64.1 GB/59.7 GiB | True | True | False | True | True | True |
+----------+----------------------------------------------+-------------+------------------+--------------+------------+---------+----------+-------------+-------------+
do we have a diffenet command that gets only one number?
so we can use what we have and use or we just use info and parse the first value split by space and multiply by 1000**3
# ----------------------------------------------------------------------
# Operating System SD Card
# ----------------------------------------------------------------------
Disk /dev/mmcblk0: 59.7 GiB, 64088965120 bytes, 125173760 sectors
WINDOWS
Sledgehammer@Sledgehammer MINGW64 ~
$ cms burn info
# ----------------------------------------------------------------------
# This is a Windows Computer
# ----------------------------------------------------------------------
+----------+-------+-------+---------+-------+-----------+--------+----------+--------+----------+
| Volume | ### | Ltr | Label | Fs | Type | Size | Status | Info | dev |
|----------+-------+-------+---------+-------+-----------+--------+----------+--------+----------|
| Volume | 2 | E | boot | FAT32 | Removable | 256 MB | Healthy | | /dev/sdb |
+----------+-------+-------+---------+-------+-----------+--------+----------+--------+----------+
+--------+-----------------+-----------------+-----------------------------------+---------+--------------+--------+
| Disk | InterfaceType | MediaType | Model | Model | Partitions | Size |
|--------+-----------------+-----------------+-----------------------------------+---------+--------------+--------|
| 1 | USB | Removable Media | Generic STORAGE DEVICE USB Device | 2 | 59 GB | Online |
+--------+-----------------+-----------------+-----------------------------------+---------+--------------+--------+
WARNING: We could not find your USB reader in the list of known readers
# Timer: 1.9406s Load: 0.0070s burn info
(ENV3)
Sledgehammer@Sledgehammer MINGW64 ~
fix field names looks liek that the split of the info has wrong order. there may need to be other fileds. create as much info as possible, and compare to the result of info posted next from linux
+----------+------------------------+-------------+------------------+--------------+------------+---------+----------+-------------+-------------+
| Path | Info | Formatted | Size | Plugged-in | Readable | Empty | Access | Removable | Writeable |
|----------+------------------------+-------------+------------------+--------------+------------+---------+----------+-------------+-------------|
| /dev/sdd | Generic STORAGE DEVICE | True | 64.1 GB/59.7 GiB | True | True | False | True | True | True |
+----------+------------------------+-------------+------------------+--------------+------------+---------+----------+-------------+-------------+
compare also with macos
For SDCard size we need to find out how to get the size in
gregor can help once you find it out.
we need a function thatreturns the size of an sd card given the device
def size(device=dev/disk2): return number in bytes