On recent kernels the hid-sony driver exposes leds class entries in
sysfs for setting the Sixaxis LEDs, use this interface and fall back to
hidraw in case using sysfs fails (e.g. on older hid-sony versions).
Setting the LEDs via sysfs is the preferred way on newer kernels, the
rationale behind that is:
1. the Sixaxis uses the same HID output report for setting both LEDs
and rumble effects;
2. hid-sony remembers the state of LEDs in order to preserve them when
setting rumble effects;
3. when the LEDs are set via hidraw hid-sony has no way to know the
new LEDs state and thus can change the LEDs in an inconsistent way
when setting rumble effects later.
Also require libudev >= 172, this is where
udev_enumerate_add_match_parent() has been first introduced.
NOTE: using udev_enumerate_add_match_parent() results in a memory leak
when enumerating child devices, this has been fixed in udev 207; the
commit which fixes the issue is this one:
http://cgit.freedesktop.org/systemd/systemd/commit/?id=51cc07576e119dea6e65478eeba9472979fd0936
Get all the data necessary to set the LEDs in a single function,
returning a leds_data structure to be passed as argument to the
setup_leds() callback.
For now only a 'bitmap' field is used, which is the only thing that
set_leds_hidraw() needs.
Match hid devices and input devices using HID_UNIQ and UNIQ when these
are available, this is the correct way to get matching devices when the
controllers are connected via BT (UNIQ refers to the device bdaddr, PHYS
is the adapter bdaddr, so matching against PHYS will result in all
devices with the same LED number).
Fall back to HID_PHYS and PHYS when needed, hid devices do not define
HID_UNIQ when connected via USB.
This patch adds loading of aptX encoder library which should be provided
by user. hal-audio-aptx will try to load 'libbt-aptx.so' so it should be
available in search patch, preferably in /system/lib.
This patch adds support for aptX codec. Since this is proprietary codec
it requires to obtain license form vendor (CSR) in order to use it.
Also shared library which provices encoder implementation is required
since this implementation only wraps it into audio HAL.
This patch adds optional load/unload methods for codec which can be
used to initialize some static data for codec, e.g. load shared library
which provides encoder. Unlike init/cleanup which are called on stream
open/close these methods are called when audio device is opened/closed
thus most likely only once.
Codecs which are loaded properly (or do not have load callback) are
added to separate queue and used later to register endpoints.
This adds handling for fragmentation if the PDU cannot fit into a AV/C
frame which can be up to 512 bytes or less depending on the L2CAP MTU
negotiated.
We indicate service change on service stop and service start API calls.
Indication is also send when connecting to bonded device to force it
rebuilding its cache. Write request is properly handled on the response
queue know.
Client Characteristic Configuration for Service Changed Characteristic
should be stored for every bonded device, so we know if we should be
sending value (range affected by changes) indication.
We should set g_attrib mtu with MIN of two values: Remote Rx MTU
and local Tx MTU. In previous solution once we set g_attrib mtu, we
could only reduce MTU (because we took previously set g_attrib MTU
and Remote Rx MTU). It affected cases when remote wanted to increase
MTU.
Once remote device sends write execute we need to notify all the
server applications with this. Application will send response on this and
once we collect all the responses we should send execute write response
to remote device
This is initial version of handling execute write. Still many corner cases
have to be handled. Some of them seems to be not easy to solve with
existing BT HAL API e.g. BlueZ sends execute write to couple of server
applications and one of them reply with error. According to spec execute
write shall be atomic. In scenario that one server out of many replies
with error makes this write not atomic. There is no way to handle it with current
BT HAL API.
It is needed because in some cases we send few read requests to applications.
Now all transactions data are overriden by last one, and if application wants
to respond to previous requests, transaction data is not found.
It happens when two devices will read attribute from one application in the same
time or if device will read few values in time (i.e. read by type request or find
by type value request).
During configure, if SBC is not installed in the system, we may use
SBC_CFLAGS and SBC_LIBS variables to indicate where SBC headers and
binaries can be found.
However, SBC_CFLAGS variable is not used in android/Makefile.am,
causing the following compile error:
$ ./bootstrap-configure SBC_CFLAGS=-I../sbc SBC_LIBS=-L../sbc/src/
$ make
(...)
android/hal-audio-sbc.c:22:21: fatal error: sbc/sbc.h: No such file or directory
#include <sbc/sbc.h>
^
compilation terminated.
make[1]: *** [android/android_audio_a2dp_default_la-hal-audio-sbc.lo] Error 1
This patch fixes this error by appending SBC_CFLAGS to android_audio_
a2dp_default_la_CFLAGS.
EHOSTDOWN error is now overwritten by EIO and once it's passed to
device_profile_connected it triggers connection of another profiles
while it should actually stop connecting them.
In case ACL connection failed to establish, all pending services shall
be always removed. At the moment it's only done in case there's pending
Connect message which does not take into account reconnect scenario,
i.e. service connection was triggered by reconnection timeout and there
is no pending message.
In such case, when reconnection failed there will be some services on
pending list and subsequent reconnect attempts will fail with EBUSY
immediately.
By changing repeat mode to 'group' which does not have a direct
translation to MPRIS LoopStatus will cause the following crash:
_dbus_abort () from /usr/lib/libdbus-1.so.3
_dbus_warn_check_failed () from /usr/lib/libdbus-1.so.3
dbus_message_iter_append_basic () from /usr/lib/libdbus-1.so.3
set_repeat_setting (key=0x80d6a87 "Repeat", value=0x80d8079 "group", user_data=0x984ab40) at profiles/audio/media.c:1050
get_tid() may return NULL if bogus tid is passed.
This fix following crash:
Invalid write of size 1
at 0x4A0A643: memcpy@@GLIBC_2.14 (in /usr/lib64/valgrind/
vgpreload_memcheck-amd64-linux.so)
by 0x4218E4: search_attr_req (sdp.c:413)
by 0x42214D: sdp_packet (sdp.c:748)
by 0x41ED09: l2cap_frame (l2cap.c:2632)
by 0x414D51: packet_hci_acldata (packet.c:7713)
by 0x415133: packet_monitor (packet.c:3332)
by 0x404AEC: control_reader (control.c:911)
by 0x40231A: main (main.c:197)
Address 0x6 is not stack'd, malloc'd or (recently) free'd
Process terminating with default action of signal 11 (SIGSEGV)
Access not within mapped region at address 0x6
at 0x4A0A643: memcpy@@GLIBC_2.14 (in /usr/lib64/valgrind/
vgpreload_memcheck-amd64-linux.so)
by 0x4218E4: search_attr_req (sdp.c:413)
by 0x42214D: sdp_packet (sdp.c:748)
by 0x41ED09: l2cap_frame (l2cap.c:2632)
by 0x414D51: packet_hci_acldata (packet.c:7713)
by 0x415133: packet_monitor (packet.c:3332)
by 0x404AEC: control_reader (control.c:911)
by 0x40231A: main (main.c:197)
It will return true if attribute with given handle exists in db and
set permissions value, otherwise it will return false.
Now, if get_permissions failed, we should reply with
ATT_ECODE_ATTR_NOT_FOUND.