Commit Graph

993 Commits

Author SHA1 Message Date
Chan-yeol Park
7fdbce3d72 audio/a2dp: Remove useless check_vendor_codec()
This function could be removed because A2DP vendor codec match is
already verified in avdtp_find_remote_sep().
2015-05-25 16:06:14 +03:00
Chan-yeol Park
15295bc4bc audio/avdtp: Add a2dp vendor codec match callback
When matching remote SEP to local SEP avdtp does not compare vendor
codecs properly, i.e. neither vendor ID not codec ID are checked,
which may cause wrong endpoint to be selected in case there are more
that one endpoints using vendor codec on remote.

This patch fixes it by adding a2dp codec match call back.
2015-05-25 16:06:11 +03:00
Grzegorz Kolodziejczyk
c895e5ae5b profiles/network: Add support for handling extension hdr in ctrl msg
Support for extension headers is mandatory functionality. This patch
add support to it and leave responsibility for processing extension
header and sending setup success response to kernel.

This patch is necessary to pass PTS bnep test TC_CTRL_BV_19_C.
2015-05-19 16:33:35 +02:00
Luiz Augusto von Dentz
97b5bf5d9a audio/avrcp: Reduce the interval of position changed
Using UINT32_MAX overflow in Android implementation as it multiple the
value by 1000 to get the interval in miliseconds which seem to truncate
the value causing it to send position changed too frequently flooding
the channel.
2015-05-11 10:55:58 +03:00
Luiz Augusto von Dentz
97e60dbc1e audio/avrcp: Use position changed event to resync
Some player do not change state when backward is pressed only once,
instead it will just start the track from the beginning.

To fix this subscribe to playback position changed event since it is
mandatory to be sent in the following conditions:

 - TG has reached the registered playback Interval time.
 - Changed PLAY STATUS.
 - Changed Current Track.
 - Reached end or beginning of track.
2015-05-07 10:43:34 +03:00
Arman Uguray
73b28a10cb profiles/hog: Fix Invalid Handle error
This patch fixes an Invalid Handle error that gets returned while
discovering the "External Report Reference" descriptors, where an
invalid handle range of "0x00 - 0xff" was being used. 0x0000 is an
invalid handle in ATT so this patch fixes changes the range to
"0x0001 - 0xffff".
2015-05-01 12:42:49 -07:00
Petri Gynther
1496665a47 hog: fix HoG reconnect handling in attio_connected_cb()
On HoG device reconnect, attio_connected_cb() should re-enable
HoG report notification callbacks for only those HoG reports that
have a valid CCC handle and notifications enabled on the device.

Note that the call:
enable_report_notifications(r, false)

only reinstalls the callback for HoG report notifications. It doesn't
rewrite the HoG report notification enable bit on the HoG device.
2015-04-30 14:53:26 -07:00
Petri Gynther
e9c89452a7 hog: enable HoG report notifications only after uHID is ready
HoG report notifications should be enabled only after the uHID device
has been created. uHID layer cannot process HoG reports any earlier.
2015-04-30 14:53:26 -07:00
Petri Gynther
f539de6387 hog: rework HoG report notifications enable
1. Store HoG report CCC handle in the report data structure, so that
   it can be used when needed.
2. Rename write_ccc() to enable_report_notifications().
3. In enable_report_notifications():
   - first register the callback for HoG report notifications
   - then enable the notifications on the HoG device
4. In report_ccc_written_cb():
   - improve the emitted messages
2015-04-30 14:53:26 -07:00
Szymon Janc
a8b1be8f82 profiles/network: Fix crash in network_property_get_uuid
Crash was due to invalid use of libdbus API.

Invalid read of size 1
   at 0x4A092F2: strlen (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x36A9A29DF3: ??? (in /usr/lib64/libdbus-1.so.3.7.12)
   by 0x36A9A17CC4: ??? (in /usr/lib64/libdbus-1.so.3.7.12)
   by 0x36A9A19EAD: dbus_message_iter_append_basic (in /usr/lib64/libdbus-1.so.3.7.12)
   by 0x42B9B6: network_property_get_uuid (connection.c:453)
   by 0x4847EE: append_property.isra.1 (object.c:510)
   by 0x4849EF: process_properties_from_interface (object.c:1688)
   by 0x484D23: process_changes (object.c:1719)
   by 0x36A7E492A5: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3800.2)
   by 0x36A7E49627: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
   by 0x36A7E49A39: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3800.2)
   by 0x40AF95: main (main.c:661)
 Address 0x3631313130303030 is not stack'd, malloc'd or (recently) free'd
2015-04-09 14:28:28 +02:00
Szymon Janc
546ec13c0d profiles/network: Fix not being able to initiate connection
This was due to incorrect use of bt_uuid_to_uuid128 where source
and destination parameters were reversed.
2015-04-09 14:25:01 +02:00
Szymon Janc
b148a4edf1 audio/control: Remove unused control_is_active function 2015-03-25 13:13:09 +02:00
Luiz Augusto von Dentz
f58d61e7fd audio/avrcp: Fix crash when acting as TG
When acting as TG the code may end up using GetCapabilities to figure
out if volume changed event is supported, this cause crashes with
remote devices that don't support TG themselves because
session->controller is not initialized.

