Commit Graph

14619 Commits

Author SHA1 Message Date
Alvaro Silva
e80e4bd1ec gatttool: Show connection state using color
When device is connected, the Bluetooth address is shown in blue color.
2013-04-17 11:22:44 +03:00
Eder Ruiz Maria
f952820eb6 gatttool: Use bluetoothctl behavior when pressing Enter on empty prompt 2013-04-17 11:22:34 +03:00
Eder Ruiz Maria
cf192c494f gatttool: Replace more usages of printf() with rl_printf()
rl_printf() works better with readline than plain printf(), specially on
asynchronous callbacks.
2013-04-17 11:22:25 +03:00
Eder Ruiz Maria
6a287262f0 gatttool: Fix issues with printf() and readline prompt
Use rl_printf() from bluetoothctl to consistently display messages. This
is specially important for asynchronous callbacks, where using printf()
may mess up the prompt created by readline.
2013-04-17 11:22:00 +03:00
Eder Ruiz Maria
3dacf2769d gatttool: Use GError to propage error messages to caller
Handle runtime errors outside gatt_connect(), using GError to propagate
error messages to caller.
2013-04-17 11:21:29 +03:00
Johan Hedberg
519fe630ef monitor: Remove bogus entries from event mask table
The event mask is 64 bits so any bit offsets greater than that do not
make sense.
2013-04-16 20:34:47 +03:00
João Paulo Rechi Vita
8f154c2e61 audio: Remove unused constants
Removes the never used constants AUDIO_SINK_INTERFACE and
AUDIO_SOURCE_INTERFACE which are defined to "org.bluez.AudioSink" and
"org.bluez.AudioSource", respectively.
2013-04-15 17:17:51 +03:00
João Paulo Rechi Vita
e0445712a3 audio: Remove unused function
Removes the never used function audio_device_is_active.
2013-04-15 17:17:51 +03:00
João Paulo Rechi Vita
7f200ffaca audio: Remove unused constant
Removes the never used constant AUDIO_INTERFACE which is defined to
"org.bluez.Audio".
2013-04-15 17:17:51 +03:00
Marcel Holtmann
4a9ce2ed68 Release 5.4 2013-04-10 22:50:12 -07:00
Marcel Holtmann
858283eafa build: Update library version 2013-04-10 22:24:32 -07:00
Marcel Holtmann
eb1f591c79 lib: Update list of company identifiers 2013-04-10 22:23:49 -07:00
Christian Fetzer
518a51ad1d obexd: Automatically setup notification connection for MAP client
This automatically establishes the MNS connection when the MAS client
session is started and terminates the MNS connection when the MAS client
session is closed.

The MAP client controls the notification channel using the
SetNotificationRegistration function. The MSE will connect/disconnect
the MNS connection accordingly.
2013-04-10 14:56:46 +03:00
Christian Fetzer
eecf2d8c21 obexd: Enable MNS server 2013-04-10 14:51:09 +03:00
Christian Fetzer
ae130d6e67 build: Add support for building MNS server 2013-04-10 14:51:09 +03:00
Christian Fetzer
ef4b34eb5e obexd: Add Message Notification Service (MNS) server
This implements the server role of the MAP Message Notification Service
(MNS) which is part of the MAP Client Equipment (MCE) device.

After successful registration, the MNS will receive event reports,
notifying about state changes on the server side.

Possible events are: NewMessages, DeliverySuccess, SendingSuccess,
DeliveryFailure, SendingFailure, MemoryFull, MemoryAvailable,
MessageDeleted, MessageShift
2013-04-10 14:51:09 +03:00
Christian Fetzer
6ede436278 profile: Add MNS server record
This adds the MNS server record to the profile default settings.
2013-04-10 14:51:09 +03:00
Lucas De Marchi
4dd429fcb9 shared: Use gcc builtin instead of g_atomic
g_atomic_* end up using G_STATIC_ASSERT, causing gcc 4.8 to yell due to
-Wunused-local-typedefs.

/usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef ‘_GStaticAssertCompileTimeAssertion_2’ locally defined but not used [-Werror=unused-local-typedefs]
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
2013-04-09 07:02:31 +09:00
Lucas De Marchi
ee27640ef6 obexd: Use gcc builtin instead of g_atomic
g_atomic_* end up using G_STATIC_ASSERT, causing gcc 4.8 to yell due to
-Wunused-local-typedefs.

/usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef ‘_GStaticAssertCompileTimeAssertion_2’ locally defined but not used [-Werror=unused-local-typedefs]
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]

Most of the uses of atomic operations were wrong. They were fixed as
well. If we are using atomic operations, reading the variable again
later for logging is not an option, we should use the return of the
atomic function used to fetch the variable.
2013-04-09 07:02:19 +09:00
Lucas De Marchi
d073af52ea gobex: Use gcc builtin instead of g_atomic
g_atomic_* end up using G_STATIC_ASSERT, causing gcc 4.8 to yell due to
-Wunused-local-typedefs.

/usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef ‘_GStaticAssertCompileTimeAssertion_2’ locally defined but not used [-Werror=unused-local-typedefs]
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]

Most of the uses of atomic operations were wrong. They were fixed as
well. If we are using atomic operations, reading the variable again
later for logging is not an option, we should use the return of the
atomic function used to fetch the variable.
2013-04-09 07:01:58 +09:00
Lucas De Marchi
1bd26421ce attrib: Use gcc builtin instead of g_atomic
g_atomic_* end up using G_STATIC_ASSERT, causing gcc 4.8 to yell due to
-Wunused-local-typedefs.

/usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef ‘_GStaticAssertCompileTimeAssertion_2’ locally defined but not used [-Werror=unused-local-typedefs]
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]

Most of the uses of atomic operations were wrong. They were fixed as
well. If we are using atomic operations, reading the variable again
later for logging is not an option, we should use the return of the
atomic function used to fetch the variable.
2013-04-09 07:01:36 +09:00
Lucas De Marchi
38669d6e86 gdbus: Use gcc builtin instead of g_atomic
g_atomic_* end up using G_STATIC_ASSERT, causing gcc 4.8 to yell due to
-Wunused-local-typedefs.

gdbus/client.c: In function ‘g_dbus_client_ref’:
/usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef ‘_GStaticAssertCompileTimeAssertion_2’ locally defined but not used [-Werror=unused-local-typedefs]
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
2013-04-09 07:01:21 +09:00
Lucas De Marchi
271bbdc8e4 gitignore: Ignore file generated by Automake 1.13
Automake >= 1.13 enables parallel-tests option which uses a test-driver
script (copied by automake). Ignore this file.
2013-04-09 07:01:14 +09:00
Eder Ruiz Maria
189cc8203e gatttool: Remove check for bluetooth address parameter on gatt_connect()
This check is more appropriate to be done by callers of gatt_connect().
This is already done on interactive mode in attrib/interactive.c and is
now also done in non-interactive mode.
2013-04-07 18:11:03 +03:00
Eder Ruiz Maria
8f84a47e8d gatttool: Remote address is mandatory for non-interactive gatttool
For gatttool non-interactive mode, command line parameter with
bluetooth remote address is mandatory.
2013-04-07 18:10:53 +03:00
Jefferson Delfes
58123ad784 gatttool: Fix memory leak after parsing input line
The callback is responsible for freeing input line buffer that comes
from rl_callback_handler_install().
2013-04-07 18:09:58 +03:00
Yegor Yefremov
972c92162d tools/hciattach: Fix TI firmware path
Change firmware path to /lib/firmware/ti-connectivity/ to be
conform with linux-firmware folder structure. All wl1xxx firmware
resides in ti-connectivity. See linux-firmware repository
https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/
for reference.
2013-04-04 21:14:53 +03:00
Luiz Augusto von Dentz
bfe5f61794 audio: Track connections to AVRCP roles separately
Currently the code assumes when one role connects the other must be
connected as well which is bogus and can create problems.
2013-04-04 20:48:07 +03:00
Arkadiusz Lichwa
e63b0f9035 lib: Fix invalid memory access in sdp_service_search_attr_req
Browsing services using sdptool can lead to writing to invalid heap
locations.

