Commit Graph

30 Commits

Author SHA1 Message Date
Szymon Janc
61745d2bb8 sixaxis: Fix Bluetooth PS3 clone joypad being named like the original
When cable pairing a PS3 clone device, we should try and keep the USB device
name to create a new btd_device so that the joypad is named after its USB name
when connecting through Bluetooth.

If that isn't done, "Shanwan" clone joypads are named like the genuine joypads, and
kernel Bluetooth quirks aren't applied.

gh-issue: https://github.com/bluez/bluez/issues/46
2021-02-22 09:22:59 +01:00
Tedd Ho-Jeong An
e59926d762 profiles: Add SPDX License Identifier
This patch adds SPDX License Identifier and removes the license text.

-------------------------------------
       License            COUNT
-------------------------------------
 GPL-2.0-or-later     :     72
 LGPL-2.1-or-later    :      6

License: GPL-2.0-or-later
   profiles/deviceinfo/dis.c
   profiles/deviceinfo/deviceinfo.c
   profiles/health/hdp_types.h
   profiles/health/mcap.c
   profiles/health/hdp_manager.c
   profiles/health/hdp_main.c
   profiles/health/mcap.h
   profiles/health/hdp_util.h
   profiles/health/hdp_manager.h
   profiles/health/hdp_util.c
   profiles/health/hdp.c
   profiles/health/hdp.h
   profiles/network/server.c
   profiles/network/connection.h
   profiles/network/connection.c
   profiles/network/manager.c
   profiles/network/bnep.c
   profiles/network/server.h
   profiles/network/bnep.h
   profiles/battery/battery.c
   profiles/cups/cups.h
   profiles/cups/sdp.c
   profiles/cups/main.c
   profiles/cups/spp.c
   profiles/cups/hcrp.c
   profiles/scanparam/scpp.c
   profiles/scanparam/scan.c
   profiles/audio/transport.h
   profiles/audio/avdtp.h
   profiles/audio/source.c
   profiles/audio/player.c
   profiles/audio/avctp.c
   profiles/audio/control.h
   profiles/audio/a2dp.c
   profiles/audio/source.h
   profiles/audio/transport.c
   profiles/audio/sink.c
   profiles/audio/avrcp.h
   profiles/audio/avdtp.c
   profiles/audio/a2dp.h
   profiles/audio/avrcp.c
   profiles/audio/media.h
   profiles/audio/avctp.h
   profiles/audio/control.c
   profiles/audio/sink.h
   profiles/audio/player.h
   profiles/audio/media.c
   profiles/sap/server.c
   profiles/sap/sap-dummy.c
   profiles/sap/main.c
   profiles/sap/sap.h
   profiles/sap/manager.c
   profiles/sap/server.h
   profiles/sap/manager.h
   profiles/iap/main.c
   profiles/gap/gas.c
   profiles/midi/midi.c
   profiles/midi/libmidi.c
   profiles/midi/libmidi.h
   profiles/input/server.c
   profiles/input/suspend.h
   profiles/input/uhid_copy.h
   profiles/input/device.c
   profiles/input/hog.c
   profiles/input/device.h
   profiles/input/hidp_defs.h
   profiles/input/manager.c
   profiles/input/suspend-none.c
   profiles/input/sixaxis.h
   profiles/input/hog-lib.c
   profiles/input/suspend-dummy.c
   profiles/input/server.h

License: LGPL-2.1-or-later
   profiles/deviceinfo/dis.h
   profiles/battery/bas.h
   profiles/battery/bas.c
   profiles/scanparam/scpp.h
   profiles/audio/a2dp-codecs.h
   profiles/input/hog-lib.h
2020-09-21 16:19:36 -07:00
Archie Pusaka
0fe6813888 input: encrypt on receive conn req if classic_bonded_only
According to bluetooth HID1.1 spec, section 5.4.3.5.3:
If the Bluetooth HID Host is bonded to a Bluetooth HID device:
If encryption is not already enabled, the Bluetooth HID Host shall
enable encryption with the Bluetooth HID device before sending an
L2CAP Connect Response with a result code of “Connection Successful”
(0x0000) after an L2CAP Connect Request is received.

