Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22519089 authored by Adrian Chan's avatar Adrian Chan
Browse files

floss: Add check to determine if read encryption key size is supported

On some laptops, pairing a bluetooth headset can fail. The ChromeOS
log at /var/log/bluetooth.log shows that this is due to using
`READ_ENCRYPTION_KEY_SIZE` when it is not supported: there is a line
with `UNKNOWN_HCI_COMMAND opcode:0x1408 (READ_ENCRYPTION_KEY_SIZE)`.
To remedy this, add a check before trying to read the encryption key
size on receiving a encryption change event from the controller.

Bug: 273316924
Bug: 273796661
Bug: 274092923
Tag: #floss
Test: Verify that bluetooth headset can be paired on a Dell Latitude
3440, Dell Latitude 3340, and HP Probook 450 G1

Change-Id: I02cb0f938be4430923b4ad8091ef05ae69336c87
parent 5ac56f18
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ typedef struct controller_t {
  bool (*supports_encryption_pause)(void);
  bool (*supports_configure_data_path)(void);
  bool (*supports_set_min_encryption_key_size)(void);
  bool (*supports_read_encryption_key_size)(void);

  bool (*supports_ble)(void);
  bool (*supports_ble_packet_extension)(void);
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ table InitFlagsData {
    periodic_advertising_adi_is_enabled:bool (privacy:"Any");
    private_gatt_is_enabled:bool (privacy:"Any");
    queue_l2cap_coc_while_encrypting_is_enabled:bool (privacy:"Any");
    read_encryption_key_size_is_enabled:bool (privacy:"Any");
    redact_log_is_enabled:bool (privacy:"Any");
    rust_event_loop_is_enabled:bool (privacy:"Any");
    sdp_serialization_is_enabled:bool (privacy:"Any");
+2 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ flatbuffers::Offset<bluetooth::common::InitFlagsData> bluetooth::dumpsys::InitFl
  builder.add_queue_l2cap_coc_while_encrypting_is_enabled(
      initFlags::queue_l2cap_coc_while_encrypting_is_enabled());
  builder.add_private_gatt_is_enabled(initFlags::private_gatt_is_enabled());
  builder.add_read_encryption_key_size_is_enabled(
      bluetooth::common::init_flags::read_encryption_key_size_is_enabled());
  builder.add_redact_log_is_enabled(initFlags::redact_log_is_enabled());
  builder.add_rust_event_loop_is_enabled(initFlags::rust_event_loop_is_enabled());
  builder.add_sdp_serialization_is_enabled(initFlags::sdp_serialization_is_enabled());
+1 −0
Original line number Diff line number Diff line
@@ -281,6 +281,7 @@ init_flags!(
        periodic_advertising_adi = true,
        private_gatt,
        queue_l2cap_coc_while_encrypting = true,
        read_encryption_key_size = true,
        redact_log = true,
        rust_event_loop,
        sdp_serialization = true,
+1 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ pub mod ffi {
        fn controller_supports_ble_periodic_advertising_adi(c: &Controller) -> bool;
        fn controller_supports_configure_data_path(c: &Controller) -> bool;
        fn controller_supports_set_min_encryption_key_size(c: &Controller) -> bool;
        fn controller_supports_read_encryption_key_size(c: &Controller) -> bool;

        fn controller_supports_reading_remote_extended_features(c: &Controller) -> bool;
        fn controller_supports_enhanced_setup_synchronous_connection(c: &Controller) -> bool;
Loading