Samuel Ortiz [Sun, 24 Nov 2013 23:39:30 +0000 (00:39 +0100)]
phdc: Check for the sender identity before registering the agent
In order to avoid DoS type of errors by only allowing the registrer to
unregister.
Code review done by Sebastian Krahmer <krahmer@suse.de>.
Samuel Ortiz [Sun, 24 Nov 2013 23:28:54 +0000 (00:28 +0100)]
nfctype1: Check for remaining space before memcpy'ing meta data
Code review done by Sebastian Krahmer <krahmer@suse.de>.
Samuel Ortiz [Sun, 24 Nov 2013 23:24:00 +0000 (00:24 +0100)]
nfctype1: Check for remaining space before memcpy'ing data
Code review done by Sebastian Krahmer <krahmer@suse.de>.
Samuel Ortiz [Sun, 24 Nov 2013 23:02:04 +0000 (00:02 +0100)]
test: Display device properties from the list command
Samuel Ortiz [Sun, 24 Nov 2013 23:00:03 +0000 (00:00 +0100)]
device: Implement Adapter property
In order to not only rely on a specific naming scheme, the device
Adapter path is now exported as a property.
Samuel Ortiz [Sun, 24 Nov 2013 22:55:41 +0000 (23:55 +0100)]
test: Display tag properties from the list command
Samuel Ortiz [Sun, 24 Nov 2013 22:51:07 +0000 (23:51 +0100)]
tag: Implement Adapter property
In order to not only rely on a specific naming scheme, the tag Adapter
path is now exported as a property.
Samuel Ortiz [Thu, 21 Nov 2013 01:11:55 +0000 (02:11 +0100)]
main: Call agent_init first
agent_init will register the /org/neard name and if an adapter is
registered before /org/neard is registered, its parent will be "/". That
happens when starting neard with an adapter already plugged in.
Samuel Ortiz [Thu, 21 Nov 2013 00:28:36 +0000 (01:28 +0100)]
adapter: Remove near_adapter_list
This routine is no longer called.
Samuel Ortiz [Mon, 4 Nov 2013 23:48:24 +0000 (00:48 +0100)]
nfctool: Fix snep-decode potential overflow
Code review done by Sebastian Krahmer <krahmer@suse.de>.
Samuel Ortiz [Mon, 4 Nov 2013 23:47:25 +0000 (00:47 +0100)]
nfctool: Fix llcp-decode potential overflow
Code review done by Sebastian Krahmer <krahmer@suse.de>.
Samuel Ortiz [Wed, 20 Nov 2013 00:04:48 +0000 (01:04 +0100)]
adapter: Make the power cycle upon driver error configurable
The default behaviour is to power cycle the adapter when receiving a
driver error.
Samuel Ortiz [Mon, 18 Nov 2013 00:48:15 +0000 (01:48 +0100)]
adapter: Catch polling errors
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.
Samuel Ortiz [Mon, 18 Nov 2013 00:42:46 +0000 (01:42 +0100)]
netlink: Expose NL_CB_FINISH handler
In some cases (e.g. multipart messages) it is interesting to know when a
messages is finished. Some multipart messages can carry a NULL payload
and without having a NL_CB_FINISH handler, neard never knows when it's
actually finished.
Samuel Ortiz [Wed, 13 Nov 2013 01:01:21 +0000 (02:01 +0100)]
agent: Export matching record payload from GetNDEF
Besides the record path and the complete NDEF raw data, the matching
record payload is also now exported.
Samuel Ortiz [Wed, 13 Nov 2013 01:00:38 +0000 (02:00 +0100)]
ndef: Implement record payload getter
Samuel Ortiz [Wed, 13 Nov 2013 00:47:39 +0000 (01:47 +0100)]
agent: Only print matching record from NDEF agent's GetNDEF
There is no need to print all records from the NDEF.
With each matching record, the record path and the NDEF raw data is
pushed back to the agent.
Bastien Nocera [Sat, 9 Nov 2013 17:02:57 +0000 (18:02 +0100)]
gdbus: Fix trying to remove already removed sources
When we return FALSE from idle handlers, the source is removed.
This will be causing warnings in glib 2.40.
See https://bugzilla.gnome.org/show_bug.cgi?id=710724
Samuel Ortiz [Mon, 11 Nov 2013 00:03:01 +0000 (01:03 +0100)]
test: Port bt-handover to the ObjectManager interface
Samuel Ortiz [Sun, 10 Nov 2013 23:55:07 +0000 (00:55 +0100)]
device: Create the Device D-Bus interface only when the DEP link is up
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.
Samuel Ortiz [Sun, 10 Nov 2013 23:17:19 +0000 (00:17 +0100)]
agent: Keep legacy interfaces for a few more releases
Give ConnMan and BlueZ a few weeks to transition.
Samuel Ortiz [Sun, 10 Nov 2013 17:00:21 +0000 (18:00 +0100)]
test: Fix test-tag whitespace damage
Samuel Ortiz [Sun, 10 Nov 2013 16:59:10 +0000 (17:59 +0100)]
tag: Remove trailing whitespaces
Samuel Ortiz [Sun, 10 Nov 2013 16:53:46 +0000 (17:53 +0100)]
test: Remove dump-record
This is replaced with test/test-tag dump
Samuel Ortiz [Sun, 10 Nov 2013 16:50:00 +0000 (17:50 +0100)]
tag: Create new path when writing a new Record
By resetting n_records to 0 after successfully writing a new Record, the
newly written Record would be exposed with the same path as the previous
one.
n_records become next_record and tracks the next available record index.
Samuel Ortiz [Sun, 10 Nov 2013 16:43:34 +0000 (17:43 +0100)]
test: Add test-device script
Samuel Ortiz [Sun, 10 Nov 2013 16:40:21 +0000 (17:40 +0100)]
neardutils: Implement dump_all_records
This is useful for dumping all records from all tags, and avoids
always having to specify a tag path on the test-tag command line.
Samuel Ortiz [Sun, 10 Nov 2013 16:22:19 +0000 (17:22 +0100)]
tag: Unregister Record before Tag
When a Tag is leaving the field, it makes more sense to
unregister its associated records before the Device itself, and not the
other way around.
Samuel Ortiz [Sun, 10 Nov 2013 16:20:30 +0000 (17:20 +0100)]
device: Unregister Record before Device
When a Device is leaving the field, it makes more sense to unregister
its associated records before the Device itself.
Samuel Ortiz [Mon, 4 Nov 2013 01:29:55 +0000 (02:29 +0100)]
ndef: ObjectManager conversion
ndef.c handles the Record interface. With the ObjectManager interface,
GetProperties is no longer needed.
Samuel Ortiz [Sat, 26 Oct 2013 11:28:00 +0000 (13:28 +0200)]
tag: ObjectManager conversion
Set and GetProperties are no longer relevant.
Also, there is no longer any need to update the Tags and Records Adapter
properties.
Samuel Ortiz [Sat, 26 Oct 2013 10:08:58 +0000 (12:08 +0200)]
test: Fix test-adapter prototype
The adapter argument (e.g. "nfc0") should be the 2nd one, for
consistency sake.
Samuel Ortiz [Wed, 23 Oct 2013 01:00:09 +0000 (03:00 +0200)]
device: ObjectManager conversion
No need to export the Record property. GetProperties and SetProperties
are also removed.
We also centralize all device related test scripts into test-device, a
la BlueZ.
Samuel Ortiz [Tue, 22 Oct 2013 23:58:04 +0000 (01:58 +0200)]
adapter: Initial transition to managed objects
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.
Samuel Ortiz [Mon, 4 Nov 2013 23:26:14 +0000 (00:26 +0100)]
tag: Do not unref a NULL write message
After successfully writing a tag, the next read might fail in which case
tag_read_cb may be called several times. The pending write_msg pointer
needs to be unrefed only once.
Samuel Ortiz [Tue, 29 Oct 2013 23:35:36 +0000 (00:35 +0100)]
nfctype4: Do not release target after a succesful tag write
There is no reason for releasing a target after tag writing succeeded.
Especially since check presence still needs the link.
Samuel Ortiz [Thu, 17 Oct 2013 23:12:16 +0000 (01:12 +0200)]
ndef: Simplify the exported MIME type D-Bus type further
And make it less confusable with the MIMEType property.
Samuel Ortiz [Thu, 17 Oct 2013 23:00:25 +0000 (01:00 +0200)]
ndef: Simplify D-Bus exported record type strings
"Android Application Record (AAR)" is not really D-Bus clients
friendly.
Szymon Janc [Thu, 26 Sep 2013 08:02:35 +0000 (10:02 +0200)]
gdbus: Remove not needed check for NULL DBusPendingCall
It is now checked by g_dbus_send_message_with_reply() so there is no
need to double check that in caller.
Szymon Janc [Thu, 26 Sep 2013 08:02:34 +0000 (10:02 +0200)]
gdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply
"Warning: if the connection is disconnected or you try to send Unix file
descriptors on a connection that does not support them, the
DBusPendingCall will be set to NULL, so be careful with this."
Check this in g_dbus_send_message_with_reply so that callers don't need
to double check for NULL if g_dbus_send_message_with_reply returned
TRUE.
This also fix crash if passing FD over D-Bus is blocked e.g. by SELinux
policy.
bluetoothd[1894]: profiles/audio/avdtp.c:session_cb()
bluetoothd[1894]: profiles/audio/avdtp.c:avdtp_parse_cmd() Received
SET_CONFIGURATION_CMD
bluetoothd[1894]: profiles/audio/a2dp.c:endpoint_setconf_ind() Source
0x6c5000: Set_Configuration_Ind
bluetoothd[1894]: profiles/audio/avdtp.c:avdtp_ref() 0x6df360: ref=1
bluetoothd[1894]: profiles/audio/a2dp.c:setup_ref() 0x6d32b0: ref=1
process 1894: arguments to dbus_pending_call_set_notify() were incorrect,
assertion "pending != NULL" failed in file dbus-pending-call.c line
636.
This is normally a bug in some application using the D-Bus library.
Samuel Ortiz [Sun, 13 Oct 2013 22:56:44 +0000 (00:56 +0200)]
adapter: Implement TagFound signal
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.
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.