platform/upstream/neard.git
9 years agoAdd packaging directory 77/30777/1 accepted/tizen_3.0_common accepted/tizen_3.0_ivi accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_unified accepted/tizen_wearable tizen tizen_3.0 tizen_3.0.2014.q4_common tizen_3.0.2015.q1_common tizen_3.0.2015.q2_common tizen_3.0.m1_mobile tizen_3.0.m1_tv tizen_3.0.m2 tizen_3.0_ivi accepted/tizen/3.0/common/20161114.111336 accepted/tizen/common/20141128.095251 accepted/tizen/ivi/20141208.013047 accepted/tizen/ivi/20160218.025302 accepted/tizen/mobile/20141201.102132 accepted/tizen/unified/20170313.043903 submit/tizen/20141126.073427 submit/tizen/20141128.010817 submit/tizen_3.0_common/20161104.104000 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000006 submit/tizen_unified/20170313.040938 tizen_3.0.m1_mobile_release tizen_3.0.m1_tv_release tizen_3.0.m2.a1_mobile_release tizen_3.0.m2.a1_tv_release tizen_3.0_ivi_release tizen_4.0.m1_release
Arron Wang [Mon, 8 Jul 2013 09:04:26 +0000 (17:04 +0800)]
Add packaging directory

Change-Id: I5704e7f54c2162b644eaa12aa508d4bf127145eb

9 years agondef: Add support for WiFi Handover through MIME/x-nfctl 76/30776/1
Samuel Ortiz [Wed, 21 Aug 2013 22:13:00 +0000 (00:13 +0200)]
ndef: Add support for WiFi Handover through MIME/x-nfctl

The NFC task launcher Android application reads NFC tags formatted with
a proprietary MIME/x-nfctl NDEF containing an SSID and a passphrase.
By pushing the same kind of NDEF through SNEP, a WiFi association with
the neard WiFi handover agent can be triggered.

Change-Id: I49f13dc3b32b347357c6d2a13f6b3a132ad74dab
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
9 years agoAdd raw NDEF support for P2P 75/30775/1
Arron Wang [Mon, 29 Sep 2014 08:44:46 +0000 (16:44 +0800)]
Add raw NDEF support for P2P

Change-Id: I7ab5cd5eea7b0e60b9980f15a7ba15def86ced0e

9 years agotag: Implement a raw NDEF accessor 74/30774/1
Arron Wang [Mon, 29 Sep 2014 06:23:55 +0000 (14:23 +0800)]
tag: Implement a raw NDEF accessor

Change-Id: Id7fab24395d45502e8cdde573c40f2bd99348e27

9 years agondef: Support RAW ndef writes 73/30773/1
Samuel Ortiz [Thu, 25 Oct 2012 16:58:06 +0000 (18:58 +0200)]
ndef: Support RAW ndef writes

Change-Id: I21a341b2482556458e381b4a3033ef3e9313194c

10 years agoRelease 0.14 0.14 upstream/0.14
Samuel Ortiz [Mon, 9 Dec 2013 23:48:49 +0000 (00:48 +0100)]
Release 0.14

10 years agoAUTHORS: Mention Timo's contributions
Samuel Ortiz [Sat, 7 Dec 2013 01:28:31 +0000 (02:28 +0100)]
AUTHORS: Mention Timo's contributions

10 years agotest: Add handover support with BlueZ 5
Timo Mueller [Fri, 6 Dec 2013 07:58:40 +0000 (08:58 +0100)]
test: Add handover support with BlueZ 5

Bluetooth pairing information is removed before any handover requests
are sent to a remote device. This adds support to allow pairing
information removal with BlueZ 5.

The information about the default adapter is no longer publicly
available with BlueZ 5. The user can therefore select the bluetooth
adapter whose paired devices are removed. If no adapter is specified
the first adapter is used.

10 years agotest: Move paired device removal to separate method
Timo Mueller [Fri, 6 Dec 2013 07:58:39 +0000 (08:58 +0100)]
test: Move paired device removal to separate method

To prepare the test script for the integration with BlueZ5 the code
specific to BlueZ has been refactored into a separate method.

