Search code examples
nfcandroid-4.4-kitkatsmartcardapdunexus-5

Nexus 5: Route APDU to SIM


I am currently building Android 4.4. with seek-for-android to get UICC support on my Nexus 5.

So far without success. I did apply all patches mentioned here and here. But the sim1 Reader says there is no Secure Element present (only the embedded secure element reader returns true on .isSecureElemenPresend())

My question is: did anyone managed to activate SWP on a Nexus5 to successfully route APDUS to the SIM card and if so, how?

Edit: I found this comment, but it didn't help either.


Solution

  • I finally found the root of the problem and with that also the solution!

    Alltho Google offers a package of allegedly all vendor specific libraries, the containing makefiles list a few (17) libraries that are not included in the package.

    To add those libraries to your source folder you either need another hammerhead devices with stock firmware or the system.img file of the ROM.

    you can get the libraries from the device like that:

    adb pull system/app/OmaDmclient.apk
    adb pull system/etc/DxHDCP.cfg
    adb pull system/vendor/bin/vss_init
    adb pull system/vendor/firmware/discretix/dxhdcp2.b00
    adb pull system/vendor/firmware/discretix/dxhdcp2.b01
    adb pull system/vendor/firmware/discretix/dxhdcp2.b02
    adb pull system/vendor/firmware/discretix/dxhdcp2.b03
    adb pull system/vendor/firmware/discretix/dxhdcp2.mdt
    adb pull system/vendor/lib/libDxHdcp.so
    adb pull system/vendor/lib/libvdmengine.so
    adb pull system/vendor/lib/libvdmfumo.so
    adb pull system/vendor/lib/libvss_common_core.so
    adb pull system/vendor/lib/libvss_common_idl.so
    adb pull system/vendor/lib/libvss_common_iface.so
    adb pull system/vendor/lib/libvss_nv_core.so
    adb pull system/vendor/lib/libvss_nv_idl.so
    adb pull system/vendor/lib/libvss_nv_iface.so
    

    if you use the system.img file then mount the image and copy them from there.

    Now that we have the missing libraries we need to place them in the vendor directory: vendor/lge/hammerhead/proprietary and add them to the makefile vendor/lge/hammerhead/device-partial.mk

    like that:

    vendor/lge/hammerhead/proprietary/libvss_nv_iface.so:system/vendor/lib/libvss_nv_iface.so:lge \
    vendor/lge/hammerhead/proprietary/libvss_nv_idl.so:system/vendor/lib/libvss_nv_idl.so:lge \
    vendor/lge/hammerhead/proprietary/libvss_nv_core.so:system/vendor/lib/libvss_nv_core.so:lge \
    vendor/lge/hammerhead/proprietary/libvss_common_iface.so:system/vendor/lib/libvss_common_iface.so:lge \
    vendor/lge/hammerhead/proprietary/libvss_common_idl.so:system/vendor/lib/libvss_common_idl.so:lge \
    vendor/lge/hammerhead/proprietary/libvss_common_core.so:system/vendor/lib/libvss_common_core.so:lge \
    vendor/lge/hammerhead/proprietary/libvdmfumo.so:system/vendor/lib/libvdmfumo.so:lge \
    vendor/lge/hammerhead/proprietary/libvdmengine.so:system/vendor/lib/libvdmengine.so:lge \
    vendor/lge/hammerhead/proprietary/libDxHdcp.so:system/vendor/lib/libDxHdcp.so:lge \
    

    now recompile, flash the image and everything should work.