Samuel Ortiz [Fri, 11 Oct 2013 15:40:51 +0000 (17:40 +0200)]
adapter: Do not send a poll command when adapter is down
No need to go through the kernel netlink NFC API if the adapter is known
to be down.
Samuel Ortiz [Fri, 11 Oct 2013 15:20:52 +0000 (17:20 +0200)]
AUTHORS: Mention Dmytro's contributions
Dmytro Bagrii [Thu, 10 Oct 2013 13:59:26 +0000 (16:59 +0300)]
nfctool: Fix options type
G_OPTION_ARG_NONE flag in GOptionEntry expects gboolean type instead
of bool.
On platforms where sizeof(bool) != sizeof(gboolean), this patch fixes
runtime parsing error for nfctool.
Dmytro Bagrii [Fri, 4 Oct 2013 12:37:45 +0000 (15:37 +0300)]
build: Fix build in separate directory
neard build fails when performed in a separate directory.
In this case include/near directory contains broken symlinks
and error appears:
neard/plugins/phdc.c:32:23: fatal error: near/dbus.h: No such file or
directory
Szymon Janc [Thu, 10 Oct 2013 07:46:11 +0000 (09:46 +0200)]
nfctype2: Remove not needed NULL assignment
cookie is local pointer so there is no need to NULL it when memory
gets released.
Szymon Janc [Thu, 10 Oct 2013 07:46:10 +0000 (09:46 +0200)]
nfctype1: Remove dead code from nfctype1_write
This was never called and cb will be called by data_write in case of
failure so 'return data_write()' is OK.
Samuel Ortiz [Sun, 22 Sep 2013 22:52:34 +0000 (00:52 +0200)]
npp: Implement npp_push
NPP is simple: Get the NDEF, include it in an NPP NDEF entry, add an
header and just send it to the peer. That's it.
Samuel Ortiz [Sun, 22 Sep 2013 22:45:45 +0000 (00:45 +0200)]
npp: Fix npp_read
Data needs to be added to the device, not the tag.
Also, check the version number.
Samuel Ortiz [Tue, 17 Sep 2013 18:11:19 +0000 (20:11 +0200)]
Release 0.13
Luiz Augusto von Dentz [Wed, 4 Sep 2013 18:57:20 +0000 (21:57 +0300)]
gdbus/client: Use g_dbus_add_properties_watch to track properties
This make the handling much simpler and avoids duplicates of the same
match rule.
Luiz Augusto von Dentz [Mon, 2 Sep 2013 15:54:33 +0000 (18:54 +0300)]
gdbus/client: Use g_dbus_add_signal_watch to track signals
This make the handling much simpler and avoids duplicates of the same
match rule.
Luiz Augusto von Dentz [Mon, 2 Sep 2013 13:02:05 +0000 (16:02 +0300)]
gdbus/client: Use g_dbus_add_service_watch to track services
This make the handling much simpler and avoids duplicates of the same
match rule.
Luiz Augusto von Dentz [Mon, 9 Sep 2013 08:25:12 +0000 (11:25 +0300)]
gdbus/watch: Fix crash when disconnecting from D-Bus
When disconnecting from D-Bus a message could be recieved with no sender:
Invalid read of size 1
at 0x4A09EE1: strcmp (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x3B03C386B8: g_str_equal (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x4065D6: message_filter (watch.c:529)
by 0x3B0700F9E5: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4)
by 0x4052E7: message_dispatch (mainloop.c:76)
by 0x3B03C48962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3B03C47E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3B03C48157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3B03C48559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x4038C5: client_proxy_removed (test-gdbus-client.c:902)
by 0x3B03C6B566: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3B03C6B6E5: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
Address 0x0 is not stack'd, malloc'd or (recently) free'd
Luiz Augusto von Dentz [Tue, 3 Sep 2013 15:00:35 +0000 (18:00 +0300)]
gdbus/watch: Fix aborting when removing D-Bus filter
In case of filter_data having a watch to a service name it may call
dbus_connection_remove_filter twice causing libdbus to abort:
process 24723: Attempt to remove filter function 0x4063e0 user data (nil), but no such filter has been added
To fix this the code will now only attempt to call
dbus_connection_remove_filter once in filter_data_free which is the
counterpart of filter_data_get where dbus_connection_add_filter is called.
Luiz Augusto von Dentz [Mon, 2 Sep 2013 12:55:45 +0000 (15:55 +0300)]
gdbus/watch: Fix crash when g_dbus_remove_watch is called from connect callback
at 0x40570C: update_service (watch.c:601)
by 0x40584B: service_reply (watch.c:627)
by 0x3B0700C511: ??? (in /usr/lib64/libdbus-1.so.3.7.4)
by 0x3B0700F740: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4)
by 0x405167: message_dispatch (mainloop.c:76)
by 0x3B03C48962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3B03C47E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3B03C48157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3B03C48559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
Address 0x4c58a30 is 32 bytes inside a block of size 56 free'd
at 0x4A074C4: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x3B03C4D9AE: g_free (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x406102: filter_data_remove_callback (watch.c:378)
by 0x405FC0: g_dbus_remove_watch (watch.c:798)
by 0x40A22B: g_dbus_client_unref (client.c:1227)
by 0x40570B: update_service (watch.c:599)
by 0x40584B: service_reply (watch.c:627)
Luiz Augusto von Dentz [Mon, 19 Aug 2013 13:54:35 +0000 (16:54 +0300)]
gdbus: Fix emitting PropertiesChanged twice
This fixes double emission of PropertiesChanged introduced by flushing
changes, the flushing can happen during the pending processing so the
pending_prop flag needs to be updated in the beginning and the list of
properties can be freed before g_dbus_send_message as it is not required
anymore.
Luiz Augusto von Dentz [Mon, 19 Aug 2013 13:05:15 +0000 (16:05 +0300)]
gdbus: Avoid calling dbus_connection_send*
dbus_connection_send* should not be called directly except by
g_dbus_send_message.
Luiz Augusto von Dentz [Mon, 19 Aug 2013 12:25:57 +0000 (15:25 +0300)]
gdbus: Add g_dbus_send_message_with_reply
g_dbus_send_message_with_reply flushes pending signals before calling
dbus_connection_send_with_reply so it does not alter the message order
Luiz Augusto von Dentz [Mon, 19 Aug 2013 11:39:28 +0000 (14:39 +0300)]
gdbus: Fix sending ObjectManager/Properties signals out of order
In some cases the order of the messages is altered when a message is
sent without processing the pending signals first, currently this affect
client_check_order unit test:
/gdbus/client_check_order: **
ERROR:unit/test-gdbus-client.c:795:property_check_order: assertion failed: (g_strcmp0(string, "value1") == 0)
As can be observed the value of the property is not yet updated because the
signal it is still pending, once this fix is applied the test pass:
/gdbus/client_check_order: OK
Note that the flushing only works when g_dbus_send_message is used so
places where dbus_connection_send and other variants are called directly
may still change the order.
Thierry Escande [Mon, 9 Sep 2013 16:27:08 +0000 (18:27 +0200)]
nfctool: Add firmware download command
This adds a command line option (--fw-download or -w) to start firmware
download process on the specified device with the passed firmware
filename.
e.g. nfctool -d nfc0 --fw-download fw_filename
Thierry Escande [Mon, 9 Sep 2013 16:27:07 +0000 (18:27 +0200)]
nfctool: netlink: Pass attributes to registered callbacks
This passes the netlink attributes structure of an event to the
registered callback through its data argument.
Thierry Escande [Mon, 9 Sep 2013 16:27:06 +0000 (18:27 +0200)]
nfc_copy: Update nfc_copy.h with SE command and firmware download status
It also renames NFC_CMD_FW_UPLOAD to NFC_CMD_FW_DOWNLOAD.
Olivier Guiter [Mon, 2 Sep 2013 10:32:18 +0000 (12:32 +0200)]
phdc: API documentation and sample code
This sample code publishes two phdc Managers, to validate the phdc
driver. It relies on nfcpy test code for simulating a phdc thermometer.
Olivier Guiter [Mon, 2 Sep 2013 10:32:17 +0000 (12:32 +0200)]
neard: Change in dbus conf to allow PHDC managers and agents
Olivier Guiter [Mon, 2 Sep 2013 10:32:16 +0000 (12:32 +0200)]
phdc: Initial PHDC implementation
Code to add the PHDC p2p driver. This driver will publish a dbus
interface to facilitate PHDC Managers registration. This code handles
multiple Managers.
Managers (or Agents) should register using RegisterAgent(), and should
publish a specific interface "org.neard.PHDC.Manager" or
"org.neard.PHDC.Agent".
PHDC is different from usual p2p services as it is a proprietary
service. The PHDC Manager (external to neard) notify neard for being
registered on specific services urn (e.g: urn:nfc:sn:phdc)
The PHDC Agent connects to this specific urn using p2p, and the newly
created p2p file descriptor is forwarded to the PHDC Manager.
Doing this, the PHDC driver acts as a passthru, allowing the Agent to
exchange with the Manager.
Olivier Guiter [Mon, 2 Sep 2013 10:32:15 +0000 (12:32 +0200)]
p2p: Add new_client method in p2p struct
p2p registrees will be notified through this method of a new client
connection.
Olivier Guiter [Mon, 2 Sep 2013 10:32:14 +0000 (12:32 +0200)]
p2p: Add a user_data pointer to p2p struct
user_data pointer is added to p2p internal structure and is sent
(as param) in every p2p functions (read, push, close,...).
Patrik Flykt [Mon, 26 Aug 2013 10:03:48 +0000 (13:03 +0300)]
main: Use gboolean type in GOptionEntry
The GOptionEntry options need to be of gboolean type as they are passed
as pointers. When the size of gboolean is different from the size of
bool, it will cause option variables to be overwritten by each other.
Olivier Guiter [Tue, 27 Aug 2013 14:56:22 +0000 (16:56 +0200)]
p2p: Remove const from service and driver name
Removing const qualifier allows drivers to be added
dynamically (at execution time). This will be used for
PHDC managers.
Olivier Guiter [Tue, 27 Aug 2013 14:56:21 +0000 (16:56 +0200)]
p2p: Change p2p_register to look for service name
On p2p driver registration, the search is now done with the
service name (instead of the driver name).
Olivier Guiter [Tue, 27 Aug 2013 14:56:20 +0000 (16:56 +0200)]
error: Add ENOMEM error string message
Lars Poeschel [Tue, 27 Aug 2013 12:25:25 +0000 (14:25 +0200)]
nfctype4: Fix a memory leak in t4_readbin_cc
In t4_readbin_cc memory is allocated and response data is
copied into it just do read access on different fields of
this memory. The allocated memory was never freed.
This patch replaces the allocation and copy by just casting
the response data to a pointer thus eleminating the memory
leak.
Samuel Ortiz [Fri, 23 Aug 2013 09:26:38 +0000 (11:26 +0200)]
bluetooth: Make the default adapter callback error less confusing
Many people translated the "No such adapter" error string as "Hey, there
is no NFC adapter on this machine". Let's be a little clearer.
Samuel Ortiz [Tue, 20 Aug 2013 09:08:55 +0000 (11:08 +0200)]
AUTHORS: Mention Daniel's contributions
Daniel Wagner [Wed, 14 Aug 2013 07:28:00 +0000 (09:28 +0200)]
doc: Change coding style for NULL pointer checks
Daniel Wagner [Wed, 14 Aug 2013 07:27:59 +0000 (09:27 +0200)]
unit: Do not compare expression against NULL
This patch generate via coccinelle with:
@ disable is_null,isnt_null1 @
expression E;
@@
(
- E == NULL
+ !E
|
- E != NULL
+ E
)
Daniel Wagner [Wed, 14 Aug 2013 07:27:58 +0000 (09:27 +0200)]
tools: Do not compare expression against NULL
This patch generate via coccinelle with:
@ disable is_null,isnt_null1 @
expression E;
@@
(
- E == NULL
+ !E
|
- E != NULL
+ E
)
Daniel Wagner [Wed, 14 Aug 2013 07:27:57 +0000 (09:27 +0200)]
core: Do not compare expression against NULL
This patch generate via coccinelle with:
@ disable is_null,isnt_null1 @
expression E;
@@
(
- E == NULL
+ !E
|
- E != NULL
+ E
)
Daniel Wagner [Wed, 14 Aug 2013 07:27:56 +0000 (09:27 +0200)]
plugins: Do not compare expression against NULL
This patch generate via coccinelle with:
@ disable is_null,isnt_null1 @
expression E;
@@
(
- E == NULL
+ !E
|
- E != NULL
+ E
)
Daniel Wagner [Wed, 14 Aug 2013 07:27:55 +0000 (09:27 +0200)]
types: Remove near_bool_t definition
Daniel Wagner [Wed, 14 Aug 2013 07:27:54 +0000 (09:27 +0200)]
unit: Use stdbool instead gboolean or near_bool_t
This patch has been created via coccinelle:
// Rule set 1
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, near_bool_t i, ...);
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@@
typedef bool;
@@
- near_bool_t
+ bool
// Rule set 2
// This is not a beautiful script but it does the job.
// Improvemtents are welcome.
// Fix all assigments but do not convert yet the type
@@
gboolean x;
@@
x =
(
- TRUE
+ true
|
- FALSE
+ false
)
// Figure out which function signature will to be fixed...
// when we have the defitition
@r@
identifier f;
parameter list[n] ps;
identifier i;
@@
f(ps, gboolean i, ...) { ... }
// ... and now convert all call sites
@@
identifier r.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// Figure out which function signature will to be fixed...
// when we have the declaration only
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, gboolean i, ...);
// ... and now convert all call sites
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// A handfull of the GLib hooks we can't change. Let's remember
// all ther positions.
// 1. timeouts
@k1@
identifier f;
position p;
typedef gpointer;
identifier ptr;
@@
static gboolean@p f(gpointer ptr);
@k2@
identifier f;
position p;
identifier ptr;
@@
static gboolean@p f(gpointer ptr) { ... }
// hash map iterator functions
@k3@
identifier f;
position p;
identifier p1, p2, p3;
@@
static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... }
// 2. GIOChannel
@k4@
identifier f;
position p;
typedef GIOChannel, GIOCondition;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr);
@k5@
identifier f;
position p;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... }
// 3. GSourceFuncs
@k6@
identifier f;
position p;
typedef GSource;
identifier src;
@@
static gboolean@p f(GSource *src, ...) { ... }
// gdbus functions
@k7@
identifier f;
position p;
typedef DBusConnection;
identifier con;
@@
static gboolean@p f(DBusConnection *con, ...) { ... }
// Now convert all gboolean which are are not used for interactin
// with GLib
// Note here happens the magic!
@@
typedef bool;
position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p};
@@
- gboolean@p
+ bool
// Update all return types
@@
identifier f;
@@
bool f(...) {
<...
- return TRUE;
+ return true;
...>
}
@@
identifier f;
@@
bool f(...) {
<...
- return FALSE;
+ return false;
...>
}
// Rule set 3
@@
expression E;
symbol TRUE;
symbol FALSE;
@@
(
E
- == TRUE
|
- TRUE == E
+ E
|
- E != TRUE
+ !E
|
- TRUE != E
+ !E
|
- E == FALSE
+ !E
|
- FALSE == E
+ !E
|
E
- != FALSE
|
- FALSE != E
+ E
)
Daniel Wagner [Wed, 14 Aug 2013 07:27:53 +0000 (09:27 +0200)]
tools: Use stdbool instead gboolean or near_bool_t
This patch has been created via coccinelle:
// Rule set 1
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, near_bool_t i, ...);
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@@
typedef bool;
@@
- near_bool_t
+ bool
// Rule set 2
// This is not a beautiful script but it does the job.
// Improvemtents are welcome.
// Fix all assigments but do not convert yet the type
@@
gboolean x;
@@
x =
(
- TRUE
+ true
|
- FALSE
+ false
)
// Figure out which function signature will to be fixed...
// when we have the defitition
@r@
identifier f;
parameter list[n] ps;
identifier i;
@@
f(ps, gboolean i, ...) { ... }
// ... and now convert all call sites
@@
identifier r.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// Figure out which function signature will to be fixed...
// when we have the declaration only
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, gboolean i, ...);
// ... and now convert all call sites
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// A handfull of the GLib hooks we can't change. Let's remember
// all ther positions.
// 1. timeouts
@k1@
identifier f;
position p;
typedef gpointer;
identifier ptr;
@@
static gboolean@p f(gpointer ptr);
@k2@
identifier f;
position p;
identifier ptr;
@@
static gboolean@p f(gpointer ptr) { ... }
// hash map iterator functions
@k3@
identifier f;
position p;
identifier p1, p2, p3;
@@
static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... }
// 2. GIOChannel
@k4@
identifier f;
position p;
typedef GIOChannel, GIOCondition;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr);
@k5@
identifier f;
position p;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... }
// 3. GSourceFuncs
@k6@
identifier f;
position p;
typedef GSource;
identifier src;
@@
static gboolean@p f(GSource *src, ...) { ... }
// gdbus functions
@k7@
identifier f;
position p;
typedef DBusConnection;
identifier con;
@@
static gboolean@p f(DBusConnection *con, ...) { ... }
// Now convert all gboolean which are are not used for interactin
// with GLib
// Note here happens the magic!
@@
typedef bool;
position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p};
@@
- gboolean@p
+ bool
// Update all return types
@@
identifier f;
@@
bool f(...) {
<...
- return TRUE;
+ return true;
...>
}
@@
identifier f;
@@
bool f(...) {
<...
- return FALSE;
+ return false;
...>
}
// Rule set 3
@@
expression E;
symbol TRUE;
symbol FALSE;
@@
(
E
- == TRUE
|
- TRUE == E
+ E
|
- E != TRUE
+ !E
|
- TRUE != E
+ !E
|
- E == FALSE
+ !E
|
- FALSE == E
+ !E
|
E
- != FALSE
|
- FALSE != E
+ E
)
Daniel Wagner [Wed, 14 Aug 2013 07:27:52 +0000 (09:27 +0200)]
core: Use stdbool instead gboolean or near_bool_t
This patch has been created via coccinelle:
// Rule set 1
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, near_bool_t i, ...);
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@@
typedef bool;
@@
- near_bool_t
+ bool
// Rule set 2
// This is not a beautiful script but it does the job.
// Improvemtents are welcome.
// Fix all assigments but do not convert yet the type
@@
gboolean x;
@@
x =
(
- TRUE
+ true
|
- FALSE
+ false
)
// Figure out which function signature will to be fixed...
// when we have the defitition
@r@
identifier f;
parameter list[n] ps;
identifier i;
@@
f(ps, gboolean i, ...) { ... }
// ... and now convert all call sites
@@
identifier r.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// Figure out which function signature will to be fixed...
// when we have the declaration only
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, gboolean i, ...);
// ... and now convert all call sites
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// A handfull of the GLib hooks we can't change. Let's remember
// all ther positions.
// 1. timeouts
@k1@
identifier f;
position p;
typedef gpointer;
identifier ptr;
@@
static gboolean@p f(gpointer ptr);
@k2@
identifier f;
position p;
identifier ptr;
@@
static gboolean@p f(gpointer ptr) { ... }
// hash map iterator functions
@k3@
identifier f;
position p;
identifier p1, p2, p3;
@@
static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... }
// 2. GIOChannel
@k4@
identifier f;
position p;
typedef GIOChannel, GIOCondition;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr);
@k5@
identifier f;
position p;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... }
// 3. GSourceFuncs
@k6@
identifier f;
position p;
typedef GSource;
identifier src;
@@
static gboolean@p f(GSource *src, ...) { ... }
// gdbus functions
@k7@
identifier f;
position p;
typedef DBusConnection;
identifier con;
@@
static gboolean@p f(DBusConnection *con, ...) { ... }
// Now convert all gboolean which are are not used for interactin
// with GLib
// Note here happens the magic!
@@
typedef bool;
position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p};
@@
- gboolean@p
+ bool
// Update all return types
@@
identifier f;
@@
bool f(...) {
<...
- return TRUE;
+ return true;
...>
}
@@
identifier f;
@@
bool f(...) {
<...
- return FALSE;
+ return false;
...>
}
// Rule set 3
@@
expression E;
symbol TRUE;
symbol FALSE;
@@
(
E
- == TRUE
|
- TRUE == E
+ E
|
- E != TRUE
+ !E
|
- TRUE != E
+ !E
|
- E == FALSE
+ !E
|
- FALSE == E
+ !E
|
E
- != FALSE
|
- FALSE != E
+ E
)
Daniel Wagner [Wed, 14 Aug 2013 07:27:51 +0000 (09:27 +0200)]
plugins: Use stdbool instead gboolean or near_bool_t
This patch has been created via coccinelle:
// Rule set 1
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, near_bool_t i, ...);
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@@
typedef bool;
@@
- near_bool_t
+ bool
// Rule set 2
// This is not a beautiful script but it does the job.
// Improvemtents are welcome.
// Fix all assigments but do not convert yet the type
@@
gboolean x;
@@
x =
(
- TRUE
+ true
|
- FALSE
+ false
)
// Figure out which function signature will to be fixed...
// when we have the defitition
@r@
identifier f;
parameter list[n] ps;
identifier i;
@@
f(ps, gboolean i, ...) { ... }
// ... and now convert all call sites
@@
identifier r.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// Figure out which function signature will to be fixed...
// when we have the declaration only
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, gboolean i, ...);
// ... and now convert all call sites
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// A handfull of the GLib hooks we can't change. Let's remember
// all ther positions.
// 1. timeouts
@k1@
identifier f;
position p;
typedef gpointer;
identifier ptr;
@@
static gboolean@p f(gpointer ptr);
@k2@
identifier f;
position p;
identifier ptr;
@@
static gboolean@p f(gpointer ptr) { ... }
// hash map iterator functions
@k3@
identifier f;
position p;
identifier p1, p2, p3;
@@
static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... }
// 2. GIOChannel
@k4@
identifier f;
position p;
typedef GIOChannel, GIOCondition;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr);
@k5@
identifier f;
position p;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... }
// 3. GSourceFuncs
@k6@
identifier f;
position p;
typedef GSource;
identifier src;
@@
static gboolean@p f(GSource *src, ...) { ... }
// gdbus functions
@k7@
identifier f;
position p;
typedef DBusConnection;
identifier con;
@@
static gboolean@p f(DBusConnection *con, ...) { ... }
// Now convert all gboolean which are are not used for interactin
// with GLib
// Note here happens the magic!
@@
typedef bool;
position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p};
@@
- gboolean@p
+ bool
// Update all return types
@@
identifier f;
@@
bool f(...) {
<...
- return TRUE;
+ return true;
...>
}
@@
identifier f;
@@
bool f(...) {
<...
- return FALSE;
+ return false;
...>
}
// Rule set 3
@@
expression E;
symbol TRUE;
symbol FALSE;
@@
(
E
- == TRUE
|
- TRUE == E
+ E
|
- E != TRUE
+ !E
|
- TRUE != E
+ !E
|
- E == FALSE
+ !E
|
- FALSE == E
+ !E
|
E
- != FALSE
|
- FALSE != E
+ E
)
Daniel Wagner [Wed, 14 Aug 2013 07:27:50 +0000 (09:27 +0200)]
include: Use stdbool instead gboolean or near_bool_t
This patch has been created via coccinelle:
// Rule set 1
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, near_bool_t i, ...);
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@@
typedef bool;
@@
- near_bool_t
+ bool
// Rule set 2
// This is not a beautiful script but it does the job.
// Improvemtents are welcome.
// Fix all assigments but do not convert yet the type
@@
gboolean x;
@@
x =
(
- TRUE
+ true
|
- FALSE
+ false
)
// Figure out which function signature will to be fixed...
// when we have the defitition
@r@
identifier f;
parameter list[n] ps;
identifier i;
@@
f(ps, gboolean i, ...) { ... }
// ... and now convert all call sites
@@
identifier r.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// Figure out which function signature will to be fixed...
// when we have the declaration only
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, gboolean i, ...);
// ... and now convert all call sites
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// A handfull of the GLib hooks we can't change. Let's remember
// all ther positions.
// 1. timeouts
@k1@
identifier f;
position p;
typedef gpointer;
identifier ptr;
@@
static gboolean@p f(gpointer ptr);
@k2@
identifier f;
position p;
identifier ptr;
@@
static gboolean@p f(gpointer ptr) { ... }
// hash map iterator functions
@k3@
identifier f;
position p;
identifier p1, p2, p3;
@@
static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... }
// 2. GIOChannel
@k4@
identifier f;
position p;
typedef GIOChannel, GIOCondition;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr);
@k5@
identifier f;
position p;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... }
// 3. GSourceFuncs
@k6@
identifier f;
position p;
typedef GSource;
identifier src;
@@
static gboolean@p f(GSource *src, ...) { ... }
// gdbus functions
@k7@
identifier f;
position p;
typedef DBusConnection;
identifier con;
@@
static gboolean@p f(DBusConnection *con, ...) { ... }
// Now convert all gboolean which are are not used for interactin
// with GLib
// Note here happens the magic!
@@
typedef bool;
position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p};
@@
- gboolean@p
+ bool
// Update all return types
@@
identifier f;
@@
bool f(...) {
<...
- return TRUE;
+ return true;
...>
}
@@
identifier f;
@@
bool f(...) {
<...
- return FALSE;
+ return false;
...>
}
// Rule set 3
@@
expression E;
symbol TRUE;
symbol FALSE;
@@
(
E
- == TRUE
|
- TRUE == E
+ E
|
- E != TRUE
+ !E
|
- TRUE != E
+ !E
|
- E == FALSE
+ !E
|
- FALSE == E
+ !E
|
E
- != FALSE
|
- FALSE != E
+ E
)
Daniel Wagner [Wed, 14 Aug 2013 07:27:49 +0000 (09:27 +0200)]
core: Include stdbool.h
In preperation to drop near_bool_t and use stdbool instead.
Daniel Wagner [Wed, 14 Aug 2013 07:27:48 +0000 (09:27 +0200)]
include: Include stdbool.h
In preperation to drop near_bool_t and use stdbool instead.
Daniel Wagner [Wed, 14 Aug 2013 07:27:47 +0000 (09:27 +0200)]
plugins: Include stdbool.h
In preperation to drop near_bool_t and use stdbool instead.
Daniel Wagner [Wed, 14 Aug 2013 07:27:46 +0000 (09:27 +0200)]
tag: Use dbus_bool_t for D-Bus function
Daniel Wagner [Wed, 14 Aug 2013 07:27:45 +0000 (09:27 +0200)]
adapter: Use dbus_bool_t for D-Bus functions
Samuel Ortiz [Mon, 19 Aug 2013 14:40:59 +0000 (16:40 +0200)]
nfctype1: Use the right offset after the CC
The Capability container is 4 bytes long and the NDEF data can be found
right after that. The offset for the static memory on a dynamic tag
should thus be the length of the CC and not more.
Syam Sidhardhan [Tue, 30 Jul 2013 19:12:42 +0000 (04:12 +0900)]
src: Remove redundant include config.h
Syam Sidhardhan [Tue, 30 Jul 2013 17:49:08 +0000 (02:49 +0900)]
tag.h: Remove header declared but not defined
Syam Sidhardhan [Tue, 30 Jul 2013 17:49:07 +0000 (02:49 +0900)]
adapter.h: Remove header declared but not defined
Samuel Ortiz [Tue, 30 Jul 2013 09:59:19 +0000 (11:59 +0200)]
handover: Fix memory leak on reallocation error
A temporay variable is used for checking the realloc() return value.
Otherwise ndef->ndef is leaked when realloc fails as it is then set to
NULL.
With this fix, ndef->ndef is updated iff realloc() succeeds.
Reported by Szymon Janc <szymon.janc@tieto.com>
Syam Sidhardhan [Sun, 28 Jul 2013 17:38:28 +0000 (02:38 +0900)]
handover: Fix incorrect NULL check
Need to check the return value of g_try_realloc()
instead of (ndef == NULL).
Samuel Ortiz [Mon, 22 Jul 2013 13:39:06 +0000 (15:39 +0200)]
nfc_copy: Update nfc_copy.h with SE and firmware upload APIs
Samuel Ortiz [Fri, 19 Jul 2013 23:28:34 +0000 (01:28 +0200)]
TODO: Update and cleanup
Szymon Janc [Fri, 12 Jul 2013 08:55:53 +0000 (10:55 +0200)]
unit: Add test for Handover Select
This adds test for HS. Currently test is not enabled as it is not
possible to run HO code as unit test now as this code does both
parsing and acting (eg. trying to access HO agent) in same run.
This test is added for reference and should be enabled when handover
code is splitted into parsing and acting functions.
Samuel Ortiz [Fri, 19 Jul 2013 09:09:50 +0000 (11:09 +0200)]
doc: Remove monitor-tag and monitor-device
monitor-near also monitor tags and devices, so let's avoid redundancy.
Fixes #NFC-51
Szymon Janc [Fri, 12 Jul 2013 08:55:54 +0000 (10:55 +0200)]
TODO: Add NDEF split
Szymon Janc [Fri, 12 Jul 2013 08:55:52 +0000 (10:55 +0200)]
build: Add unit/test-snep-read to .gitignore
Szymon Janc [Fri, 12 Jul 2013 08:55:51 +0000 (10:55 +0200)]
ndef: Make near_ndef_prepare_ac_message ready for multibyte cdr
This allows to acctually create multibye cdr if needed. Currently neard
always use one byte cdr but let us be in match with spec and a bit more
future proof.
Szymon Janc [Fri, 12 Jul 2013 08:55:50 +0000 (10:55 +0200)]
ndef: Make near_ndef_prepare_cfg_message accept cdr as pointer
This allows to acctually create multibye cdr if needed. Currently neard
always use one byte cdr but let us be in match with spec and a bit more
future proof.
Szymon Janc [Fri, 12 Jul 2013 08:55:49 +0000 (10:55 +0200)]
ndef: Remove unused struct near_ndef_carrier_data
This is not used anywhere in the code.
Szymon Janc [Fri, 12 Jul 2013 08:55:48 +0000 (10:55 +0200)]
ndef: Make cdr in near_ndef_ac_payload multibyte
cdr is a multibyte field. This removes assumption in code that cdr is
one byte only.
Samuel Ortiz [Tue, 16 Jul 2013 09:15:19 +0000 (11:15 +0200)]
doc: Document the Push method dictionary content
Samuel Ortiz [Fri, 12 Jul 2013 12:42:31 +0000 (14:42 +0200)]
device: Remove the SetProperty method
Records are read only.
Samuel Ortiz [Wed, 3 Jul 2013 15:01:26 +0000 (17:01 +0200)]
manager: Remove the SetProperty method
The neard Manager properties are read only and they only contain the
Adapters.
Samuel Ortiz [Wed, 3 Jul 2013 13:31:04 +0000 (15:31 +0200)]
adapter: Restart polling when failing to connect to a new target
If a newly detected target failed to be connected then a new polling
loop is started if constant poll is enabled.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Samuel Ortiz [Tue, 2 Jul 2013 17:52:07 +0000 (19:52 +0200)]
AUTHORS: Mention Louis' contributions
Louis Yung-Chieh Lo [Tue, 2 Jul 2013 17:16:47 +0000 (10:16 -0700)]
ndef: Add raw MIME payload support
Additional to wifi_wsc MIME type, raw parameter is provided for
sending raw MIME payload as NDEF.
See test/push-device for usage.
Samuel Ortiz [Tue, 2 Jul 2013 11:10:14 +0000 (13:10 +0200)]
main: Use signalfd instead of raw signals
Copied from ConnMan's commit
6ad51830 where Daniel Wagner was
explaining:
"It's unsafe to call syslog in the terminated signal handler
because syslog takes a lock. So when the signal handler
kicks in and we were already in syslog, we have a nice
deadlock."
Samuel Ortiz [Tue, 2 Jul 2013 11:05:17 +0000 (13:05 +0200)]
ndef: Display AAR package name as a debug string
Samuel Ortiz [Fri, 28 Jun 2013 15:09:32 +0000 (17:09 +0200)]
device: Cancel pending SNEP message when removing a device
Samuel Ortiz [Fri, 28 Jun 2013 13:00:47 +0000 (15:00 +0200)]
adapter: Add a DEP link establishment timer
Once a device in target mode is found, the polling loop restarts after 1
second if the dep_link_is_up is not received.
Thierry Escande [Thu, 27 Jun 2013 10:04:00 +0000 (12:04 +0200)]
nfctool: Add a null pointer check in llcp_decode_cleanup
g_hash_table_destroy raises an assert when called with a null pointer.
connection_hash can be NULL when sniffer_init() fails before calling
llcp_init().
Samuel Ortiz [Thu, 27 Jun 2013 15:13:57 +0000 (17:13 +0200)]
unit: Add Android Application Record NDEF record unit test
Samuel Ortiz [Thu, 27 Jun 2013 15:01:54 +0000 (17:01 +0200)]
ndef: Parse AAR payload
Android Application Record payload simply contains the Android Market
package name.
Samuel Ortiz [Thu, 27 Jun 2013 14:38:34 +0000 (16:38 +0200)]
ndef: Initial support for Android Application Records
AAR are Android external NDEF records that contain an Android package
name.
Samuel Ortiz [Thu, 27 Jun 2013 10:30:54 +0000 (12:30 +0200)]
test: Add a device monitoring script
It displays the device detection event and the received NDEF record
payloads if something is received from the device.
Samuel Ortiz [Thu, 27 Jun 2013 10:30:14 +0000 (12:30 +0200)]
test: Add a tag monitoring script
It displays the record payload available from a detected tag.
Thierry Escande [Tue, 25 Jun 2013 13:41:09 +0000 (15:41 +0200)]
nfctool: sniffer: Fix ndef read-ahead check macro
This macro checks if we can safely read the next field in a ndef
record. So the check needs to be done at the current read position
in the current record.
Samuel Ortiz [Mon, 24 Jun 2013 22:15:24 +0000 (00:15 +0200)]
Release 0.12
Samuel Ortiz [Thu, 20 Jun 2013 23:37:09 +0000 (01:37 +0200)]
device: Pass the NDEF push cb status back to the caller
Instead of hard coding it to EINVAL.
Samuel Ortiz [Thu, 20 Jun 2013 23:36:40 +0000 (01:36 +0200)]
error: Add I/O error routine
Samuel Ortiz [Thu, 20 Jun 2013 23:04:33 +0000 (01:04 +0200)]
ndef: Support receiving empty Handover select frames
Empty handover select frames are received when the peer notifies us
about not supporting any of the carrier sent in the handover request
frame.
In that case there is nothing to do but disconnecting from the handover
service.
Ravi kumar Veeramally [Thu, 2 May 2013 11:27:52 +0000 (14:27 +0300)]
ndef: Send empty WiFi carrier in Hr message when running as a STA
When running as a 802.11 STA, the Hr should contain an empty WiFi
carrier as we're just asking for WiFi availability from the peer.
Also when running in AP mode, an Hr is not a valid frame to send as
an AP will not be able to initiate the association.
Samuel Ortiz [Thu, 20 Jun 2013 12:46:17 +0000 (14:46 +0200)]
ndef: Implement static handover
static handover is going through a different D-Bus path as it would not
make sense to handle both static and dynamic handover from the same code
path.
Static handover means an application explicitely requires to send a
handover select without having previously received a handover request.
This could typically be used for handling WiFi handover through
configuration token from the registrar perspective. The registrar
(a.k.a. the Access Point) would send a configuration token via Handover
and expects the Enrolle (a.k.a. the WiFi STA) to initiate the WiFi
association.
Samuel Ortiz [Thu, 20 Jun 2013 12:43:19 +0000 (14:43 +0200)]
ndef: Generalize near_ndef_prepare_hr_message()
near_ndef_prepare_hr_message can be used for building Hr frames but also
Hs ones for static handover. So generalize and factorize it and also
rename it to near_ndef_prepare_ho_message().
Samuel Ortiz [Thu, 20 Jun 2013 12:39:11 +0000 (14:39 +0200)]
test: Check for dump-* scripts argument
Check that there at least is one argument and dump a usage example
otherwise.
Samuel Ortiz [Thu, 20 Jun 2013 10:57:17 +0000 (12:57 +0200)]
test: Explicitely unregister the NDEF agent when being interrupted
Samuel Ortiz [Wed, 19 Jun 2013 13:38:11 +0000 (15:38 +0200)]
ndef: Rename near_ndef_prepare_hs_message
near_ndef_prepare_hs_message() does not prepare a generic handover
select message but rather a reply to a handover request.
Those 2 have to be differentiated in order to implement static handover
where a handover select frame is sent without having first seen a
handover request.
Samuel Ortiz [Wed, 19 Jun 2013 13:32:31 +0000 (15:32 +0200)]
ndef: Rename build_ho_record
build_ho_record is used for initiating negotiated handover, so it will
only send handover requests.
As such, rename build_ho_record to build_hr_record.
Samuel Ortiz [Wed, 19 Jun 2013 08:41:50 +0000 (10:41 +0200)]
nfctool: sniffer: Dump unknown WSC data elements
Don't drop them silently.
Henrique Dante de Almeida [Mon, 27 May 2013 17:15:34 +0000 (14:15 -0300)]
gdbus: Remove proxies when client disconnects
Remove proxies and generate proxy_removed callbacks even when there are
no corresponding InterfaceRemoved signals.
This patch fixes having zombie gdbus proxy object when a server
disconnects without sending InterfaceRemoved signals. These objects
may interact with new server instances, for example, making
InterfaceAdded signals of new objects with the same name be filtered
out as duplicated, or staying allocated, but unused, if the new server
doesn't reuse the object paths. Note that as a side-effect, the
lifetime of a gdbus proxy becomes stricter: it lives at most for the
duration of a single connection to a single instance of a server
process.
Samuel Ortiz [Tue, 18 Jun 2013 17:40:22 +0000 (19:40 +0200)]
nfctool: sniffer: Decode application/vnd.wfa.wsc MIME records
Samuel Ortiz [Tue, 18 Jun 2013 17:38:26 +0000 (19:38 +0200)]
test: Add MIME type to the Device pushing options
Only wifi_wsc is supported for now, i.e. one can only push WSC
configuration tokens over SNEP.
Samuel Ortiz [Tue, 18 Jun 2013 17:35:13 +0000 (19:35 +0200)]
ndef: Fallback to the WiFi agent when missing an SSID
When the D-Bus message does not contain an SSID (and optionalyy a
passphrase) then we fallback to the WiFi WSC agent. If it's running
in tethering mode then it will reply with an already built WSC TLV
array.
This is needed to push WiFi WSC configuration token over SNEP. Android
is going to support that as a simplified WiFi Handover.
Olivier Guiter [Mon, 17 Jun 2013 14:42:41 +0000 (16:42 +0200)]
nfctype4: Fix segmentation fault on invalid access key
If length is < 0, further access to the resp buffer will cause neard to
seg fault.