Topic: Possibility to disable use of config files.

I am using libnfc in embedded environment where there is no storage and no filesystem therefore no files either. In this environment conf.c does not make sense. I propose adding --disable-conf (i.e. conf would be enabled by default) argument to the configure script (and equivalent thing for cmake).

I could provide patch for the autoconf scripts and c code if there is interest in this feature. I don't know cmake, so someone else would need to do that for cmake.

Actually there is one more request - make the length of connection string configurable. When memory is scarce (96k), 1024 bytes is a big waste. In my case 16 bytes would suffice.

Re: Possibility to disable use of config files.

--disable-conf purpose is only to reduce the size of the generated library, right?

For the connection string length, what do you suggest as configurable?

There are also other places with large allocations, e.g.: str_nfc_target() & its 4096b malloc

Note also that all malloc() are not properly tested, see https://code.google.com/p/libnfc/issues/detail?id=230 as you may run into problems before anybody else ;-)

Re: Possibility to disable use of config files.

No, not only to limit size, conf.c also uses things that are not available at my target platform (regular expressions, all file io functions).

> For the connection string length, what do you suggest as configurable?

Currently connection string type nfc_connstring is an array of 1024 chars. This 1024 is hard coded there. It could be replaced by NFC_CONNSTRING_MAX_SIZE for example.

This value would then come from config.h generated by the autoconf (or somewhere else is cmake is used?)

Thanks for the link. It looks that pn53x.c is the only one that could affect me.

4 (edited by yobibe 2013-02-18 22:57:30)

Re: Possibility to disable use of config files.

Romuald is busy implementing NFC_CONNSTRING_MAX_SIZE (and more...).
As you proposed so kindly, you can submit a patch to disable the config part.
Ideally you can do it in a git fork so your changes can be easily included with proper authorship.

Re: Possibility to disable use of config files.

Hello,

I just pushed the nfc_connstring customization capability...

You just have to set NFC_BUFSIZE_CONNSTRING, the way you want (CFLAGS, -D, config.h if made by hands, etc) before nfc-types.h is loaded.

Note: you have to know exactly what you do... eg. as nfc_connstring is public typedef, each programs that uses libnfc should set the same size...

Romuald Conty

Re: Possibility to disable use of config files.

The patch for disabling configuration can be found in my github clone git://github.com/leg0/libnfc.git branch disable-conf .

https://github.com/leg0/libnfc/tree/disable-conf

Re: Possibility to disable use of config files.

Thank you.
I'll have a look at it asap.
I've created an issue to make sure we don't forget it:
https://code.google.com/p/libnfc/issues/detail?id=234