diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 6fe0080..202c055 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
8 Basic Rate/Enhanced Data Rate
9 High Speed
10 Low Energy
- 11 Peripheral
This command generates a Command Complete event on success or
a Command Status event on failure.
Command Code: 0x000D
Controller Index: <controller id>
- Command Parameters: Mode (1 Octet)
+ Command Parameters: Low_Energy (1 Octet)
Return Parameters: Current_Settings (4 Octets)
- Possible mode values:
-
- 0x00 Off
- 0x01 Central
- 0x02 Peripheral
-
This command can be used when the controller is not powered and
all settings will be programmed once powered.
This command generates a Command Complete event on success or
a Command Status event on failure.
- Setting the mode to Central will enable the Low Energy bit in
- the supported settings. Setting the mode to Peripheral will enable
- both the Low Energy and the Peripheral settings bits.
-
Set Device Class
================
diff --git a/lib/mgmt.h b/lib/mgmt.h
index f8a9752..6c7e44a 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
#define MGMT_SETTING_BREDR 0x00000080
#define MGMT_SETTING_HS 0x00000100
#define MGMT_SETTING_LE 0x00000200
-#define MGMT_SETTING_PERIPHERAL 0x00000400
#define MGMT_OP_READ_INFO 0x0004
struct mgmt_rp_read_info {
#define MGMT_OP_SET_LE 0x000D
-#define MGMT_LE_OFF 0x00
-#define MGMT_LE_CENTRAL 0x01
-#define MGMT_LE_PERIPHERAL 0x02
-
#define MGMT_OP_SET_DEV_CLASS 0x000E
struct mgmt_cp_set_dev_class {
uint8_t major;
diff --git a/monitor/control.c b/monitor/control.c
index ae1a7ae..92dc93a 100644
--- a/monitor/control.c
+++ b/monitor/control.c
static const char *settings_str[] = {
"powered", "connectable", "fast-connectable", "discoverable",
- "pairable", "link-security", "ssp", "br/edr", "hs", "le",
- "peripheral"
+ "pairable", "link-security", "ssp", "br/edr", "hs", "le"
};
static void mgmt_new_settings(uint16_t len, const void *buf)
diff --git a/src/mgmt.c b/src/mgmt.c
index 8fe5100..18a653e 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
return mgmt_set_mode(index, MGMT_OP_SET_SSP, ssp);
}
-static int mgmt_set_low_energy(int index, uint8_t mode)
+static int mgmt_set_low_energy(int index, gboolean le)
{
- DBG("index %d mode %d", index, mode);
- return mgmt_set_mode(index, MGMT_OP_SET_LE, mode);
+ DBG("index %d le %d", index, le);
+ return mgmt_set_mode(index, MGMT_OP_SET_LE, le);
}
static inline int mgmt_powered(uint32_t settings)
if (mgmt_low_energy(info->supported_settings) &&
!mgmt_low_energy(settings))
- mgmt_set_low_energy(index, MGMT_LE_CENTRAL);
+ mgmt_set_low_energy(index, TRUE);
}
static void mgmt_update_powered(struct btd_adapter *adapter,
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 0ae3169..ff6a46a 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
"br/edr",
"hs",
"le" ,
- "peripheral",
};
static void print_settings(uint32_t settings)
static void cmd_le(int mgmt_sk, uint16_t index, int argc, char **argv)
{
- uint8_t val;
-
- if (argc < 2) {
- printf("Specify \"off\", \"central\" or \"peripheral\"\n");
- exit(EXIT_FAILURE);
- }
-
- if (strcasecmp(argv[1], "on") == 0 ||
- strcasecmp(argv[1], "yes") == 0 ||
- strcasecmp(argv[1], "central") == 0)
- val = MGMT_LE_CENTRAL;
- else if (strcasecmp(argv[1], "peripheral") == 0)
- val = MGMT_LE_PERIPHERAL;
- else if (strcasecmp(argv[1], "off") == 0)
- val = MGMT_LE_OFF;
- else
- val = atoi(argv[1]);
-
- if (index == MGMT_INDEX_NONE)
- index = 0;
-
- if (mgmt_send_cmd(mgmt_sk, MGMT_OP_SET_LE, index, &val, sizeof(val),
- setting_rsp, NULL) < 0) {
- fprintf(stderr, "Unable to send set_le cmd\n");
- exit(EXIT_FAILURE);
- }
+ cmd_setting(mgmt_sk, index, MGMT_OP_SET_LE, argc, argv);
}
static void class_rsp(int mgmt_sk, uint16_t op, uint16_t id, uint8_t status,