Wednesday, May 28, 2014

format NDEF for Felica Lite S tag

因為工作的需要
同事買了 NFC Forum Type 3 的 tag 來測試

http://www.identivenfc.com/en/nfc-tags/identive-blank-nfc-tags/blank-nfc-tags-type-3-felica-lite-42mm-dia.htm

這個 tag 其實就是 Felica Lite S RC-S966

http://www.sony.net/Products/felica/business/products/RC-S966.html

但現在遇到的問題是 不能寫 NDEF 進去

看了 Felica Lite S 的 spec,

http://www.sony.net/Products/felica/business/tech-support/#Lite01S

3.1.12 MC
裡面提到

Byte3: System Option (SYS_OP)
Perform the setting to store NDEF data. When the value of this Byte is 01h, FeliCa Lite-S is compatible
with NDEF
, and returns a response to the Polling command in which System Code of 88B4h or 12FCh is
specified. If compatibility with NDEF is unnecessary, set this Byte to 00h. With this setting, FeliCa Lite-S
returns a response only to the Polling command in which System Code of 88B4h is specified.
01h: Compatible with NDEF
00h: Incompatible with NDEF
02h-FFh: Reserve

拿了 TagInfo 的 app 來看這個 tag, 果真是 00h
(Block 88h, MC)


正在想說是不是要有什麼 Felica Writer 才能寫 NDEF 進去時
有發現到
  • NdefFormatable 只有在 Type 1 and Type 2 (Mifare-UL) 的 tag 才會有
http://androidxref.com/4.4.2_r2/xref/packages/apps/Nfc/nci/jni/NativeNfcTag.cpp#1347

  • 在 libnfc-nci 裡有對 Felica format 的 function, "RW_T3tFormatNDef", 而這會被 NFA_RwFormatTag() call 到,而且這個 API, 只對 Felica-Lite 的 tag 有效!
所以就想試著用這個 function 來 format 這個 Felica Lite S 的 tag
我的手機是 Nexus 5
再 call 了 NFA_RwFormatTag() 後 ,果真 format 成 NDEF format 了!!!