| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
| |
Move the struct containing the Sixaxis-compatible devices to a
header shared with the input profiles code, so as to reduce device
declaration.
Adding support for new devices should be as easy as adding the device's
declaration in profiles/input/sixaxis.h
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, users doing cable configuration of Sixaxis PS3 controllers
would only get asked whether a device was allowed to connect to the
computer when switching it to Bluetooth mode: unplugging it, and
pressing the PS button.
Instead, we should ask the user straight away, through the agent,
whether the pad should be allowed to connect.
This makes it easier to setup those devices, while keeping security.
|
|
|
|
|
|
|
|
|
| |
We can't easily enter digits other than 1 through 4 (inclusive)
so leave it up to the agent to figure out a good passcode
for the iCade.
Note that we can not use the VID/PID of the device, as it is not
yet known at that point.
|
|
|
|
|
| |
It's done in the kernel since 2014 in linux kernel commit
8025087acf9d2b941bae93b3e0967560e7e03e87
|
|
|
|
|
|
|
| |
Some games check the device name to recognize a playstation controller.
This changes the device name, when using a PS3 controller over
bluetooth, to match the device name, that is advertised when using the
controller via USB.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are two problems:
- When main.conf is not found, bluetoothd copies short the default set
of reconnecting intervals to reconnect_interval. It does not match
the reconnct_interval_len used as the array length.
So if a link of device is disconnected, bluetoothd is run over
reconnect_interval as time proceeds and will not time out as expected.
bluetooothd with --debug option outputed the following log in my box:
plugins/policy.c:reconnect_set_timer() attempt 1/7 1 seconds
plugins/policy.c:reconnect_timeout() Reconnecting profiles
plugins/policy.c:conn_fail_cb() status 4
plugins/policy.c:reconnect_set_timer() attempt 2/7 2 seconds
plugins/policy.c:reconnect_timeout() Reconnecting profiles
plugins/policy.c:conn_fail_cb() status 4
plugins/policy.c:reconnect_set_timer() attempt 3/7 0 seconds
plugins/policy.c:reconnect_timeout() Reconnecting profiles
plugins/policy.c:conn_fail_cb() status 4
plugins/policy.c:reconnect_set_timer() attempt 4/7 0 seconds
- When ReconnectIntervals in main.conf includes invalid characters,
reconnct_interval_len value is bigger than the default array length.
So if ReconnectAttempts value in main.conf is bigger than
reconnct_interval_len value and a link of device is disconnected,
bluetoothd is run over reconnect_interval as time proceeds and will
not time out as expected.
bluetooothd with --debug option outputed the following log in my box,
if ReconnectAttempts value was 28 and ReconnectIntervals was inproper:
...
plugins/policy.c:reconnect_set_timer() attempt 6/28 32 seconds
plugins/policy.c:reconnect_timeout() Reconnecting profiles
plugins/policy.c:conn_fail_cb() status 4
plugins/policy.c:reconnect_set_timer() attempt 7/28 64 seconds
plugins/policy.c:reconnect_timeout() Reconnecting profiles
plugins/policy.c:conn_fail_cb() status 4
plugins/policy.c:reconnect_set_timer() attempt 8/28 0 seconds
...
plugins/policy.c:reconnect_set_timer() attempt 25/28 1 seconds
plugins/policy.c:reconnect_timeout() Reconnecting profiles
plugins/policy.c:conn_fail_cb() status 4
plugins/policy.c:reconnect_set_timer() attempt 26/28 3 seconds
plugins/policy.c:reconnect_timeout() Reconnecting profiles
plugins/policy.c:conn_fail_cb() status 4
plugins/policy.c:reconnect_set_timer() attempt 27/28 110683472 seconds
This fix properly uses the default set of reconnecting intervals.
|
| |
|
| |
|
|
|
|
|
| |
If a service connects it should stop new attempts but the current ones
should continue so reconnection should not be reset.
|
|
|
|
| |
policy_connect_sink shall reset the sink_timer not source_timer.
|
|
|
|
|
|
| |
This examples can be done over D-Bus already so it makes no sense to have
it as a plugin and in fact it currently it doesn't even work since it was
never ported to the new code under src/shared.
|
|
|
|
|
|
| |
If the link is disconnected before any profile connects it shall still
reset the attempts as the device actually has been connected, otherwise
the number of attempts may not be respected.
|
|
|
|
| |
Other policies shall not interfere while reconnect is active.
|
|
|
|
| |
Set list separator to ',' as it is used in main.conf.
|
|
|
|
|
|
| |
Patch 96db78604252eeb17614b9982ced95fd66c6c6fc actually breaks
iterating to each attempt since the attempt++ is already done in
reconnect_timeout callback.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This option is used to configure policy for auto enabling adapters when
found. This includes adapters found on start as well as adapters that
are plugged in later on.
Some distributions use legacy "hciconfig hci0 up" in boot-scripts to
automatically enable controllers on start. But that is causing SMP
kernel code to not being properly initialized.
This patch allows distributions to automatically enable adapters in
race free manner even if no agent is provided eg. in login screen.
|
|
|
|
|
| |
The number of attempts and intervals maybe different causing the attempts
to not be incremented properly.
|
|
|
|
|
|
|
|
| |
This patch fixes the following error when bluez is compiled with clang:
plugins/policy.c:780:6: error: cast from 'int *' to 'size_t *' (aka 'unsigned long *') increases required alignment from 4 to 8 [-Werror,-Wcast-align]
(size_t *) &reconnect_intervals_len,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
| |
This adds ReconnectAttempts and ReconnectIntervals so platforms can fine
tune the reconnection strategy.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
If state of Control/Remote services changed from CONNECTING to
DISCONNECTED, and error is set to -EAGAIN, set random timer and try
reconnect. This approach is described in AVRCP Spec 1.5 4.1.1:
"If both devices open an AVCTP channel at the same time both channels
shall be closed and each device shall wait a random time
(not more than 1 s and not less than 100ms) and then try to open
the AVCTP channel again."
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If service becomes unavailable, due to e.g. the device being removed,
all the related timers should be removed as well otherwise it may cause
crashes such as the following:
Invalid read of size 8
at 0x4A6597: btd_device_get_service (device.c:5335)
by 0x40F49F: policy_connect_ct (policy.c:112)
by 0x4E7F552: ??? (in /usr/lib64/libglib-2.0.so.0.4200.1)
by 0x4E7EAEA: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4200.1)
by 0x4E7EE87: ??? (in /usr/lib64/libglib-2.0.so.0.4200.1)
by 0x4E7F1B1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4200.1)
by 0x40BACF: main (main.c:631)
Address 0x73b9ba8 is 360 bytes inside a block of size 592 free'd
at 0x4C2ACE9: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x4E847FE: g_free (in /usr/lib64/libglib-2.0.so.0.4200.1)
by 0x49C83F: device_free (device.c:624)
by 0x4BDB29: remove_interface (object.c:658)
by 0x4BE701: g_dbus_unregister_interface (object.c:1382)
by 0x4A49DC: btd_device_unref (device.c:5173)
by 0x41DC46: avdtp_free (avdtp.c:1138)
by 0x41EE09: connection_lost (avdtp.c:1164)
by 0x422EA5: session_cb (avdtp.c:2263)
by 0x4E7EAEA: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4200.1)
by 0x4E7EE87: ??? (in /usr/lib64/libglib-2.0.so.0.4200.1)
by 0x4E7F1B1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4200.1)
|
|
|
|
| |
Add more description in error logging.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 is also in preparation of set_leds_sysfs().
|
|
|
|
|
|
|
| |
This is in preparation for a set_leds_sysfs() function.
Make set_leds_hidraw() return void, as its return value is never used
by the caller: the setup_leds() callback has to always return FALSE.
|
| |
|
|
|
|
|
|
| |
In the case that the remote starts connecting to us while we're waiting
for the timeout to discover we shouldn't just reset the basic time
keeping variables but also remove the timer.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This patch adds support for continuing reconnecting for several more
times (up to 3 minutes) even when a connection attempt fails.
|
| |
|
| |
|
|
|
|
|
|
| |
Properties are defined by GATT specification. This patch moves and
renames the defines related to Characteristic properties bits from
attrib/att.h to attrib/gatt.h
|
| |
|
|
|
|
| |
This is necessary to do accurate matching for LE devices.
|
|
|
|
|
|
|
| |
If /dev/urandom cannot be opened or read, just fail the plugin
initialization, as it is very unlikely that a fully working Linux system
does not have a working /dev/urandom. This also simplifies the code
logic.
|
|
|
|
|
|
|
|
|
|
|
|
| |
For dual mode devices there are several state variables that are
independent for each bearer. This patch splits these states up into two
separate variable groups in btd_device and tracks the values based on
what kind of connection is in question.
The information is also used to select which bearer to use with
Device1.Connect and Device1.Pair. The basic rule is that the bearer
that's not connected/paired is selected, or then the bearer over which
the device was last seen is selected.
|
|
|
|
|
| |
Fix device_get_name() to null-terminate the name string it returns.
Modify all callers as needed.
|
| |
|
| |
|
|
|
|
| |
This makes function flow easier to follow.
|
|
|
|
|
| |
Handle UUIDs received in EIR from neard in same way as UUIDs received
on device discovery.
|