Created
September 13, 2024 05:07
-
-
Save mpql/fbf8b27129b11ac3adb971b2a9471b37 to your computer and use it in GitHub Desktop.
Gets eMMC info for e.g. Micro SD cards to generate info about possible genuine status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
NC='\033[0m' ; | |
RED='\033[1;31m' ; | |
GRN='\033[1;32m' ; | |
# Get OEM ID and Manufacturer IDs | |
oemid=$(cat '/sys/block/mmcblk0/device/oemid') ; | |
manfid=$(cat '/sys/block/mmcblk0/device/manfid') ; | |
oemid_ascii=$(echo -e "\x${oemid:2:2}\x${oemid:4:2}") ; | |
printf " OEM ID: ${oemid} ($oemid_ascii)\n" ; | |
printf "Manufacturer ID: ${manfid}\n\n" ; | |
if [[ "${oemid}" == "0x4144" && "${manfid}" == "0x00001d" ]] || \ | |
[[ "${oemid}" == "0x5449" && "${manfid}" == "0x00009f" ]] || \ | |
[[ "${oemid}" == "0x4245" && "${manfid}" == "0x000028" ]] || \ | |
[[ "${oemid}" == "0x5041" && "${manfid}" == "0x000001" ]] || \ | |
[[ "${oemid}" == "0x5048" && "${manfid}" == "0x000027" ]] || \ | |
[[ "${oemid}" == "0x534d" && "${manfid}" == "0x00001b" ]] || \ | |
[[ "${oemid}" == "0x5344" && "${manfid}" == "0x000003" ]] || \ | |
[[ "${oemid}" == "0x5350" && "${manfid}" == "0x000031" ]] || \ | |
[[ "${oemid}" == "0x5446" && "${manfid}" == "0x000084" ]] || \ | |
[[ "${oemid}" == "0x544d" && "${manfid}" == "0x000002" ]] || \ | |
[[ "${manfid}" == "0x000074" && ( "${oemid}" == "0x4a45" || "${oemid}" == "0x004a" || "${oemid}" == "0x4a00" ) ]] ; then | |
printf "${GRN}Card likely genuine!${NC}\n\n" ; | |
else | |
printf "${RED}Card suspect!${NC} (or I just don't have its IDs in yet)\n\n" ; | |
fi | |
mmc_path=$(command -v mmc) | |
if [[ -z "${mmc_path}" ]] ; then | |
cat <<EOF | |
mmc not found. For extended info, please install mmc-utils: | |
sudo apt install mmc-utils | |
EOF | |
exit 1 ; | |
fi | |
mmc cid read /sys/block/mmcblk0/device ; | |
mmc csd read /sys/block/mmcblk0/device ; | |
mmc scr read /sys/block/mmcblk0/device ; | |
exit 0 ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment