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

macOS support? #5

Open
gingerbeardman opened this issue Dec 23, 2017 · 61 comments
Open

macOS support? #5

gingerbeardman opened this issue Dec 23, 2017 · 61 comments

Comments

@gingerbeardman
Copy link
Contributor

Depending on the model of Apple Mac, the SD card reader is either mapped to USB or PCIE interface (in this case in System Information it will show in card reader with speed measured in GT/s).

https://support.apple.com/en-gb/HT204384

On my Early-2013 Retina MacBook Pro the SD card reader is PCIE. So I wondered if I could do any investigation to see whether CID can be changed?

Any ideas?

@raburton
Copy link
Owner

I have no experience with osx/bsd, but I'm sure it's possible. If the bsd api is similar to linux then probably won't take much adapting, but if it's completely different then it'd need a rewrite. Have you tried to compile it and see how far it gets?

@gingerbeardman
Copy link
Contributor Author

I've not tried it, but I will soon.

I confirmed my laptop can change the CID of my EVO card using Ubuntu so I'll try to figure out how to do it with only MacOS.

@avp90
Copy link

avp90 commented Oct 29, 2018

To be able to compile on MacOS i need to replace

#include <linux/types.h>

in /jni/ioctl.h with:

#ifdef __linux__
# include "linux/types.h"
#else
# include <stdint.h>
typedef uint64_t __u64;
typedef uint32_t __u32;
typedef int32_t __s32;
typedef uint16_t __u16;
typedef uint8_t __u8;
#endif

@pabgg
Copy link

pabgg commented May 7, 2019

It works, thanks.

@3x3cut0r
Copy link

3x3cut0r commented Jun 27, 2019

could somebody give a little how-to compile this on macos 10.14 or send a link to the compiled uploaded version?

@Tetonne
Copy link

Tetonne commented Jul 25, 2019

Sharing the stuff (binaries) for Mac OS X would be great

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented Jul 25, 2019

Here's the macOS binary (built just now, untested on any SD cards).

evoplus_cid.zip

Screen shot 2019-07-25 at 13 08 03

@Tetonne
Copy link

Tetonne commented Jul 25, 2019

^thanks a lot for this share and the quick answer and how to. best regards.

@gingerbeardman
Copy link
Contributor Author

Did anybody use the above build successfully on macOS?

@Tetonne
Copy link

Tetonne commented Aug 15, 2020

hello gingerbeardman
i try but without success

cd /Users/Shared/Downloads/

./evoplus_cid /dev/disk2/disk2s1 09415041462053460219f9cf37014101
Unable to open device /dev/disk2/disk2s1

./evoplus_cid /dev/disk2/disk2s1 09415041462053460219f9cf37014101
Unable to open device /dev/disk2

./evoplus_cid /Volumes/Untitled 09415041462053460219f9cf37014101
Unable to open device /Volumes/Untitled

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented Aug 16, 2020

@Tetonne you need to unmount the device first (using terminal or disk utility)

Unmount is like a half eject

Then use the /dev device that matches your card

@Tetonne
Copy link

Tetonne commented Aug 16, 2020

Thanks gingerbeardman for your help unfortunately same result.
i'm under 10.15.6 and the /Volumes/Untitled is ExFAT format (it's new)

terminal.app give me :
/dev/disk2 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *64.0 GB disk2
1: Windows_NTFS 64.0 GB disk2s1

i unmount the volume Untitled in diskutil.app then try again

tetonne@iMac cid % ./evoplus_cid /dev/disk2/disk2s1 09415041462053460219f9cf37014101
Unable to open device /dev/disk2/disk2s1
tetonne@iMac cid % ./evoplus_cid /dev/disk2/ 09415041462053460219f9cf37014101
Unable to open device /dev/disk2/

@gingerbeardman
Copy link
Contributor Author

OK, i recommend using a USB stick with Ubuntu Linux on it.

