Jump to content

Sinetek's Driver for Realtek "RTSX" SDHC Card Readers


Sinetek
335 posts in this topic

Recommended Posts

Hi everybody,
My Laptop is a Dell XPS 15-9560 with Realtek PCIE-Card-Reader 10EC:525A
Not working with 10.14.6
Sinetek-rtsx.kext is in /L/E, but is not loaded.

 

PCI-List_Hackintool.thumb.png.82fc319c41868f7c3e1d5b26df230d27.png

 

System_Extensions.thumb.png.59b1163de8cdef85aa8ab4c60d345b59.png

 

EDIT: I have added 0x525A10EC to the Info.plist.
Now the driver is loaded.
An SDHC or SDXC card is still not recognized.

Edited by windowless31
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 4 weeks later...
  • 4 weeks later...
  • 1 month later...
  • 1 month later...

For those with a 0x525A, I am trying to make this kext work.

 

As of now, the kext loads and can read the card once it's inserted (writing is disabled for now). It will stop working if you extract and insert the card again. I will be working on this kext at least for a few weeks, so you can expect improvements and if you can help troubleshooting that would be very welcome. Source code (modified from @Sinetek and @syscl's) is here.

Sinetek-rtsx-1.0.zip

  • Like 2
Link to comment
Share on other sites

On 3/23/2020 at 11:59 PM, cholonam said:

For those with a 0x525A, I am trying to make this kext work.

 

As of now, the kext loads and can read the card once it's inserted (writing is disabled for now). It will stop working if you extract and insert the card again. I will be working on this kext at least for a few weeks, so you can expect improvements and if you can help troubleshooting that would be very welcome. Source code (modified from @Sinetek and @syscl's) is here.

Sinetek-rtsx-1.0.zip

YES! This one worked for me... However, it takes quite a while to recognise the SD card and the device doesn't appear anywhere in the "system report". Weird. 

My SD card reader is a 0x5287.

Thanks Cholonam!

Link to comment
Share on other sites

On 4/2/2020 at 5:05 AM, carlinyos said:

 @cholonam thank you for maintaining (and improving) a working source. That is supervaluable! I might try to help your improve your version, but I still have a lot of questions regarding the kext. Let me know if I can PM you.

 

Sure you can :) I am still learning about the kext too, but I think I could make it work properly. I just need time, which I don't have a lot.. What I've learned so far:

  1. The kext is basically the OpenBSD driver with a layer on top (Sinetek_rtsx.cpp/SDDisk.cpp) to make it work using the macOS' IOKit framework. Looks like syscl added the PM-management part on top of Sinetek's work, but does not look like working, so I just disabled it for now (rstx_activate() just returns 0).
  2. I'm afraid that even if we make the OpenBSD driver fully working, even this driver seems buggy and not 100% working.. the ideal way to go would be to port the Linux driver. I have compared both and they set registers differently, even some register numbers are different... Seems like the BSD driver was designed for just one particular card and just "happens to kind of work" with other cards too. That means the only hope to continue with this driver is that: 1) the OpenBSD team does some more work on it, and 2) that we can port those changes back again. I definitely don't have time to port the linux driver, even though it doesn't look too difficult. Maybe someone with Linux kernel and Darwin kernel experience (or eager to learn) wants to take the challenge...
  3. What I am doing in the develop branch is to implement a "BSD compatibility layer" so that we can use the OpenBSD code almost untouched and integration is easier if/when the BSD driver is improved. My goal is to just change the headers included by the BSD files to a single "openbsd_compat.h" which takes care off all the differences between BSD and mac functions. After I am done with this low-level part, I'll start looking into everything else that needs to be done (PM, multiblock read, stability...). Anyone willing to collaborate is welcome :)

Cheers!

 

  • Like 1
Link to comment
Share on other sites

6 hours ago, cholonam said:

 

Sure you can :) I am still learning about the kext too, but I think I could make it work properly. I just need time, which I don't have a lot.. What I've learned so far:

  1. The kext is basically the OpenBSD driver with a layer on top (Sinetek_rtsx.cpp/SDDisk.cpp) to make it work using the macOS' IOKit framework. Looks like syscl added the PM-management part on top of Sinetek's work, but does not look like working, so I just disabled it for now (rstx_activate() just returns 0).
  2. I'm afraid that even if we make the OpenBSD driver fully working, even this driver seems buggy and not 100% working.. the ideal way to go would be to port the Linux driver. I have compared both and they set registers differently, even some register numbers are different... Seems like the BSD driver was designed for just one particular card and just "happens to kind of work" with other cards too. That means the only hope to continue with this driver is that: 1) the OpenBSD team does some more work on it, and 2) that we can port those changes back again. I definitely don't have time to port the linux driver, even though it doesn't look too difficult. Maybe someone with Linux kernel and Darwin kernel experience (or eager to learn) wants to take the challenge...
  3. What I am doing in the develop branch is to implement a "BSD compatibility layer" so that we can use the OpenBSD code almost untouched and integration is easier if/when the BSD driver is improved. My goal is to just change the headers included by the BSD files to a single "openbsd_compat.h" which takes care off all the differences between BSD and mac functions. After I am done with this low-level part, I'll start looking into everything else that needs to be done (PM, multiblock read, stability...). Anyone willing to collaborate is welcome :)

