Giter VIP home page Giter VIP logo

ndef's Issues

reading type 4 tag broken due to response length limit in inDataExchange()

I'm trying to read a RuuviTag to fetch configuration (ie MAC address)

the tag is recognized, but the code crashes in NfcTag NTAGType4::read() while parsing the NDEF content. The crash happens during the third record, when trying to parse unread content.

The reason is that the isoReadNTAGType4NdefFile method assumes the NDEF message can be read in one go by one inDataExchange() call

however inDataExchange() is limited to below 64 bytes (60 or so) actual return buffer size is limited to 64 bytes including overhead, see the pn532_packetbuffer definition

I see two ways of dealing with the issue:

  • in isoReadNTAGType4NdefFile loop over 60byte chunks until the whole file is read
  • consider implementing Extended Frame support

nfc-tools implemented extended frames

with Adafruit-PN532, there has been an attempt io address the issue:
adafruit/Adafruit-PN532#38 but that never was merged

so for a start the chunked read variant looks easier to do
while at it, it might make sense to factor out a generic file reading method (file id->(buffer, length)

this is what NXP Tag Info has to say about it:

** TagInfo Scan (version 4.28.0) 04-Dez.-23 18:58:39 **
Report Type: -- IC INFO ------------------------------

# IC Manufacturer:
Nordic Semiconductor

# IC Type:
Unknown IC implementing ISO/IEC 14443-4

# NFC Forum NDEF-compliant tag:
Type 4 Tag

# Application information:
Type 4 Tag v2 application present

-- NDEF ------------------------------

# NFC data set information:
NDEF message containing 4 records
Current message size: 129 bytes
Maximum message size: 238 bytes
NFC data set access: Read & Write

# Record #1: Text record:
Type Name Format: NFC Forum well-known type
Short Record
type: "T"
encoding: UTF-8
lang: "id"
text: "ID: C5:5A:B4:FC:52:5C:F4:B2"
Payload length: 30 bytes
Payload data:

[00] 02 69 64 49 44 3A 20 43 35 3A 35 41 3A 42 34 3A |.idID: C5:5A:B4:|

[10] 46 43 3A 35 32 3A 35 43 3A 46 34 3A 42 32       |FC:52:5C:F4:B2  |


# Record #2: Text record:
Type Name Format: NFC Forum well-known type
Short Record
type: "T"
encoding: UTF-8
lang: "ad"
text: "MAC: C2:6E:D1:70:2B:44"
Payload length: 25 bytes
Payload data:

[00] 02 61 64 4D 41 43 3A 20 43 32 3A 36 45 3A 44 31 |.adMAC: C2:6E:D1|

[10] 3A 37 30 3A 32 42 3A 34 34                      |:70:2B:44       |


# Record #3: Text record:
Type Name Format: NFC Forum well-known type
Short Record
type: "T"
encoding: UTF-8
lang: "sw"
text: "SW: Ruuvi FW v3.31.1+default"
Payload length: 31 bytes
Payload data:

[00] 02 73 77 53 57 3A 20 52 75 75 76 69 20 46 57 20 |.swSW: Ruuvi FW |

[10] 76 33 2E 33 31 2E 31 2B 64 65 66 61 75 6C 74    |v3.31.1+default |


# Record #4: Text record:
Type Name Format: NFC Forum well-known type
Short Record
type: "T"
encoding: UTF-8
lang: "dt"
text: "��`A��������$}V����n�p+D"
Payload length: 27 bytes
Payload data:

[00] 02 64 74 05 16 60 41 87 FF FF 03 10 FE 14 02 24 |.dt..`A........$|

[10] 7D 56 1A 00 0B C2 6E D1 70 2B 44                |}V....n.p+D     |


# NDEF message:
[00] 91 01 1E 54 02 69 64 49 44 3A 20 43 35 3A 35 41 |...T.idID: C5:5A|

[10] 3A 42 34 3A 46 43 3A 35 32 3A 35 43 3A 46 34 3A |:B4:FC:52:5C:F4:|

[20] 42 32 11 01 19 54 02 61 64 4D 41 43 3A 20 43 32 |B2...T.adMAC: C2|

[30] 3A 36 45 3A 44 31 3A 37 30 3A 32 42 3A 34 34 11 |:6E:D1:70:2B:44.|

[40] 01 1F 54 02 73 77 53 57 3A 20 52 75 75 76 69 20 |..T.swSW: Ruuvi |

[50] 46 57 20 76 33 2E 33 31 2E 31 2B 64 65 66 61 75 |FW v3.31.1+defau|

[60] 6C 74 51 01 1B 54 02 64 74 05 16 60 41 87 FF FF |ltQ..T.dt..`A...|

[70] 03 10 FE 14 02 24 7D 56 1A 00 0B C2 6E D1 70 2B |.....$}V....n.p+|

[80] 44                                              |D               |


# Capability Container (CC) file content:
Mapping version 2.0
CC length: 15 bytes
Maximum Le value: 248 bytes
Maximum Lc value: 248 bytes
NDEF File Control TLV:
* Length: 6 bytes
* NDEF file ID: 0xE104
* Maximum NDEF data size: 240 bytes
* NDEF access: Read & Write
[0] 00 0F 20 00 F8 00 F8 04 06 E1 04 00 F0 00 00    |.. ............ |


# Type 4 Tag File Control Information (FCI):
Type 4 Tag v2 application FCI: [none]
CC file FCI: [none]
NDEF file FCI: [none]

# NDEF file contents:
[00] 00 8D 81 01 00 00 00 1E 54 02 69 64 49 44 3A 20 |........T.idID: |

[10] 43 35 3A 35 41 3A 42 34 3A 46 43 3A 35 32 3A 35 |C5:5A:B4:FC:52:5|

[20] 43 3A 46 34 3A 42 32 01 01 00 00 00 19 54 02 61 |C:F4:B2......T.a|

[30] 64 4D 41 43 3A 20 43 32 3A 36 45 3A 44 31 3A 37 |dMAC: C2:6E:D1:7|

[40] 30 3A 32 42 3A 34 34 01 01 00 00 00 1F 54 02 73 |0:2B:44......T.s|

[50] 77 53 57 3A 20 52 75 75 76 69 20 46 57 20 76 33 |wSW: Ruuvi FW v3|

[60] 2E 33 31 2E 31 2B 64 65 66 61 75 6C 74 41 01 00 |.31.1+defaultA..|

[70] 00 00 1B 54 02 64 74 05 16 60 41 87 FF FF 03 10 |...T.dt..`A.....|

[80] FE 14 02 24 7D 56 1A 00 0B C2 6E D1 70 2B 44    |...$}V....n.p+D |


-- EXTRA ------------------------------

# TagInfo Version:
Version :4.28.0

# Device Info:
Device Model :samsung ( SM-A136B )
Android OS Version :13

-- FULL SCAN ------------------------------

--------------------------------------

````

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.