@gingerbeardman
Copy link
Contributor Author

@Tetonne can you confirm you are using an internal SD card reader connected to PCIE (USB card readers will not work)

@Tetonne
Copy link

Tetonne commented Aug 17, 2020

^thanks again gingerbeardman. Im' using it on my iMac i'll try to find a linux to solve it thanks again and thanks for this stuff and all other you provide :-) related to brew

@jdelatorre72
Copy link

Thanks gingerbeardman for your help unfortunately same result. i'm under 10.15.6 and the /Volumes/Untitled is ExFAT format (it's new)

terminal.app give me : /dev/disk2 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *64.0 GB disk2 1: Windows_NTFS 64.0 GB disk2s1

i unmount the volume Untitled in diskutil.app then try again

tetonne@iMac cid % ./evoplus_cid /dev/disk2/disk2s1 09415041462053460219f9cf37014101 Unable to open device /dev/disk2/disk2s1 tetonne@iMac cid % ./evoplus_cid /dev/disk2/ 09415041462053460219f9cf37014101 Unable to open device /dev/disk2/

I found how to overpass this problem:

  1. Determine the disk device corresponding to the SD Card you want to change to:
    Execute diskutil list before you plug your SD card and then repeat this after you've plugged it in. Take notice that /dev/disk2 is the one you need.
  2. Unmount the disk diskutil unmountDisk /dev/disk2
  3. Zero out the partition map: sudo dd if=/dev/zero of=/dev/rdisk2 bs=1024 count=1 (now you are accessing the disk in raw, so the device name is /dev/rdisk2 and not /dev/disk2). (Be aware of the r character before disk2)
  4. sudo ./evoplus_cid /dev/rdisk2 09415041462053460219f9cf37014101

@jdelatorre72
Copy link

I got an error:
Failed to enter vendor mode. Genuine Samsung Evo Plus?

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented Nov 29, 2021

@jdelatorre72 did you read the error?

  • your SD card may not be genuine
    or
  • your SD card may not be the correct type

Also, confirm you are using an internal SD card slot not a USB SD card reader.

@jdelatorre72
Copy link

It's a microSD with adaptor

@jdelatorre72
Copy link

I think my mac sd reader goes through USB

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented Nov 29, 2021

@jdelatorre72 it needs to be an internal SD slot (like in a MacBook Pro) for technical reasons.

@jdelatorre72
Copy link

@jdelatorre72 it needs to be an internal SD slot (like in a MacBook Pro) for technical reasons.

It is so, but I guessed it could go by usb bus because of this error.
It's a iMac from middle 2011.

I purchased a new sd card to test again. If I succeed I'll let you notice.

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented Nov 29, 2021

That computer should be OK.

There is no need to guess what SD hardware you have. You can check the type of the SD card hardware by checking System Information (PCIE hardware will show in card reader with speed measured in GT/s)

@jdelatorre72
Copy link

Well, it looks like USB:

Unidad física:
  Nombre del dispositivo:	SD Card Reader
  Nombre del soporte:	APPLE SD Card Reader Media
  Protocolo:	USB
  Interno:	Sí
  Tipo de mapa de particiones:	MBR (Registro maestro de arranque)

@gingerbeardman
Copy link
Contributor Author

Interesting! Sorry to read that, you'll need to find a compatible computer with PCIE SD slot.

@jdelatorre72
Copy link

Grrrrr, I’ve started to try on a netbook until I saw it’s also connected through USB Host controller

@jdelatorre72
Copy link

Hi,
I finally tried to attach my old Xperia M2, after rooting it and access to it by adb.
When I launch the command ./evoplus_cid /dev/block/mmcblk1 NEW_CID_NUMBER I get this message from console:
./evoplus_cid[1]: ??????: not found ./evoplus_cid[25]: no closing quote

I don't know what does it mean.

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented Dec 3, 2021