Cheers!

 

Thanks for the amazing work that you did.

 

As long as the kext works after wake from sleep, can eject and mount + read and write, it's absolutely amazing and just all we need for the currently supported card readers.

 

Lenovo Thinkpads with Haswell and Broadwell generations have the 5227 model

 

The last version from sinetek was working with read and write, eject and mount but after you let the laptop sleep then wake, it broke.

 

I haven't tested using a fast SD card but even at current supported speeds we would be more than happy to have a working kext released.

 

Thanks in advance !

 

Link to comment
Share on other sites

Can anyone help me troubleshoot this on my laptop?

 

t440p laptop - realtek 5227 PCI card reader.

 

i used https://github.com/jloisel/t440p guide and am running Catalina 10.15.3 everything else works amazingly well and stable - except wake from sleep (which I'm working on fixing and is a separate issue). 

 

I have the kext installed in L/E.

 

I have it in clover EFI also and I've tried it in S/L/E , all to no avail . 

 

I tried editing the plist of apple storage drivers kext trick also. 

 

but i admit I'm not 100% i got it all correct . 

 

Here is my IOreg :

 

2068569105_Screenshot2020-04-09at10_54_54.png.f80ee73dc8296b5465053b43d68e35ef.png

 

Here is what Hackintool sees :

 

1392710934_Screenshot2020-04-09at10_56_22.thumb.png.0f54624eac5e2ec0892360d905ced1ef.png

 

and here is my edited kext for AppleStorageDrivers. 

 

AppleStorageDrivers.kext.zip

 

Where have I gone wrong?

 

Thanks to all the amazing community here !

Link to comment
Share on other sites

For those interested, I am preparing a new release of the kext, in which I totally refactored the integration with the code from OpenBSD and added some code from the Linux driver that should help with the initialization (stability) of the 525A chip. I also added multiblock-reads (PR by Charlyo), which in my case has made the read speed double. The OpenBSD driver also uses ADMA, which should be even a bit faster, but that's not enabled yet since it needs some more changes in the compatibility layer.

 

There are quite many changes this time, so I would like to test it thoroughly before issuing a new release. The code is on my github's develop branch (https://github.com/cholonam/Sinetek-rtsx/tree/develop) and I'm attaching a pre-release compiled version here. Writing can be enabled by using the "-rtsx_rw" boot parameter. Also, the LOCK switch on the card is now honored. Please take some time to test and let me know of any mayor problems.

 

* The driver may still be unstable and crash your computer corrupting your APFS partition and valuable data (didn't happen to me recently, but I did before and it could happen to you)... be careful and always make backups.

 

** For those with other chips different from 525A but similar, I suspect that those chips are not being correctly initialized. The Linux driver looks much more complete than OpenBSD's. I recommend to take a look at the Linux driver and see what's missing (the driver is in drivers/misc/cardreader). It's not too hard, but takes time. I can't support all the chips because it would take too much time, but I'll accept pull requests if you have any.

Sinetek-rtsx_PRERELEASE.zip

  • Like 1
Link to comment
Share on other sites

@cholonam i just tested the attached prerelease kext and it seems that it is not attaching / loading.

 

Here is mine on IOREG:

 5227.thumb.png.741ec7d45453860785ff339491bb28bf.png

 

It was working with last sinetek-rtsx from Sinetek attached on this thread.

 

Im using OpenCore 0.5.7, injecting it with Bootloader.

 

Let me know if you need additional logs, it seems that you have issues disabled on Github.

 

Thanks for your great work.

Edited by Sniki
Link to comment
Share on other sites

Sorry, but there was a bug in the prerelease I sent before which prevented card formatting from Disk Utility. I am sending a new prerelease and the fix is also on github.

 

@Sniki I took care not to affect the original Syscl code for other chips, but I may have miss something. Like I said, there are many changes in this release and I will not be able to support chips other than mine (525A). Finding where both codes differ now for your particular chip will take a few days at lease, a time I don't have.. in any case, if you find the problem and let me know I'll be happy to merge your changes.

 

Cheers,

cholonam

Sinetek-rtsx_PRERELEASE2.zip

Link to comment
Share on other sites

IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/RP04@1C/IOPP/PXSX@0

PciRoot(0x0)/Pci(0x1C,0x0)/Pci(0x0,0x0)

 

Hi Guys My Sinetek Card Reader Work Fine but after Sleep don't Work... Somebody can help me please?

 

Card Reader Realtek RTS522A [10ec:522a]

Lenovo s540-15IWL macOS Catalina

Edited by lucatek
Link to comment
Share on other sites

×
×
  • Create New...