在Android的主机卡仿真编辑功能 [英] Editing Functionality of Host Card Emulation in Android

查看:246
本文介绍了在Android的主机卡仿真编辑功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我在开发我的大学课程项目,其中我会希望编辑的Andr​​oid的HCE特性的功能,让我模仿一个卡时设置自己的UID的进程。

现在,我已经下载了AOSP源代码,并建立无编辑code的自定义图像,并安装到我的Nexus 7(包括下载和包括供应商特定的硬件驱动程序),我被卡住上的下一部分。

我身体无法找到该设备code,它支配了Android的NFC功能,而我不能确定如何去一)寻找它,和b)如何我应该编辑此code。

时的$ C $ Android中的基本内核下NFC?如果是的话,我将如何编辑我才跑做了,希望它建立?或者是在其他地方?我注意到,我已经下载并提取在供应商文件夹中的文件是一个.NCD格式,我不认为是可编辑的。

任何帮助,我可以在此获得将大大AP preciated。

解决方案

好了!所以,我已经找到了解决我遇到的问题!

在了Nexus 7,当NFC打开时,它在配置文件中获取信息的/ etc /被称为libnfc-BRCM-20791b05.conf

在这个文件中有一个名为NFA_DM_START_UP_CFG参数

在默认情况下,它看起来是这样的:

<$p$p><$c$c>NFA_DM_START_UP_CFG={42:CB:01:01:A5:01:01:CA:14:00:00:00:00:0E:C0:D4:01:00:0F:00:00:00:00:C0:C6:2D:00:14:0A:B5:03:01:02:FF:80:01:01:C9:03:03:0F:AB:5B:01:00:B2:04:E8:03:00:00:CF:02:02:08:B1:06:00:20:00:00:00:12:C2:02:01:C8}

要编辑是在模拟生成的UID,你需要一些字节添加到该参数的末尾。

您添加的第一个字节是0x33(这意味着你要手动设置UID)

这是加入第二个字节是要设置UID的长度(这可以是4,7或10个字节,所以这第二个字节可以是0×04,0×07或0x0A的)

接下来的字节,那么你要设置的ID! (注:根据多少字节你加,你应该改变数组的第一个字节,以反映新数组的大小 - 它开始于42,所以如果你要加6个字节,应该更改为48)

例如,如果你想设置01 02 03 04 05 06 07 7字节的ID,新的配置行是这样的:

<$p$p><$c$c>NFA_DM_START_UP_CFG={4B:CB:01:01:A5:01:01:CA:14:00:00:00:00:0E:C0:D4:01:00:0F:00:00:00:00:C0:C6:2D:00:14:0A:B5:03:01:02:FF:80:01:01:C9:03:03:0F:AB:5B:01:00:B2:04:E8:03:00:00:CF:02:02:08:B1:06:00:20:00:00:00:12:C2:02:01:C8:33:07:01:02:03:04:05:06:07}

您就可以按下这个配置文件到您的nexus设备利用亚行:

   - &GT;亚行根
 - &GT;亚行重新装入
 - &GT;亚行推libnfc-BRCM-20791b05.conf的/ etc /
 - &GT;亚行重新启动
 

这将重置的Nexus,在新的配置文件,并根据仿真的UID将被设置为01 02 03 04 05 06 07

希望这有助于任何人读我的问题!

I'm currently in the process of developing a project for my University course wherein I will be hopefully editing the functionality of the HCE Feature of Android to allow me to set my own UID when emulating a card.

Now, i've downloaded the AOSP source, and built a custom image with no edited code and installed that to my Nexus 7 (This includes downloading and including the Vendor specific hardware drivers), and i'm stuck on the next part.

I physically cannot find the device code that governs the NFC features of Android, and i'm unsure how to go about a) Looking for it, and b) How I should be editing this code.

Is the code for NFC in Android in the base Kernel? and if so how would I edit that before I run "make" again and hope it builds? or is it elsewhere? I've noticed that the files in the Vendor folder i've downloaded and extracted are in a .ncd format, which I don't think is editable.

Any help I can get on this would be greatly appreciated.

解决方案

Ok ! So i've found a solution to the problem I was having!

On the Nexus 7, when the NFC is turned on, it gets its information from a config file in "/etc/" called "libnfc-brcm-20791b05.conf"

Inside of this file there is a parameter called "NFA_DM_START_UP_CFG"

By default, it looks like this:

NFA_DM_START_UP_CFG={42:CB:01:01:A5:01:01:CA:14:00:00:00:00:0E:C0:D4:01:00:0F:00:00:00:00:C0:C6:2D:00:14:0A:B5:03:01:02:FF:80:01:01:C9:03:03:0F:AB:5B:01:00:B2:04:E8:03:00:00:CF:02:02:08:B1:06:00:20:00:00:00:12:C2:02:01:C8}

To edit the UID that is generated at Emulation, you need to add some bytes to the end of this parameter.

The first byte you add is 0x33 (This means that you are going to manually set the UID)

The second byte that is added is the length of the UID you wish to set (This can be either 4,7 or 10 bytes, so this second byte can be 0x04, 0x07 or 0x0A)

The next bytes are then the ID you wish to set! (NOTE: Depending on how many Bytes you add, you should change the first byte of the array to reflect the new size of the array - it starts at 42, so if you were to add 6 bytes it should change to 48)

For example, if you wished to set a 7 byte ID of 01 02 03 04 05 06 07, the new config line would look like this:

NFA_DM_START_UP_CFG={4B:CB:01:01:A5:01:01:CA:14:00:00:00:00:0E:C0:D4:01:00:0F:00:00:00:00:C0:C6:2D:00:14:0A:B5:03:01:02:FF:80:01:01:C9:03:03:0F:AB:5B:01:00:B2:04:E8:03:00:00:CF:02:02:08:B1:06:00:20:00:00:00:12:C2:02:01:C8:33:07:01:02:03:04:05:06:07}

You can then push this config file to your nexus device using adb:

-> adb root
-> adb remount
-> adb push libnfc-brcm-20791b05.conf /etc/
-> adb reboot

This will reset the Nexus with the new config file in, and upon emulation the UID will now be set to 01 02 03 04 05 06 07

Hope this helps anyone reading my question!

这篇关于在Android的主机卡仿真编辑功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