@@ -4349,16 +4349,14 @@ static int set_exp_feature(struct sock *sk, struct hci_dev *hdev,
4349
4349
MGMT_STATUS_NOT_SUPPORTED );
4350
4350
}
4351
4351
4352
- #define SUPPORTED_DEVICE_FLAGS () ((1U << HCI_CONN_FLAG_MAX) - 1)
4353
-
4354
4352
static int get_device_flags (struct sock * sk , struct hci_dev * hdev , void * data ,
4355
4353
u16 data_len )
4356
4354
{
4357
4355
struct mgmt_cp_get_device_flags * cp = data ;
4358
4356
struct mgmt_rp_get_device_flags rp ;
4359
4357
struct bdaddr_list_with_flags * br_params ;
4360
4358
struct hci_conn_params * params ;
4361
- u32 supported_flags = SUPPORTED_DEVICE_FLAGS () ;
4359
+ u32 supported_flags ;
4362
4360
u32 current_flags = 0 ;
4363
4361
u8 status = MGMT_STATUS_INVALID_PARAMS ;
4364
4362
@@ -4367,6 +4365,9 @@ static int get_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
4367
4365
4368
4366
hci_dev_lock (hdev );
4369
4367
4368
+ bitmap_to_arr32 (& supported_flags , hdev -> conn_flags ,
4369
+ __HCI_CONN_NUM_FLAGS );
4370
+
4370
4371
memset (& rp , 0 , sizeof (rp ));
4371
4372
4372
4373
if (cp -> addr .type == BDADDR_BREDR ) {
@@ -4376,15 +4377,17 @@ static int get_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
4376
4377
if (!br_params )
4377
4378
goto done ;
4378
4379
4379
- current_flags = br_params -> current_flags ;
4380
+ bitmap_to_arr32 (& current_flags , br_params -> flags ,
4381
+ __HCI_CONN_NUM_FLAGS );
4380
4382
} else {
4381
4383
params = hci_conn_params_lookup (hdev , & cp -> addr .bdaddr ,
4382
4384
le_addr_type (cp -> addr .type ));
4383
4385
4384
4386
if (!params )
4385
4387
goto done ;
4386
4388
4387
- current_flags = params -> current_flags ;
4389
+ bitmap_to_arr32 (& current_flags , params -> flags ,
4390
+ __HCI_CONN_NUM_FLAGS );
4388
4391
}
4389
4392
4390
4393
bacpy (& rp .addr .bdaddr , & cp -> addr .bdaddr );
@@ -4422,13 +4425,16 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
4422
4425
struct bdaddr_list_with_flags * br_params ;
4423
4426
struct hci_conn_params * params ;
4424
4427
u8 status = MGMT_STATUS_INVALID_PARAMS ;
4425
- u32 supported_flags = SUPPORTED_DEVICE_FLAGS () ;
4428
+ u32 supported_flags ;
4426
4429
u32 current_flags = __le32_to_cpu (cp -> current_flags );
4427
4430
4428
4431
bt_dev_dbg (hdev , "Set device flags %pMR (type 0x%x) = 0x%x" ,
4429
4432
& cp -> addr .bdaddr , cp -> addr .type ,
4430
4433
__le32_to_cpu (current_flags ));
4431
4434
4435
+ bitmap_to_arr32 (& supported_flags , hdev -> conn_flags ,
4436
+ __HCI_CONN_NUM_FLAGS );
4437
+
4432
4438
if ((supported_flags | current_flags ) != supported_flags ) {
4433
4439
bt_dev_warn (hdev , "Bad flag given (0x%x) vs supported (0x%0x)" ,
4434
4440
current_flags , supported_flags );
@@ -4443,7 +4449,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
4443
4449
cp -> addr .type );
4444
4450
4445
4451
if (br_params ) {
4446
- br_params -> current_flags = current_flags ;
4452
+ bitmap_from_u64 ( br_params -> flags , current_flags ) ;
4447
4453
status = MGMT_STATUS_SUCCESS ;
4448
4454
} else {
4449
4455
bt_dev_warn (hdev , "No such BR/EDR device %pMR (0x%x)" ,
@@ -4453,7 +4459,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
4453
4459
params = hci_conn_params_lookup (hdev , & cp -> addr .bdaddr ,
4454
4460
le_addr_type (cp -> addr .type ));
4455
4461
if (params ) {
4456
- params -> current_flags = current_flags ;
4462
+ bitmap_from_u64 ( params -> flags , current_flags ) ;
4457
4463
status = MGMT_STATUS_SUCCESS ;
4458
4464
} else {
4459
4465
bt_dev_warn (hdev , "No such LE device %pMR (0x%x)" ,
@@ -6979,6 +6985,7 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
6979
6985
struct hci_conn_params * params ;
6980
6986
int err ;
6981
6987
u32 current_flags = 0 ;
6988
+ u32 supported_flags ;
6982
6989
6983
6990
bt_dev_dbg (hdev , "sock %p" , sk );
6984
6991
@@ -7050,7 +7057,8 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
7050
7057
params = hci_conn_params_lookup (hdev , & cp -> addr .bdaddr ,
7051
7058
addr_type );
7052
7059
if (params )
7053
- current_flags = params -> current_flags ;
7060
+ bitmap_to_arr32 (& current_flags , params -> flags ,
7061
+ __HCI_CONN_NUM_FLAGS );
7054
7062
}
7055
7063
7056
7064
err = hci_cmd_sync_queue (hdev , add_device_sync , NULL , NULL );
@@ -7059,8 +7067,10 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
7059
7067
7060
7068
added :
7061
7069
device_added (sk , hdev , & cp -> addr .bdaddr , cp -> addr .type , cp -> action );
7070
+ bitmap_to_arr32 (& supported_flags , hdev -> conn_flags ,
7071
+ __HCI_CONN_NUM_FLAGS );
7062
7072
device_flags_changed (NULL , hdev , & cp -> addr .bdaddr , cp -> addr .type ,
7063
- SUPPORTED_DEVICE_FLAGS () , current_flags );
7073
+ supported_flags , current_flags );
7064
7074
7065
7075
err = mgmt_cmd_complete (sk , hdev -> id , MGMT_OP_ADD_DEVICE ,
7066
7076
MGMT_STATUS_SUCCESS , & cp -> addr ,
0 commit comments