Note that to pass AVRCP qualification when volume changed is supported
the device has to support TG as well as CT record, this is because PTS
will attempt to fetch the TG record for any test that it is sending
commands so devices where this crash happen most likely don't have
volume control feature enabled.
2015-03-18 11:40:19 +02:00
Hsin-Yu Chao
eaef1c5602 audio/avdtp: Fix crash at NULL cb of discover_callback
This fixes a crash with below trace that a discover_callback
object has a NULL cb function pointer being triggered, which
may due to an error happened in avdtp_discover() and left it
unset.

0x00000000 in ?? ()
0xb6f5606e in finalize_discovery (err=22, session=0xb7514a00)
  at profiles/audio/avdtp.c:1043
connection_lost (session=session@entry=0xb7514a00, err=err@entry=22)
  at profiles/audio/avdtp.c:1143
0xb6f57cf6 in avdtp_connect_cb (chan=<optimized out>, err=0xb7514410,
  user_data=0xb7514a00) at profiles/audio/avdtp.c:2373
0xb6f723e4 in accept_cb (io=0xb7516a10, cond=<optimized out>,
  user_data=0xb7516b48) at btio/btio.c:203
0xb6e6cf10 in ?? ()
2015-03-17 17:45:09 +02:00
Marcin Kraglak
fd184248cf audio/avctp: Cancel outgoing connection in case of conflict
According to AVRCP Spec 1.5 AVCTP channel should be closed if both
sides try establish connection at the same time.
2015-03-13 13:28:23 +02:00
Marcin Kraglak
258c5ee46c audio/avrcp: Pass error to session_destroy()
It will allow us to invoke btd_service_connecting_complete() or
btd_service_disconnecting_complete() with correct error code.
2015-03-13 13:28:23 +02:00
Marcin Kraglak
58cb825246 audio/avrcp: Always notify about disconnecting service
If there is a call to avrcp_connect, state of service is changed to
BTD_SERVICE_STATE_CONNECTING. If connection failed, state didn't change
to BTD_SERVICE_STATE_DISCONNECTED because controller_destroy() and
target_destroy() was not called. Set state of services in session_destroy()
instead.
2015-03-13 13:28:23 +02:00
Marcin Kraglak
bc978b5b79 audio/avctp: Pass error argument to avctp_state_changed callback
This additional argument will help higher layer to recognize what action should be
taken in error condition.
2015-03-13 13:28:23 +02:00
Marcin Kraglak
c7aaa93147 audio/avrcp: Remove redundant check
There is no need to check if device has specific services,
it was checked in session_init_control.
2015-03-13 13:28:22 +02:00
Grzegorz Kolodziejczyk
b3c62f3063 profiles/network: Move disconnection_cb setting to bnep connect
Disconnect callback can be set while connecting bnep. In previous
implementation there was separated method to setting up the disconnect
callback and it was always called immediately after calling connect -
this method was redundand.
2015-03-12 23:25:42 +01:00
Grzegorz Kolodziejczyk
7824d0b60c profiles/network: Remove not needed bnep_name function
This function and service structure declaration is no longer needed
since related code was distracted.
2015-03-12 23:24:13 +01:00
Grzegorz Kolodziejczyk
ab0b65ad6d profiles/network: Remove unneeded bnep_uuid function from bnep code
This function is no longer needed since connection and server can handle
this functionality by itself.
2015-03-12 23:23:54 +01:00
Grzegorz Kolodziejczyk
b5a1ee8d30 profiles/network: Fix sending error in bnep_server_add
If bnep server add will not proceed successfully, approperiate error
should be returned. Now it returns error if control message send will
fail.
2015-03-12 17:39:48 +01:00
Szymon Janc
247aa7074a profiles/network: Remove not needed checks
bnep_setup_decode returns success only if destination UUID is valid
so no need to double check that in caller.
2015-03-12 12:34:50 +01:00
Szymon Janc
d6abe69778 profiles/network: Fix compilation error
CC       profiles/network/bluetoothd-bnep.o
profiles/network/bnep.c: In function ‘bnep_server_add’:
profiles/network/bnep.c:633:22: error: initialization makes integer
    from pointer without a cast [-Werror]
  uint16_t rsp, dst = NULL;
