raburton / evoplus_cid

Samsung Evo Plus CID changer
GNU General Public License v3.0
161 stars 84 forks source link

macOS support? #5

Open gingerbeardman opened 6 years ago

gingerbeardman commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 5 years ago

It works, thanks.

3x3cut0r commented 5 years ago

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

Tetonne commented 5 years ago

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

gingerbeardman commented 5 years ago

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 commented 5 years ago

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

gingerbeardman commented 4 years ago

Did anybody use the above build successfully on macOS?

Tetonne commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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

gingerbeardman commented 4 years ago

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

Tetonne commented 4 years ago

^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 commented 2 years ago

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 commented 2 years ago

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

gingerbeardman commented 2 years ago

@jdelatorre72 did you read the error?

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

jdelatorre72 commented 2 years ago

It's a microSD with adaptor

jdelatorre72 commented 2 years ago

I think my mac sd reader goes through USB

gingerbeardman commented 2 years ago

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

jdelatorre72 commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

jdelatorre72 commented 2 years ago

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

jdelatorre72 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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?

gingerbeardman commented 2 years ago

@raburton I think you're correct regardin the error being from the shell. weird.

jdelatorre72 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

That md5 is correct. You need to check the md5 of evoplus_cid on the phone, to make sure it has transferred correctly. Did you get that md5 from the phone, or your pc?

On Tue, 7 Dec 2021 at 20:04, jdelatorre72 @.***> wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/raburton/evoplus_cid/issues/5#issuecomment-988228106, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADJ3BZQWKGWY24EZMSZ4FTUPZSF5ANCNFSM4EJOUA4Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jdelatorre72 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

I used Ubuntu 18.04

gingerbeardman commented 2 years ago

Also see this note:

https://github.com/raburton/evoplus_cid/issues/4#issuecomment-1011403096

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

tbrek commented 2 years ago

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 commented 2 years ago

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

Which command is this?

matbard commented 2 years ago

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...)