diff --git a/doc/org.bluez.Device.rst b/doc/org.bluez.Device.rst
index 1332824..80501ed 100644
--- a/doc/org.bluez.Device.rst
+++ b/doc/org.bluez.Device.rst
Bluetooth 2.1 (or newer) devices that have disabled Extended Inquiry
Response support.
+boolean CablePairing [readonly]
+```````````````````````````````
+
+ Set to true if the device was cable paired and it doesn't support the
+ canonical bonding with encryption, e.g. the Sixaxis gamepad.
+ If true, BlueZ will establish a connection without enforcing encryption.
+
string Modalias [readonly, optional]
````````````````````````````````````
diff --git a/src/device.c b/src/device.c
index b82a905..7d0b35c 100644
--- a/src/device.c
+++ b/src/device.c
GSList *watches; /* List of disconnect_data */
bool temporary;
bool connectable;
+ bool cable_pairing;
unsigned int disconn_timer;
unsigned int discov_timer;
unsigned int temporary_timer; /* Temporary/disappear timer */
g_key_file_set_boolean(key_file, "General", "Blocked",
device->blocked);
+ g_key_file_set_boolean(key_file, "General", "CablePairing",
+ device->cable_pairing);
+
if (device->wake_override != WAKE_FLAG_DEFAULT) {
g_key_file_set_boolean(key_file, "General", "WakeAllowed",
device->wake_override ==
return device->trusted;
}
+bool device_is_cable_pairing(struct btd_device *device)
+{
+ return device->cable_pairing;
+}
+
static gboolean dev_property_get_address(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
{
return TRUE;
}
+static gboolean
+dev_property_get_cable_pairing(const GDBusPropertyTable *property,
+ DBusMessageIter *iter, void *data)
+{
+ struct btd_device *device = data;
+ dbus_bool_t val = device->cable_pairing;
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &val);
+
+ return TRUE;
+}
+
static gboolean dev_property_get_rssi(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
{
{ "Trusted", "b", dev_property_get_trusted, dev_property_set_trusted },
{ "Blocked", "b", dev_property_get_blocked, dev_property_set_blocked },
{ "LegacyPairing", "b", dev_property_get_legacy },
+ { "CablePairing", "b", dev_property_get_cable_pairing },
{ "RSSI", "n", dev_property_get_rssi, NULL, dev_property_exists_rssi },
{ "Connected", "b", dev_property_get_connected },
{ "UUIDs", "as", dev_property_get_uuids },
if (blocked)
device_block(device, FALSE);
+ device->cable_pairing = g_key_file_get_boolean(key_file, "General",
+ "CablePairing", NULL);
+
/* Load device profile list */
uuids = g_key_file_get_string_list(key_file, "General", "Services",
NULL, NULL);
DEVICE_INTERFACE, "LegacyPairing");
}
+void device_set_cable_pairing(struct btd_device *device, bool cable_pairing)
+{
+ if (!device)
+ return;
+
+ if (device->cable_pairing == cable_pairing)
+ return;
+
+ DBG("setting cable pairing %d", cable_pairing);
+
+ device->cable_pairing = cable_pairing;
+
+ g_dbus_emit_property_changed(dbus_conn, device->path,
+ DEVICE_INTERFACE, "CablePairing");
+}
+
void device_store_svc_chng_ccc(struct btd_device *device, uint8_t bdaddr_type,
uint16_t value)
{
diff --git a/src/device.h b/src/device.h
index 2e4a977..a35bb13 100644
--- a/src/device.h
+++ b/src/device.h
bool device_is_paired(struct btd_device *device, uint8_t bdaddr_type);
bool device_is_bonded(struct btd_device *device, uint8_t bdaddr_type);
bool btd_device_is_trusted(struct btd_device *device);
+bool device_is_cable_pairing(struct btd_device *device);
void device_set_paired(struct btd_device *dev, uint8_t bdaddr_type);
void device_set_unpaired(struct btd_device *dev, uint8_t bdaddr_type);
void btd_device_set_temporary(struct btd_device *device, bool temporary);
void btd_device_set_connectable(struct btd_device *device, bool connectable);
void device_set_bonded(struct btd_device *device, uint8_t bdaddr_type);
void device_set_legacy(struct btd_device *device, bool legacy);
+void device_set_cable_pairing(struct btd_device *device, bool cable_pairing);
void device_set_rssi_with_delta(struct btd_device *device, int8_t rssi,
int8_t delta_threshold);
void device_set_rssi(struct btd_device *device, int8_t rssi);