XINFC - Tools the NFC reader on the Xiaomi routers

Following my post on the Xiaomi AX3000T thread, I'm making public a way to interface with the NFC reader on the device.

Currently it is possible to configure the NFC reader to broadcast any network using the Wi-Fi Simple Configuration standard.

I've tested on my AX3000T with a NT082C chip, but it may work on other models. Though caution is advised when testing because this can leave the NFC chip unusable, or worse, reprogram another I2C device on the same bus.

Suggestions and contributions are always welcome.

9 Likes

Hi, I've just bought a Xiaomi AX3600. How to check if it has this feature?
Could you give me some hints?

Usually the NFC support is listed on the router features. You can also check if there's "NFC" embossed somewhere on the router's body, where you should place the phone.

Hi, I am an openWRT newbie, and this is my first device - I ran out of disk space trying to install the dependencies for compilation (specifically, gcc). Is there a way to cross-compile the executable on my ubuntu machine easily? Or simply get a pre-compiled version for the ax3000t ?

Nevermind, just noticed the DOCKER_HOWTO, and it worked perfectly. The only thing missing is the need to install libstdcpp before running the executable. NFC now works for me. Thanks for your hard work!

1 Like

Building OpenWrt as a whole from source will need at least ~20 GB free space, (including much-) more depending on your selected package set.

Using the SDK might get away will less storage, but requires more experience on your side (as you need to unravel the dependency change an build it in order).

since you have obviously opened the device, can you give any advice on how to do this?

You mean opening the device or probing the NFC chip?

sorry, I was not clear. I was thinking of the device, because I had not found the two screws under the label. After that, it was easy. I was wondering, however, did you happen to find any place where the i2c lines would be easily accessible to add other i2c devices?

The only (non-destructive) place I could find was at the NFC chip because the solder is exposed. Someone with solder skills might be able to solder some wires to it. I could not find any testing probe points on the board itself.

If the traces are running on the top layer of the circuit board, maybe one could also scrape a little to reveal the copper and solder.

The nice thing about i2c is that you can solder pretty much anywhere along the i2c line, as devices are connected in parallel.

yes, okay, thanks, this saves me time in looking over the pcb. It won't be too hard scraping away some masking and installing some small wires. I was thinking that there is a lot of space in the case and I might try to add some i2c sensors, which could then be used with python libraries. Have you considered using the nfcpy library? It would involve installing python, but it would save having to build your xinfc. I tried to use it but it does not work on the latest snapshot builds. Perhaps you could get it merged into the openwrt package repository?

I didn't use python because I wanted to keep the dependencies as minimal as possible. Get the xinfc into the OpenWRT package repo surely is an option.

If you are facing issues with a specific snapshot, please sent me the version and I can try to make a custom / automated build for it.

thanks for your message, sorry I just saw it today.

I figured out the problem. You must have this package installed: libstdcpp6

On the snapshot builds, this is not installed by default. After installing it worked properly. Thanks for this work!

1 Like

now that the xiaomi ax3000t has a proper build (23.05.4) are there any blockers on doing a proper openwrt package of xinfc ?

1 Like

Honestly, my knowledge on how to make a package... I'll dig a little on how to do it!

Hi, I'm trying to compile from sources using docker (https://github.com/Caian/xinfc/blob/master/DOCKER_HOWTO.md), but I'm getting some dependencies missing error messages. I don't know how to solve it. Can someone help me? Thanks!

$ make defconfig
Collecting package info: package/feeds/packages/udp-broadcast-relay-redux-openwr
Collecting package info: done
WARNING: Makefile 'package/feeds/packages/bcm27xx-eeprom/Makefile' has a dependency on 'bcm27xx-utils', which does not exist
WARNING: Makefile 'package/feeds/packages/boost/Makefile' has a dependency on 'libquadmath', which does not exist
WARNING: Makefile 'package/feeds/telephony/freeswitch/Makefile' has a dependency on 'libpcre', which does not exist
WARNING: Makefile 'package/feeds/packages/libmpc/Makefile' has a dependency on 'libmpfr', which does not exist
WARNING: Makefile 'package/feeds/packages/mc/Makefile' has a dependency on 'libe2p', which does not exist
WARNING: Makefile 'package/feeds/packages/owut/Makefile' has a dependency on 'ucode-mod-uclient', which does not exist
WARNING: Makefile 'package/feeds/packages/python-gmpy2/Makefile' has a dependency on 'libmpfr', which does not exist

None of those warnings are relevant to this tool, nor your build.

1 Like

Indeed, I followed step by step until the end of the instructions and was able to generate a binary.
Now the problem is the error that shows when I run it from my router (via ssh):
./xinfc-wsc: line 1: syntax error: unterminated quoted string

I tried to recompile using the last OpenWRT stable build (23.05.4) source code instead of dimfishr's build, but I get the same error message (above), with or without arguments, is the same error message.

Dependency from libstdcpp6 came from the fact, tool is written in C++.
So, total it occupies about 66k + 1900k for the library.
(and libstdcpp6 is not installed by default neither in snapshot, nor in stable).

If you build with -static-libstdc++ explicit dependency will disappear, but you'll finish with tool sized 720k.

That is, instead of
$CXX -O2 -Wall -Iinclude src/xinfc-wsc.cpp -o xinfc-wsc
it might be built with
$CXX -O3 -Wall -Iinclude -static-libstdc++ src/xinfc-wsc.cpp -o xinfc-wsc
Last cmd will produce even more huge file sized about 5.6m
but after strip sstrip xinfc-wsc you will finish with single binary without extra dependencies.