Interesting idea to use the phone!

Here there are two errors

  1. not found, I guess evoplus_cid cannot see the card?
  2. no closing quote, given that you did not use quotes in your command it seems that evoplus_cid is not running correctly or at least not seeing data correctly

Maybe doing this over adb is messing up things? Bad luck.

@raburton
Copy link
Owner

raburton commented Dec 3, 2021

This looks to me like an error from the shell, like it's possibly trying to execute the program as a shell script. Check your compiled copy has transferred properly, e.g. use md5, make sure it's not on a fat partition and that it has execute permission.

@jdelatorre72
Copy link

Well,
I don’t know much how to fix it.
I placed the program in several folders in primary storage unit of the phone.
I run it remotely by adb and then directly in the phone with material terminal. The both cases I got the same answer.
Maybe I did not root correctly the cellular?

@jdelatorre72
Copy link

Maybe but, what can I do?
It’s android 5.1.1 may I use a different shell? In this case, how? I guess it’s bash

@gingerbeardman
Copy link
Contributor Author

what happens if you just run: evoplus_cid with no arguments?

you should see:

$ evoplus_cid
Usage: ./evoplus_cid <device> <cid> [serial]
device - sd card block device e.g. /dev/block/mmcblk1
cid - new cid, must be in hex (without 0x prefix)
  it can be 32 chars with checksum or 30 chars without, it will
  be updated with new serial number if supplied, the checksum is
  (re)calculated if not supplied or new serial applied
serial - optional, can be hex (0x prefixed) or decimal
  and will be applied to the supplied cid before writing

Warning: use at own risk!

@raburton
Copy link
Owner

raburton commented Dec 5, 2021

And I made some suggestions in my last reply that you haven't said you've tried (except the FS type), if it doesn't produce the expected output when run without parameters, as above.

@jdelatorre72
Copy link

Hi, I'm sorry for my short answer:
thats what I get with md5 (though I have nothing to compare with)
MD5 (evoplus_cid) = a2804b432d050c23d9efc35e64361bf4
MD5 (evoplus_cid.zip) = e4bfe076c20f1402e5c6134c1ce4dd5f

I put the file in the main storage unit of the cellphone, as I said before

And I gave executable permissions to the file.

Now I'm testing again and I'll tell you.

Thanks a lot

@raburton
Copy link
Owner

raburton commented Dec 7, 2021 via email

@jdelatorre72
Copy link

I finally found an old and almost forgotten netbook with a ata sdcard device so I surrendered with cellphones and rooting them.
I now focus on this netbook that runs over linux. I tried directly the binary but it was wrong, it said something like “not the proper executable file” so I’m going to compile from source. Maybe that’s because my netbook is a 32 bit machine?
Today I’ll install a brand new Ubuntu (really last release for 32 bit architecture) with compilation packages since I found a missing stdio.h error when I tried it before.
I’ll tell you about it and perhaps I will need further help if you’re so kind.
Anyway I see this went out of this thread topic there’s nothing to do with Mac OS. Maybe another thread should be started.

@tbrek
Copy link

tbrek commented May 29, 2022

Just tried on my Mac Mini which I believe has card reader on PCI-E:


  Vendor ID:	0x14e4
  Device ID:	0x16bc
  Subsystem Vendor ID:	0x14e4
  Subsystem ID:	0x0000
  Revision:	0x0001
  Link Width:	x1
  Link Speed:	2.5 GT/s

SDHC Card (Class 10):

  Product Name:	SMEB1QT
  Manufacturer ID:	0x1b
  Revision:	3.0
  Serial Number:	2590397309
  Manufacturing Date:	2021-02
  Specification Version:	3.0
  Capacity:	32.01 GB (32,010,928,128 bytes)
  Removable Media:	Yes
  BSD Name:	disk3
  Partition Map Type:	Unknown
  SMART status:	Verified

