Age | Commit message (Collapse) | Author | Files | Lines |
|
This routine is no longer called.
|
|
The default behaviour is to power cycle the adapter when receiving a
driver error.
|
|
Receiving a NFC_EVENT_TARGETS_FOUND with a NULL payload means the driver
entered an error state. This is handled by checking if the devices and
targets arrays are empty from the GET_TARGET finish handler.
In the polling error case, neard resets the adapter and starts polling
again.
The polling error handler runs asynchrounously for the D-Bus properties
toggle to be exported properly.
|
|
In Initiator mode, this is when we get a DEP_LINK_UP event.
In target mode, DEP link is up as soon as we see a new device.
This fix avoids racy situations where a Device interface is available
although the DEP link is still not up.
|
|
Set and GetProperties are no longer relevant.
Also, there is no longer any need to update the Tags and Records Adapter
properties.
|
|
The manager Adapters property is removed. And so are the adapter Tags
and Devices properties. All of them become managed objects and thus no
longer need to be explicit parent object properties.
Since the only methods left to the Manager interface were agent
registration ones, the Manager interface becomes the AgentManager one.
|
|
And TagLost as well. Those signals fix the current racy behaviour where
apps get a Tags property change notification and then ask for the tag
properties. The tag may have disappeared in the meantime.
Eventually, the Tags property should disappear.
|
|
No need to go through the kernel netlink NFC API if the adapter is known
to be down.
|
|
This patch generate via coccinelle with:
@ disable is_null,isnt_null1 @
expression E;
@@
(
- E == NULL
+ !E
|
- E != NULL
+ E
)
|
|
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
)
|
|
|
|
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>
|
|
Once a device in target mode is found, the polling loop restarts after 1
second if the dep_link_is_up is not received.
|
|
When calling __near_netlink_adapter_enable(), adapter->idx is not yet
set. The right adapter index to pass is the __near_adapter_create()
argument.
|
|
DefaultPowered is a boolean and will force neard into turning any detected
adapter on when set to TRUE.
|
|
|
|
Destroy hash tables when removing adapter.
184 (88 direct, 96 indirect) bytes in 1 blocks are definitely lost in loss record 132 of 156
at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x4E7FA78: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E92CA2: g_slice_alloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E69A02: g_hash_table_new_full (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x418AD7: __near_adapter_create (adapter.c:613)
by 0x41790F: __near_manager_adapter_add (manager.c:79)
by 0x41D1CB: get_devices_handler (netlink.c:173)
by 0x579A4A9: nl_recvmsgs (in /lib/libnl-3.so.200.3.0)
by 0x41C562: nl_send_msg (netlink.c:136)
by 0x41D38A: __near_netlink_get_adapters (netlink.c:200)
by 0x4084F1: main (main.c:210)
184 (88 direct, 96 indirect) bytes in 1 blocks are definitely lost in loss record 133 of 156
at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x4E7FA78: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E92CA2: g_slice_alloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E69A02: g_hash_table_new_full (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x418AF8: __near_adapter_create (adapter.c:617)
by 0x41790F: __near_manager_adapter_add (manager.c:79)
by 0x41D1CB: get_devices_handler (netlink.c:173)
by 0x579A4A9: nl_recvmsgs (in /lib/libnl-3.so.200.3.0)
by 0x41C562: nl_send_msg (netlink.c:136)
by 0x41D38A: __near_netlink_get_adapters (netlink.c:200)
by 0x4084F1: main (main.c:210)
|
|
This fix some style errors reported by checkpatch and found while
working with code.
|
|
|
|
When detecting a tag, or a device, the RF mode changes.
When the link is down, RF mode goes to Idle.
|
|
|
|
Now this function will release allocated data using callback, so it will
be unnecessary to check its returned error code (if callback was passed).
Main reasons to prepare this change were improvement of code readability
and removing error prone code paths.
|
|
When reading, writing or formating is in progress, no check presence
should be done.
|
|
Now when adapter is not polling and StopPollLoop is called, correct error
message will be returned.
|
|
|
|
__near_tag_get_idx function wasn't needed as the same action was
performed by near_tag_get_target_idx.
|
|
As opposed to a tag, a device should be accessible before the first read
(That could potentially never happen) so the Adapter Devices property change
should be sent when the DEP link is up.
|
|
Now when adapter is disabled and an attempt is made to disable it, correct
error message will be returned.
|
|
|
|
|
|
|
|
The LLCP wks array will be properly built before the MAC link is up by
binding to p2p services as soon as a p2p driver is registered.
The bound will also happen when the MAC link is up for supporting kernels
where the bound LLCP sockets will be closed when the MAC is brought down.
For more recent kernels, the bind operation will happen only once.
|
|
Until the kernel target mode gets more testing, the default polling loop
mode should be Initiator, as it used to be.
|
|
|
|
This API will be used for adding new devices when running in target mode.
|
|
The simple StartPoll is replaced with a polling loop method, where polling
mode is specified. It can be Initiator, Target or both.
When starting the polling loop in Target mode an NFC device could
eventually activate us.
|
|
As we are not using channel anymore we may drop this reference, and
let GLib clean it up, closing the file descriptor.
|
|
Use GDBUS_* macros, so signature and reply fields are not set in each
method/signal.
|
|
With these macro helpers we can separate in/out arguments and use their
own vector.
|
|
Constify signal tables with the following command:
find . -name '*.[ch]' -exec \
sed -i 's/\(GDBusSignalTable .* =\)/const \1/g' {} \;
|
|
Constify method tables with the following command:
find . -name '*.[ch]' -exec \
sed -i 's/\(GDBusMethodTable .* =\)/const \1/g' {} \;
|
|
Without doing so, the automatic polling won't start.
|
|
No need for a check presence implementation as the MAC link status
will be updated over netlink.
|
|
NDEF queueing should be done by upper layers with a more accurate
application status knowledge.
NDEF are now written to tags with the Tag.Write method. A Device.Push
one will also be implemented.
|
|
|
|
Plugins don't need to call thsi routine.
|
|
read and write sounds more like what those drivers do.
|
|
|
|
|
|
Adapters talk to tags or device directly. The target vs initiator
idea will be removed from the code base.
This commit temporarily breaks p2p.
|