10 years agonetlink: Check for netlink message sender PID
Samuel Ortiz [Sun, 24 Nov 2013 23:58:33 +0000 (00:58 +0100)]
netlink: Check for netlink message sender PID

If PID is not 0 (i.e. this is not the kernel sending us the message),
the message is skipped.

Code review done by Sebastian Krahmer <krahmer@suse.de>.

10 years agophdc: Check for the sender identity before registering the agent
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>.

10 years agonfctype1: Check for remaining space before memcpy'ing meta data
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>.

10 years agonfctype1: Check for remaining space before memcpy'ing data
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>.

10 years agotest: Display device properties from the list command
Samuel Ortiz [Sun, 24 Nov 2013 23:02:04 +0000 (00:02 +0100)]
test: Display device properties from the list command

10 years agodevice: Implement Adapter property
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.

10 years agotest: Display tag properties from the list command
Samuel Ortiz [Sun, 24 Nov 2013 22:55:41 +0000 (23:55 +0100)]
test: Display tag properties from the list command

10 years agotag: Implement Adapter property
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.

10 years agomain: Call agent_init first
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.

10 years agoadapter: Remove near_adapter_list
Samuel Ortiz [Thu, 21 Nov 2013 00:28:36 +0000 (01:28 +0100)]
adapter: Remove near_adapter_list

This routine is no longer called.

10 years agonfctool: Fix snep-decode potential overflow
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>.

10 years agonfctool: Fix llcp-decode potential overflow
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>.

10 years agoadapter: Make the power cycle upon driver error configurable
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.

10 years agoadapter: Catch polling errors
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.

10 years agonetlink: Expose NL_CB_FINISH handler
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.

10 years agoagent: Export matching record payload from GetNDEF
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.

10 years agondef: Implement record payload getter
Samuel Ortiz [Wed, 13 Nov 2013 01:00:38 +0000 (02:00 +0100)]
ndef: Implement record payload getter

10 years agoagent: Only print matching record from NDEF agent's GetNDEF
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.

10 years agogdbus: Fix trying to remove already removed sources
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

10 years agotest: Port bt-handover to the ObjectManager interface
Samuel Ortiz [Mon, 11 Nov 2013 00:03:01 +0000 (01:03 +0100)]
test: Port bt-handover to the ObjectManager interface

10 years agodevice: Create the Device D-Bus interface only when the DEP link is up
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.

10 years agoagent: Keep legacy interfaces for a few more releases
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.

10 years agotest: Fix test-tag whitespace damage
Samuel Ortiz [Sun, 10 Nov 2013 17:00:21 +0000 (18:00 +0100)]
test: Fix test-tag whitespace damage

10 years agotag: Remove trailing whitespaces
Samuel Ortiz [Sun, 10 Nov 2013 16:59:10 +0000 (17:59 +0100)]
tag: Remove trailing whitespaces

10 years agotest: Remove dump-record
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

10 years agotag: Create new path when writing a new Record
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.

10 years agotest: Add test-device script
Samuel Ortiz [Sun, 10 Nov 2013 16:43:34 +0000 (17:43 +0100)]
test: Add test-device script

10 years agoneardutils: Implement dump_all_records
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.

10 years agotag: Unregister Record before Tag
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.

10 years agodevice: Unregister Record before Device
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.

10 years agondef: ObjectManager conversion
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.

10 years agotag: ObjectManager conversion
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.

10 years agotest: Fix test-adapter prototype
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.

10 years agodevice: ObjectManager conversion
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.

10 years agoadapter: Initial transition to managed objects
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.

10 years agotag: Do not unref a NULL write message
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.

10 years agonfctype4: Do not release target after a succesful tag write
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.

10 years agondef: Simplify the exported MIME type D-Bus type further
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.

10 years agondef: Simplify D-Bus exported record type strings
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.

10 years agogdbus: Remove not needed check for NULL DBusPendingCall
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.

10 years agogdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply
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.

10 years agoadapter: Implement TagFound signal
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.

10 years agoadapter: Do not send a poll command when adapter is down
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.

10 years agoAUTHORS: Mention Dmytro's contributions
Samuel Ortiz [Fri, 11 Oct 2013 15:20:52 +0000 (17:20 +0200)]
AUTHORS: Mention Dmytro's contributions