This patch raises the security level to medium when listening for
incoming connection if the flag classic_bonded_only is set,
effectively starting encryption.
2020-07-23 09:42:26 -07:00
Luiz Augusto von Dentz
6c467e923b sixaxis: Fix compilation and various coding style issues
This fixes the following problems:

plugins/sixaxis.c:443:7: error: ‘version’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  if (!setup_device(fd, sysfs_path, name, source, vid, pid, version, type, adapter))
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
plugins/sixaxis.c:409:34: note: ‘version’ was declared here
  uint16_t bus, vid, pid, source, version;
                                  ^~~~~~~
plugins/sixaxis.c:443:7: error: ‘source’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  if (!setup_device(fd, sysfs_path, name, source, vid, pid, version, type, adapter))
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
plugins/sixaxis.c:409:26: note: ‘source’ was declared here
  uint16_t bus, vid, pid, source, version;
                          ^~~~~~
cc1: all warnings being treated as errors

And many instances of code going over 80 columns.
2017-10-27 13:42:33 +03:00
Bastien Nocera
5832b01a30 profiles/input: Add DS4 devices to the shared header
And simplify the detection code in server.c some more.
2017-10-27 09:58:06 +02:00
Bastien Nocera
989b6f9f03 profiles/input: Use sixaxis header to simplify device detection
Use the shared header to recognise whether a device is a Sixaxis device
or not.
2017-10-27 09:58:06 +02:00
Marcel Holtmann
318e32cddb profiles: Use local libbluetooth includes 2015-02-28 23:58:08 -08:00
Alex Gal
face37796d profiles/input: Add Sony Navigation Controller 2014-11-07 21:51:00 +01:00
Johan Hedberg
c5162672e9 input: Fix access to uninitialized data when authorizing connections
There were bt_io_get() failure code paths in two places that would
access "src" and "dst" when they are uninitialized. This would happen
e.g. if the HID device disconnects before we've authorized the
connection. To fix this we now save the remote address in a more
complete confirm context and use the source address already available in
the server context.
2014-06-10 13:27:55 +03:00
Johan Hedberg
c19756d372 core: Update btd_adapter_find_device to also match the address type
This is necessary to do accurate matching for LE devices.
2014-03-22 19:34:32 +02:00
Marcel Holtmann
8c45ca3f2e profiles: Use full include path for header files 2014-01-25 20:08:59 -08:00
Johan Hedberg
1a9051e9ee Rename glib-helper to uuid-helper 2014-01-21 14:12:47 +02:00
Szymon Janc
0a33c0ab40 input: Add DualShock 4 detection
DS4 tries to connect right after pairing before SDP search completed
and no idev is present yet.
2014-01-18 21:09:20 +02:00
Szymon Janc
8d2bdf4eef input: Fix connecting new trusted sixaxis device
If sixaxis device was trusted before first connection over Bluetooth
connection might get accepted before device services were discovered.
This results in conection to PSM19 not being added to idev. To fix
this channel for PSM19 is also added to SDP complete callback so that
both channels are added.
2014-01-09 17:55:56 +02:00
Szymon Janc
fc8f951c07 input: Fix check if device is sixaxis in auth_callback
We need to accept connection if idev is not present but device is sixaxis.
This fix not doing so for sixaxis devices.
2014-01-09 17:55:49 +02:00
Szymon Janc
e5a2670fa9 input: Fix crash on authorization reply with first sixaxis connection
Bogus unref in sixaxis_sdp_cb was resulting in NULL pointer dereference when
auth_callback was called.

src/adapter.c:connected_callback() hci0 device 00:06:F7:57:08:9E
    connected eir_len 5
src/device.c:device_set_class() /org/bluez/hci0/dev_00_06_F7_57_08_9E
    0x000508
profiles/input/server.c:connect_event_cb() Incoming connection from
    00:06:F7:57:08:9E on PSM 17
profiles/input/device.c:input_device_set_channel() idev (nil) psm 17
profiles/input/server.c:confirm_event_cb()
src/agent.c:agent_ref() 0x8117eb8: ref=2
src/agent.c:agent_authorize_service() authorize service request was
    sent for /org/bluez/hci0/dev_00_06_F7_57_08_9E