2015-03-12 12:28:54 +01:00
Grzegorz Kolodziejczyk
e0ffe04893 profiles/network: Keep interface arguments naming consistent
Arguments shall keep consistent naming.
2015-03-12 11:08:00 +01:00
Grzegorz Kolodziejczyk
10125a912d profiles/network: Fix sending command responses
Command response can be three bytes long (in case if command is not
understood) 1 byte(packet type) + 1 byte(control type) + 1 byte(unknown
control type). Command response can be also four bytes long if it's
response for setup connection, filter net type and filter multi addr,
1 byte(packet type) + 1 byte(control type) + 2 byte(response message).
2015-03-12 11:08:00 +01:00
Grzegorz Kolodziejczyk
b104ec8263 profiles/network: Handle ctrl rsp after conn setup by bnep
This patch moves setup control response to bnep and makes it private.
2015-03-12 11:08:00 +01:00
Grzegorz Kolodziejczyk
6f7dcbe7a7 profiles/network: Move bnep connection setup logic to bnep
BNEP connection set up logic which was added before bnep_server_add,
can be private method of bnep. Moved logic was almost doubled in two
cases: NAP role in PAN, server listening. Now set up and connect
scenario check of bnep connection is only handled in bnep part for
listen connections.
2015-03-12 11:08:00 +01:00
Grzegorz Kolodziejczyk
be130b5f60 profiles/network: Make get_service_id connections private method
get_service_id method is used only within connection code to get id (16
bit value) of received string format 128bit uuid or service named e.g.
panu, gn or nap. There is no need to make it public as bnep.c only
related code.
2015-03-09 16:12:23 +01:00
Grzegorz Kolodziejczyk
1d70b7326f profiles/network: Shortening service name argument to svc
Current argument naming is long and it can be simplified to svc.
2015-03-09 16:11:41 +01:00
Grzegorz Kolodziejczyk
38a7f19f04 profiles/network: Integrate get and check bnep setup services roles
While bnep setup, roles must be determined and checked if the connection
scanario is possible. Get and check possible service roles routines are
always performed in serie. So there is no need to split it to separate
calls.
2015-03-09 16:04:11 +01:00
Grzegorz Kolodziejczyk
9e7341779b profiles/network: Add appropriate log prefix
Logs should have appropriate prefixes eg. bnep.
2015-03-09 16:02:47 +01:00
Hsin-Yu Chao
01aa5f5774 audio/media: Fix crash at endpoint handling no reply
When handling DBUS_ERROR_NO_REPLY error in media endpoint, the
a2dp_setup gets unref'ed in the associated request callback when
it's called for the first time.  A crash happens in the later
clear_endpoint call with below backtrace that, the request callback
will be triggered again with NULL session.
To fix this, remove the additional request callback so that every
callback only gets triggered for once in clear_endpoint.
2015-03-08 13:08:11 +02:00
Luiz Augusto von Dentz
a9e7f4c0ed audio: Remove unused API 2015-03-06 15:20:29 +02:00
Luiz Augusto von Dentz
fe9ba4ff04 audio: Remove avdtp_server struct
avdtp_server struct doesn't make sense to exist since there exist an
equivalent in the form of a2dp_server which can be used as context for
incoming connections.
2015-03-06 15:20:08 +02:00
Grzegorz Kolodziejczyk
8247239e41 profiles/network: Simplify id and bridge of server checking
This patch simplifies checking of server record id and bridge, if those
exists.
2015-03-02 12:24:40 +01:00
Grzegorz Kolodziejczyk
42eb659fd6 profiles/network: Minor style fix
This patch fixes style issues e.g. line aligns, braces.
2015-03-02 12:24:40 +01:00
Marcel Holtmann
85180c23f7 profiles: Fix includes for gdbus.h header 2015-03-01 00:14:21 -08:00
Marcel Holtmann
318e32cddb profiles: Use local libbluetooth includes 2015-02-28 23:58:08 -08:00
Marcel Holtmann
17763527a3 profiles: Use local libbluetooth includes 2015-02-28 23:33:09 -08:00
Andrei Emeltchenko
3361ceaeab audio/avdtp: Fix session list handling
Until we move to queue we shall use server->sessions, this will be
changed in the following patches.
2015-02-23 16:17:32 +02:00
Andrei Emeltchenko
e80a68defc audio/a2dp: Fix server name typo
Fixes typo in server name
2015-02-23 11:29:10 +02:00
Andrei Emeltchenko
5cc71d9a56 audio/a2dp: Fix queue initialization
After changing GSList to queue initialization was missing.
2015-02-23 11:29:09 +02:00
Andrei Emeltchenko
625e2c62fc audio/avdtp: Use SEP queue instead of avdtp_server in avdtp code
This makes register/unregister sep code inside avdtp.c similar between
profiles/ and android/
2015-02-22 21:27:37 +01:00
Andrei Emeltchenko
104e05acca audio/avdtp: Move avdtp_server from avdtp SEP structures
a2dp_server and avdtp_server are handled inside a2dp_sep structure.
2015-02-22 21:27:37 +01:00
Andrei Emeltchenko
b840e5edc8 audio: Refactor avdtp_get function
Refactor avdtp_get() moving it from avdtp to a2dp and renaming to
a2dp_avdtp_get().
2015-02-22 21:27:27 +01:00
Andrei Emeltchenko
9fa1b5afac audio/avdtp: Replace GSList with queue for SEP list 2015-02-22 21:26:25 +01:00
Andrei Emeltchenko
d042c6f33a audio/avdtp: Refactor avdtp and a2dp code
Move connection-related code from avdtp to a2dp. This shall help to use
same avdtp library in profiles/ and android/ code.
2015-02-22 21:26:25 +01:00
Andrei Emeltchenko
aabaa70200 audio/avdtp: Use bitfield id generation
Use bitfield utils for assigning SEP id. This fixes duplicated id
generation shown in unit/avdtp tests.
2015-02-22 21:26:25 +01:00