valgrind's output of exemplary call: sdptool browse local

==2203== HEAP SUMMARY:
==2203==     in use at exit: 0 bytes in 0 blocks
==2203==   total heap usage: 251 allocs, 251 frees, 140,156 bytes allocated
==2203==
==2203== All heap blocks were freed -- no leaks are possible
==2203==
==2203== ERROR SUMMARY: 6 errors from 2 contexts (suppressed: 0 from 0)
==2203==
==2203== 1 errors in context 1 of 2:
==2203== Invalid write of size 2
==2203==    at 0x805B882: bt_put_be16 (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x8062BD0: sdp_service_search_attr_req (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x8052457: do_search (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x80525AE: do_search (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x805277F: cmd_browse (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x8053199: main (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==  Address 0x4391359 is 7 bytes before a block of size 2,048 alloc'd
==2203==    at 0x402B6A8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2203==    by 0x8062B4B: sdp_service_search_attr_req (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x8052457: do_search (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x80525AE: do_search (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x805277F: cmd_browse (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x8053199: main (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==
==2203==
==2203== 5 errors in context 2 of 2:
==2203== Invalid write of size 1
==2203==    at 0x402D363: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2203==    by 0x80613E7: gen_dataseq_pdu (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x8061472: gen_attridseq_pdu (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x8062C00: sdp_service_search_attr_req (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x8052457: do_search (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x80525AE: do_search (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x805277F: cmd_browse (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x8053199: main (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==  Address 0x439135b is 5 bytes before a block of size 2,048 alloc'd
==2203==    at 0x402B6A8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2203==    by 0x8062B4B: sdp_service_search_attr_req (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x8052457: do_search (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x80525AE: do_search (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x805277F: cmd_browse (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==    by 0x8053199: main (in /home/xpu/gits/bluez.bin/bin/sdptool)
==2203==
==2203== ERROR SUMMARY: 6 errors from 2 contexts (suppressed: 0 from 0)
2013-04-04 15:35:50 +03:00
Anderson Lizardo
8c8cc51b18 attrib: Fix status on memory allocation failure
If memory allocation fails, ATT_ECODE_INSUFF_RESOURCES should be
reported to the callback.
2013-04-04 14:51:21 +03:00
Anderson Lizardo
8b61564c4d attrib: Fix coding style in read_char_helper() 2013-04-04 14:51:08 +03:00
Anderson Lizardo
03f2256f6a attrib: Fix memory leak on low memory condition
If g_try_new0() fails due to low memory condition, "list" should be
freed before returning from primary_all_cb().
2013-04-04 14:50:59 +03:00
Luiz Augusto von Dentz
e39bad17d1 AVCTP: Add mapping for mandatory pass-through operations
This add mapping for mandatory pass-through operations for categories
supported and a few other operations considered useful.
2013-04-04 14:43:38 +03:00
Alvaro Silva
a48a090c13 tools/mgmt-tester: Refine stop discovery test case
Add HCI test and discovering event test for stop discovery.
2013-04-03 10:54:30 +03:00
Alvaro Silva
4f4b8ff94d tools/mgmt-tester: Refine start discovery test case
Add HCI command test and discovering event test for start discovery.
2013-04-03 10:53:52 +03:00
Jaganath Kanakkassery
693f759cc2 attrib: Fix use after free of attrib
If attrib is freed in cmd->func(), then it will be used if either
request or response queue has some data to send.

This patch moves calling wake_up_sender() which increases the ref
count of attrib so that it wont get freed in cmd->func().
2013-04-02 09:47:14 +03:00
Jaganath Kanakkassery
f59bdb51b1 attrib: Remove norequests and noresponses variables
Passing NULL is fine to g_queue_is_empty(), so removing these
variables makes the code more readable
2013-04-02 09:47:12 +03:00
Alex Deymo
897e4866f8 core: Fix a double free on adapter_stop
The discovery_list list has the list of current discovery clients and is
removed on adapter_stop (for example due a "power off" command). The
g_slist_free_full will call discovery_free on every element of the list
and remove the nodes of the list, but discovery_destroy (called by
discovery_free) will not only free the element, but also remove it from
the list. This causes the list node to be freed twice, once by
g_slist_free_full and once by g_slist_remove.

This fix calls successively discovery_destroy and lets it remove the
list's elements one by one.
2013-04-02 09:44:25 +03:00
Alex Deymo
6bce24212d core: Memory leak on device_free for eir_uuids field.
The eir_uuids list is usually freed by device_svc_resolved, but that
doesn't happen if the device is removed before a SDP browse ends.
This fix deletes the eir_uuids list on device_free.
2013-03-30 18:54:25 +02:00
Arkadiusz Lichwa
22f54625b7 sdptool: Fix mem leak in do_search 2013-03-28 13:07:53 +02:00
Jefferson Delfes
789f7e7bc3 gatttool: fix parameter type/name from le to psm
The parameter le was changed to psm and its type was modified from
boolean to int, but header was unmodified. That change occurred in commit
0cc2459963.
2013-03-25 14:26:22 +02:00
Alex Deymo
342f1aa194 client: Agent's RequestPasskey implementation
Implements the uint32 RequestPasskey(object device) method.
2013-03-25 12:57:11 +02:00
Alex Deymo
4b30052265 client: Agent's DisplayPasskey implementation
Implements the DisplayPasskey(object device, uint32 passkey, uint16 entered)
method.
2013-03-25 12:57:03 +02:00
Alex Deymo
d52e8994b5 client: Agent's DisplayPincode implementation
Implements the DisplayPinCode(object device, string pincode) method.
2013-03-25 12:56:55 +02:00
Alex Deymo
b776f04171 client: "agent" command capability argument and autocompletion
This patch enables argument autocompletion for the agent command with
the list of capabilities an agent can have, adding also "on" (for the
default "") and "off". The command passes the argument (parsing and
verifying it) to the dbus method call.
2013-03-25 12:56:41 +02:00
Alex Deymo
82e49df634 client: Right prompt management on agent input
Registering an agent shares the user input interface with the normal console
command interface. The way it is implemented (using rl_message, rl_save_prompt
and rl_restore_prompt) conflicts with the rl_printf calls that may appear
while waiting for user input, loosing the [bluetooth]# prompt.
This patch fixes this and makes clear if the expected input is a command or an
agent reply changing the color and text of the prompt.
2013-03-25 12:54:48 +02:00
Alex Deymo
f037e82669 client: Add color modifiers to NEW, CHG and DEL events.
Events like [NEW], [CHG] and [DEL] can appear in the command console at
any time, even when the user is typing a command. The last line is kept
making the event line appear just before it, something that can be
unnoticed. This patch add meaningful colors for those three event to make
it easier to see them.
2013-03-25 12:53:48 +02:00
David Herrmann
4f7b4fd321 sdptool: Fix recursive search
When doing recursive SDP searches, we must not overwrite our own values
after we retrieved them from SDP. Otherwise, the UUID test will always we
false.
2013-03-25 12:44:21 +02:00
Marcel Holtmann
d3a95e3088 lib: Update list of company identifiers 2013-03-21 11:48:13 -07:00
Alex Deymo
a6761b629f core: Fix wrong argument on agent *_cb functions.
The last argument for the functions pincode_cb, passkey_cb and
confirm_cb is a user data pointer with the "void *". Those functions
expect a "struct authentication_req *", but insted a "struct
btd_device*" without any complaint from the compiler due the void* cast.
This fix passes the right argument to those functions.

Other uses of those functions as callbacks (agent_request_passkey,
agent_request_pincode, agent_request_authorization and
agent_request_confirmation) pass the right struct authentication_req *.
2013-03-21 10:59:33 +02:00