10 years agonfctool: Fix options type
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.

10 years agobuild: Fix build in separate directory
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

10 years agonfctype2: Remove not needed NULL assignment
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.

10 years agonfctype1: Remove dead code from nfctype1_write
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.

10 years agonpp: Implement npp_push
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.

10 years agonpp: Fix npp_read
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.

10 years agoRelease 0.13 0.13
Samuel Ortiz [Tue, 17 Sep 2013 18:11:19 +0000 (20:11 +0200)]
Release 0.13

10 years agogdbus/client: Use g_dbus_add_properties_watch to track properties
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.

10 years agogdbus/client: Use g_dbus_add_signal_watch to track signals
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.

10 years agogdbus/client: Use g_dbus_add_service_watch to track services
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.

10 years agogdbus/watch: Fix crash when disconnecting from D-Bus
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

10 years agogdbus/watch: Fix aborting when removing D-Bus filter
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.

10 years agogdbus/watch: Fix crash when g_dbus_remove_watch is called from connect callback
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)

10 years agogdbus: Fix emitting PropertiesChanged twice
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.

10 years agogdbus: Avoid calling dbus_connection_send*
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.

10 years agogdbus: Add g_dbus_send_message_with_reply
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

10 years agogdbus: Fix sending ObjectManager/Properties signals out of 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.

10 years agonfctool: Add firmware download command
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

10 years agonfctool: netlink: Pass attributes to registered callbacks
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.

10 years agonfc_copy: Update nfc_copy.h with SE command and firmware download status
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.

10 years agophdc: API documentation and sample code
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.

10 years agoneard: Change in dbus conf to allow PHDC managers and agents
Olivier Guiter [Mon, 2 Sep 2013 10:32:17 +0000 (12:32 +0200)]
neard: Change in dbus conf to allow PHDC managers and agents

10 years agophdc: Initial PHDC implementation
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.

10 years agop2p: Add new_client method in p2p struct
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.

10 years agop2p: Add a user_data pointer to p2p struct
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,...).

10 years agomain: Use gboolean type in GOptionEntry
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.

10 years agop2p: Remove const from service and driver name
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.

10 years agop2p: Change p2p_register to look for service name
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).

10 years agoerror: Add ENOMEM error string message
Olivier Guiter [Tue, 27 Aug 2013 14:56:20 +0000 (16:56 +0200)]
error: Add ENOMEM error string message

10 years agonfctype4: Fix a memory leak in t4_readbin_cc
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.

10 years agobluetooth: Make the default adapter callback error less confusing
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.

10 years agoAUTHORS: Mention Daniel's contributions
Samuel Ortiz [Tue, 20 Aug 2013 09:08:55 +0000 (11:08 +0200)]
AUTHORS: Mention Daniel's contributions

10 years agodoc: Change coding style for NULL pointer checks
Daniel Wagner [Wed, 14 Aug 2013 07:28:00 +0000 (09:28 +0200)]
doc: Change coding style for NULL pointer checks

10 years agounit: Do not compare expression against NULL
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
)

10 years agotools: Do not compare expression against NULL
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
)

10 years agocore: Do not compare expression against NULL
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
)

10 years agoplugins: Do not compare expression against NULL
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
)

10 years agotypes: Remove near_bool_t definition
Daniel Wagner [Wed, 14 Aug 2013 07:27:55 +0000 (09:27 +0200)]
types: Remove near_bool_t definition

10 years agounit: Use stdbool instead gboolean or near_bool_t
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
)

10 years agotools: Use stdbool instead gboolean or near_bool_t
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
)

10 years agocore: Use stdbool instead gboolean or near_bool_t
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
)

10 years agoplugins: Use stdbool instead gboolean or near_bool_t
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
)

10 years agoinclude: Use stdbool instead gboolean or near_bool_t
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
)

10 years agocore: Include stdbool.h
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.

10 years agoinclude: Include stdbool.h
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.

10 years agoplugins: Include stdbool.h
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.

10 years agotag: Use dbus_bool_t for D-Bus function
Daniel Wagner [Wed, 14 Aug 2013 07:27:46 +0000 (09:27 +0200)]
tag: Use dbus_bool_t for D-Bus function