2013-10-24 104 views
0

有沒有一種方法可以使用javax.smartcardio.TerminalFactory來識別我的NFC讀卡器?與NFC(PC/SC)的Java通信

我使用Ubuntu 13.04與pcsc_scan我能夠讀取卡:

Reader 0: SCL010 Contactless Reader [SCL010 Contactless Reader] (21160951211983) 00 00 
    Card state: Card inserted, 
    ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A 

    ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A 
+ TS = 3B --> Direct Convention 
+ T0 = 8F, Y(1): 1000, K: 15 (historical bytes) 
    TD(1) = 80 --> Y(i+1) = 1000, Protocol T = 0 
----- 
    TD(2) = 01 --> Y(i+1) = 0000, Protocol T = 1 
----- 
+ Historical bytes: 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 
    Category indicator byte: 80 (compact TLV data object) 
    Tag: 4, len: F (initial access data) 
     Initial access data: 0C A0 00 00 03 06 03 00 01 00 00 00 00 
+ TCK = 6A (correct checksum) 

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt): 
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A 
3B 8F 80 01 80 4F 0C A0 00 00 03 06 .. 00 01 00 00 00 00 .. 
    Mifare Standard 1K (as per PCSC std part3) 
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A 
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 .. .. 00 00 00 00 .. 
    RFID - ISO 14443 Type A Part 3 (as per PCSC std part3) 
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A 

但隨着

CardTerminals terminals = TerminalFactory.getDefault().terminals(); 
List<CardTerminal> list = terminals.list(); 

總是返回一個空list

這是一個驅動程序問題?

回答

1

只要運行程序-Dsun.security.smartcardio.library=/lib/x86_64-linux-gnu/libpcsclite.so.1並且工作!

+1

當然,根據您的系統更改libpcsclite.so.1的路徑。順便給你節省很多時間,謝謝! :) – bdevay