Prez1313 / libnfc

Automatically exported from code.google.com/p/libnfc
GNU Lesser General Public License v3.0
1 stars 0 forks source link

Reset device configuration settings. #108

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Some device configuration settings are kept after a program terminates (e.g. 
NDO_AUTO_ISO14443_4 introduced at r554).  When another program is run, it may 
be affected by the previously set configuration.

Devices should have the same behaviour regardless of the programs that where 
previously using them.

Original issue reported on code.google.com by romain.t...@gmail.com on 3 Sep 2010 at 2:21

GoogleCodeExporter commented 9 years ago

Original comment by romain.t...@gmail.com on 3 Sep 2010 at 2:21

GoogleCodeExporter commented 9 years ago
IMHO this issue is a major one and shall be fixed before 1.4 is released.

I suggest providing an init function that sets all options to their default 
value.

Can you please review these default settings:
NDO_HANDLE_CRC: true
NDO_HANDLE_PARITY: true
NDO_ACTIVATE_FIELD: true
NDO_ACTIVATE_CRYPTO1: false
NDO_INFINITE_SELECT: true
NDO_ACCEPT_INVALID_FRAMES: false
NDO_ACCEPT_MULTIPLE_FRAMES: false
NDO_AUTO_ISO14443_4: true
NDO_EASY_FRAMING: true

Original comment by romain.t...@gmail.com on 4 Sep 2010 at 10:36

GoogleCodeExporter commented 9 years ago
r601 set NDO_AUTO_ISO14443_4 to true.

Original comment by romu...@libnfc.org on 6 Sep 2010 at 1:34

GoogleCodeExporter commented 9 years ago
NDO_HANDLE_CRC: true
NDO_HANDLE_PARITY: true
NDO_ACTIVATE_FIELD: true
NDO_ACCEPT_INVALID_FRAMES: false
NDO_ACCEPT_MULTIPLE_FRAMES: false
NDO_AUTO_ISO14443_4: true
NDO_EASY_FRAMING: true

but

NDO_INFINITE_SELECT: false (means select() is not a blocking function)
NDO_ACTIVATE_CRYPTO1: true (used by MIFARE Classic)

Original comment by romu...@libnfc.org on 6 Sep 2010 at 2:43

GoogleCodeExporter commented 9 years ago
CRYPTO1 is disabled by default [1] and automagically enabled when a connection 
with a Mifare Classic is established according to the comment in nfc-types.h 
[2] and the fact that there is no code that nfc_configure it back to true.

1. 
http://code.google.com/p/libnfc/source/browse/trunk/libnfc/nfc.c?spec=svn601&r=6
01#168
2. 
http://code.google.com/p/libnfc/source/browse/trunk/include/nfc/nfc-types.h?r=60
1#149

Original comment by romain.t...@gmail.com on 7 Sep 2010 at 11:30

GoogleCodeExporter commented 9 years ago
You are right!
Ok, we now have all settings, there are two places to initialise the device:
At nfc_connect() time (like it already done for NDO_HANDLE_CRC, 
NDO_HANDLE_PARITY and NDO_ACTIVATE_CRYPTO1) or at 
nfc_initiator_init()/nfc_target_init() time.

Original comment by romu...@libnfc.org on 7 Sep 2010 at 4:58

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r607.

Original comment by romu...@libnfc.org on 7 Sep 2010 at 5:33