though I'm still getting: Failed to enter vendor mode. Genuine Samsung Evo Plus?

The card I bought is https://www.amazon.co.uk/gp/product/B06XFSZGCC/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&th=1

Any ideas?

@gingerbeardman
Copy link
Contributor Author

All you can do is try a different card. I recall that some Evo are made in China (probably won't work) and others are made in Korea or Philippines (these are confirmed).

I think you'll have more luck with an old card than a new one.

Ot is probably easier to buy a card with custom CID on ebay etc.

@tbrek
Copy link

tbrek commented May 30, 2022

Hey All you can do is try a different card. I recall that some Evo are made in China (probably won't work) and others are made in Korea or Philippines (these are confirmed).

I think you'll have more luck with an old card than a new one.

Ot is probably easier to buy a card with custom CID on ebay etc.

The one I'm trying was made in Philippines. Does the country of origin of the adapter have any influence?

@gingerbeardman
Copy link
Contributor Author

You mean MicroSD to SD adapter?

No idea, but mine is manufactured by SanDisk, blue/red/white label, with the following markings:

2006-12-21A
MADE IN CHINA

@matbard
Copy link

matbard commented May 30, 2022

I tried with a made in China Evoplus 32 GB microSD with adaptor and my iMac 27" 2014 (which has PCI SD card reader) with Big Sur and had the same error "Failed to enter vendor mode. Genuine Samsung Evo Plus?".

The strange thing is that I also use Ubuntu and cannot pass through the "find" command, as terminal shows nothing.

I remember clearly I succeded in the past, but don't remember which Ubuntu distribution I used...

@gingerbeardman
Copy link
Contributor Author

I used Ubuntu 18.04

@gingerbeardman
Copy link
Contributor Author

Also see this note:

#4 (comment)

this method worked on specific cards that were made 6 years ago, and stopped being made shortly after, I'm not surprised you can't still buy one easily.

@matbard
Copy link

matbard commented May 30, 2022

I used Ubuntu 22.04 LTS on an old Acer 7750G with integrated SD/MMC reader. After the find /sys command I see nothing...

@tbrek
Copy link

tbrek commented May 30, 2022

Thanks guys. I stil have got some more options to try:

  1. Ubuntu on Mac Mini
  2. Raspberry Pi
  3. Couple more cards from Amazon.

Will update the thread if any of them become success.

@matbard
Copy link

matbard commented May 30, 2022

just a question about trying with a Raspberry Pi: I have to boot an Ubuntu distro from USB pendrive, right?

@tbrek
Copy link

tbrek commented May 30, 2022

just a question about trying with a Raspberry Pi: I have to boot an Ubuntu distro from USB pendrive, right?

I believe so, I assume if you boot from microSD you won't be able to change the CID. I will try both anyway.

@gingerbeardman
Copy link
Contributor Author

After the find /sys command I see nothing...

Which command is this?

@matbard
Copy link

matbard commented May 30, 2022

After the find /sys command I see nothing...

Which command is this?

find /sys -name cid -print

It will display the SD card CID (obviously if it is inserted in the reader...)

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented May 30, 2022

Where did that command come from? A tutorial?

@tbrek
Copy link

tbrek commented May 30, 2022

Where did that command come from? A tutorial?

Possibly from here

BTW. I've just tried on RaspberryPi with no luck. Ordered couple more cards from Amazon to try.

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented May 30, 2022

That command is trying to list the CID contents, but assumes the device/card is present is in the device list.

So, before that I would first confirm that the card is indeed in the device list!

ls /dev/mmc*

or

ls /sys/block/mmc*

If it's not at either of those, the SD card slot/reader is not compatible.

@matbard
Copy link

matbard commented Jun 2, 2022

SUCCESS!

I successfully changed the CID on a Evoplus 32 GB (made in China) using a Raspberry Pi 400 with Ubuntu 22.04 LTS booting from external SSD. The Raspberry Pi has real PCI card reader.

Both using my iMac 5K 2014 (on Big Sur) and an Acer 7750G with the same Ubuntu distro ended in failures, suggesting me that the micro SD card wasn't good. The Mac showed the infamous "Failed to enter vendor mode. Genuine Samsung Evo Plus?" error.

@tbrek
Copy link

tbrek commented Jun 2, 2022

SUCCESS!

I successfully changed the CID on a Evoplus 32 GB (made in China) using a Raspberry Pi 400 with Ubuntu 22.04 LTS booting from external SSD. The Raspberry Pi has real PCI card reader.

Both using my iMac 5K 2014 (on Big Sur) and an Acer 7750G with the same Ubuntu distro ended in failures, suggesting me that the micro SD card wasn't good. The Mac showed the infamous "Failed to enter vendor mode. Genuine Samsung Evo Plus?" error.

Awesome. I've tried 3 different cards from Amazon with no success using RPi 4 with latest Ubuntu.

@matbard what card did you get? What model?

@jdelatorre72
Copy link

So, you suggest that maybe the problem wasn’t the proper card but the proper device to grant real access to the card. Is it?
You couldn’t change the CID to the same card until you tried with raspberry.

@matbard
Copy link

matbard commented Jun 2, 2022

image

@tbrek
Copy link

tbrek commented Jun 2, 2022

image

That's not a microSD.

@matbard
Copy link

matbard commented Jun 2, 2022

image

image

@tbrek
Copy link

tbrek commented Jun 2, 2022

Thanks so it's one from the compatibility list:

A list of reported working cards:
- Samsung Evo/Evo+ cards
- Samsung Evo MB-SP32D/EU
- Samsung Evo+ MB-SC32D/EU
- Samsung Essential MB-MSBGA/EU 16GB
- Samsung Essential MB-MSAGB 16GB
- Samsung Essential 16 GB (MB-MSBGA/EU)
- Samsung Essential 32 GB (MB-MSBGA/EU)
- Samsung EVO 32 GB (MB-MP32DA)
- Samsung EVO 64 GB (MB-MP64DA)
- Samsung EVO+ 32 GB (MB-MC32DA & MB-MC32D) Notes: MB-MC32D/EU made in Philippines reported not working (they were made in Korea too, which work)
- Samsung EVO+ 64 GB (MB-MC64DA)
- Samsung EVO+ 128 GB (MB-MC128DA)
- Samsung PRO 32 GB (MB-MG32EA)
- Samsung PRO 64 GB (MB-MG64EA)
- Samsung PRO+ 32 GB (MB-MD32D)
- Samsung PRO+ 64 GB (MB-MD64D)
- Samsung 16GB SDHC Class 10 "U1" MB-SPAGC MADE IN KOREA MBSPAGVDDACA-XH
- Samsung 32GB MicroSDHC Class 10 "U1" MB-MPBGC MADE IN KOREA MBMPBGVEQAFA-XH
- Lexar 8GB Class 4 Type MMAGR08GUDCA-DB made in Taiwan
- Transcend MicroSDHC 8GB TS8GUSDHC6

@tbrek
Copy link

tbrek commented Jun 13, 2022

Managed to find Samsung Evo 32GB in my CCTV camera at home which is MB-MP32D and it worked in Raspberry Pi/IUbuntu. Same card did not work on Mac Mini though.

root@raspberrypi:~/sd/evoplus_cid/jni# cat /sys/block/mmcblk0/device/cid
1b534d3030303030103***
root@raspberrypi:~/sd/evoplus_cid/jni# ./evoplus_cid /dev/mmcblk0 5d5342303031364712e***
Writing new CID: 5d5342303031364712e***
Success! Remove and reinsert SD card to check new CID.
root@raspberrypi:~/sd/evoplus_cid/jni# cat /sys/block/mmcblk0/device/cid
5d5342303031364712e***

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

9 participants