Commit Graph

14595 Commits

Author SHA1 Message Date
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
Luiz Augusto von Dentz
aa005c05b6 AVRCP: Fallback to GetElementAttributes if GetItemAttributes fails
If GetItemAttributes fails with error set to player not browsable
fallback to GetElementAttributes.
2013-03-20 11:04:32 +02:00
Luiz Augusto von Dentz
a3b74e3b06 AVRCP: Reduce number of request to refresh the player list
In case the addressed player changes but it features is already known
the list of players don't need to be refreshed.
2013-03-20 11:04:30 +02:00
Luiz Augusto von Dentz
f9bef66d81 player: Check if values really changed before emitting signals 2013-03-20 11:04:28 +02:00
Luiz Augusto von Dentz
c794c470e8 AVRCP: Add support for available player changed event for CT role
This adds support for registering to available player changed event if
supported by TG.
2013-03-20 11:04:26 +02:00
Bruna Moreira
bf1f68d91e tools: Add basic invalid parameters test for stop discovery 2013-03-19 15:45:51 +02:00
Bruna Moreira
1b5a1d3aa9 tools: Add basic rejected test for stop discovery 2013-03-19 15:45:12 +02:00
Bruna Moreira
0f7d9ee5d6 tools: Add basic success test for stop discovery 2013-03-19 15:44:25 +02:00
Bruna Moreira
d54b8ac795 tools: Add basic success test for start discovery 2013-03-19 15:43:02 +02:00
Alex Deymo
e4968e7fda textfile: Fix a pointer arithmetic logic bug in read_key()
A substraction of pointers ends up in a wrong computation of the size
passed to strnpbrk() in read_key(). This patch fixes the pointer logic.
2013-03-15 16:29:19 -05:00
Alex Deymo
ed881174ca textfile: find_key parsing nit
The find_key function should return a pointer to the begining of the
line in the config file (map) that has the given keyword. This patch
fixes a wrong logic when the another keyword has the given keyword as a
prefix and appears in the first line of the file.
2013-03-15 16:27:20 -05:00
Luiz Augusto von Dentz
8c0e4bd6a4 tools: Reduce verbosity of mpris-player 2013-03-12 12:27:57 +02:00
Luiz Augusto von Dentz
14421bd0b7 tools: Fix not using player name in the Identity property
This fixes the format of player Identity property, also use Name property
when available.
2013-03-12 12:25:48 +02:00
Mikel Astiz
21723d6bfd profile: Limit to one remote UUID per profile
The code can be considerably simplified by constraining struct
btd_profile to one single remote UUID.
2013-03-10 09:05:04 +02:00
Mikel Astiz
48563e3d3e health: Split health into two btd_profile
Register a separate btd_profile for each health device role.
2013-03-10 09:03:31 +02:00
Mikel Astiz
338c7de753 gatt: List only GATT_UUID as remote UUID
The probe function checks if both UUIDs are present, so there is no
need to list both in btd_profile.
2013-03-10 09:03:01 +02:00
Mikel Astiz
32326556fa proximity: Split monitor into three btd_profile
Split into three btd_profile such that each of them handles one single
UUID.
2013-03-10 09:02:16 +02:00
Mikel Astiz
94823ec7ed proximity: Split internal monitor registration API
Split the monitor registration API into three independent registrations
each of them taking one specific GATT primary.
2013-03-10 09:00:25 +02:00
Mikel Astiz
92121259c3 audio: Split AVRCP into two btd_profile
Register a separate btd_profile for each role of AVRCP.
2013-03-10 08:59:24 +02:00
Mikel Astiz
44a6633229 avrcp: Refactor server registration
Use a helper function to install the AVRCP server, just like other audio
profiles such as in a2dp.c do.
2013-03-10 08:55:40 +02:00
Johan Hedberg
bcb96cdde5 emulator: Allow multiple vhci adapter creation with btvirt 2013-03-07 19:01:30 +02:00
Johan Hedberg
90cb7c5884 emulator: Fix unique bdaddr creation for multiple vhci_open() calls 2013-03-07 18:32:59 +02:00
Luiz Augusto von Dentz
4e2f84dd9e AVRCP: Fix not checking for invalid player items
This adds checks for invalid size in the media player list returned by
GetFolderItems that could cause crashes.
2013-03-07 17:19:54 +02:00
Luiz Augusto von Dentz
ec17923aa6 AVRCP: Fix not checking for invalid player name length
This adds checks for invalid player name length that could cause crashes
while reading invalid memory.
2013-03-07 17:18:59 +02:00
Luiz Augusto von Dentz
dbaf48e31e AVRCP: Fix not checking for invalid folder length
This adds checks for invalid folder length in SetBrowsedPlayer that
could cause crashes while reading invalid memory.
2013-03-07 17:16:11 +02:00