src/device.c:device_probe_profiles() Probing profiles for device
    00:06:F7:57:08:9E
profiles/input/device.c:input_device_register()
    /org/bluez/hci0/dev_00_06_F7_57_08_9E
src/service.c:btd_service_ref() 0x811f580: ref=2
src/service.c:change_state() 0x811f580: device 00:06:F7:57:08:9E
    profile input-hid state changed: unavailable -> disconnected (0)
src/device.c:device_svc_resolved()
    /org/bluez/hci0/dev_00_06_F7_57_08_9E err 0
profiles/input/server.c:sixaxis_sdp_cb() err 0 (Success)
profiles/input/device.c:input_device_set_channel() idev 0x8118568 psm
    17
profiles/input/server.c:connect_event_cb() Incoming connection from
    00:06:F7:57:08:9E on PSM 19
profiles/input/device.c:input_device_set_channel() idev 0x8118568 psm
    19
src/service.c:change_state() 0x811f580: device 00:06:F7:57:08:9E
    profile input-hid state changed: disconnected -> connected (0)
sixaxis: compatible device connected: PLAYSTATION(R)3 Controller
    (054C:0268)
plugins/sixaxis.c:setup_leds() number 2
sixaxis: failed to set LEDS (0 bytes written)
src/agent.c:agent_ref() 0x8117eb8: ref=3
Program received signal SIGSEGV, Segmentation fault.
2014-01-09 17:55:06 +02:00
Johan Hedberg
b8444f19f0 input: Rename check_sixaxis to dev_is_sixaxis for clarity 2013-11-27 12:14:32 +02:00
Szymon Janc
9828feef4c input: Add support for handling sixaxis devices
This allows to handle incoming connection from unknown devices.
If device happens to be sixaxis input device is created after
SDP was queried and then connection is authorized.
2013-11-27 11:29:33 +02:00
Johan Hedberg
1549e0a614 input: Fix rejecting connections from unknown devices 2013-07-12 14:04:05 +03:00
Johan Hedberg
0c575e46ec input: Add some extra debug statements to clarify connection flow 2013-07-12 12:26:54 +03:00
Lucas De Marchi
f81021d086 input: Get rid of gint
Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.
2013-05-01 09:08:57 +03:00
Marcel Holtmann
211412b840 profiles: Fix includes for uuid.h 2013-01-09 20:30:30 -08:00
Johan Hedberg
b8779d2202 Revert "Ensure config.h is included by using CPPFLAGS"
This reverts commit 8a03376544.

The patch needs to be split up and the gdbus/ changes were bogus
compared to the original commit message.

Conflicts:
	Makefile.am
	Makefile.obexd
	profiles/cyclingspeed/cyclingspeed.c
	profiles/heartrate/heartrate.c
	src/error.c
2012-12-07 12:46:04 +02:00
Lucas De Marchi
49b5612042 Use the entire include path for btio.h 2012-12-05 17:23:04 +02:00
Lucas De Marchi
8a03376544 Ensure config.h is included by using CPPFLAGS
Instead of trying to include config.h in each file over the tree and
possibly forgetting to include it, give a "-include config.h" argument
to the compiler so it's guaranteed that a) it will be included for all
source files and b) it will be the first header included.

gdbus/ directory is left out, since it would break other projects using
it.
2012-12-05 17:18:07 +02:00
Mikel Astiz
5381d021f3 adapter: Use authorization id for cancelling
Return a request id in btd_request_authorization() in order to be used
when the request needs to be cancelled. This id alone will be enough to
use btd_cancel_authorization().
2012-10-01 17:28:22 +03:00
Johan Hedberg
5ad45a4b57 input: Add Device.Connect support 2012-09-25 12:49:26 +03:00
Johan Hedberg
5dd93fc16a Update code base to use the new BtIO API 2012-08-28 17:18:28 -07:00
Anderson Lizardo
94f6e7b17c input: Fix signedness issue on POSIX error code usage
By convention, error variables containing POSIX error code (usually
called "err") are negative. This commit fixes a couple of places where
positive values are expected.
2012-08-26 10:28:49 +03:00
Gustavo Padovan
56bb203351 input: move it to profiles folder 2012-07-10 11:15:29 -03:00