meta-digi/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0002-hcitool-increase-the-s...

60 lines
1.9 KiB
Diff

From: Isaac Hermida <isaac.hermida@digi.com>
Date: Fri, 8 Jul 2016 10:42:57 +0200
Subject: [PATCH] hcitool: increase the shown connection limit to 20
Created a variable to set the number of connections to shown and increase that
value so we can list more current LE connections.
Upstream-Status: Inappropriate [DEY specific]
https://jira.digi.com/browse/DEL-2735
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
tools/hcitool.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 229c22c49909..ae70c9c0d3b4 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -69,6 +69,8 @@
#define EIR_TX_POWER 0x0A /* transmit power level */
#define EIR_DEVICE_ID 0x10 /* device ID */
+#define MAX_CONNECTIONS_SHOWN 20 /* Max number of "hcitool conn" items to shown */
+
#define for_each_opt(opt, long, short) while ((opt=getopt_long(argc, argv, short ? short:"+", long, NULL)) != -1)
static volatile int signal_received = 0;
@@ -156,12 +158,12 @@ static int conn_list(int s, int dev_id, long arg)
if (id != -1 && dev_id != id)
return 0;
- if (!(cl = malloc(10 * sizeof(*ci) + sizeof(*cl)))) {
+ if (!(cl = malloc(MAX_CONNECTIONS_SHOWN * sizeof(*ci) + sizeof(*cl)))) {
perror("Can't allocate memory");
exit(1);
}
cl->dev_id = dev_id;
- cl->conn_num = 10;
+ cl->conn_num = MAX_CONNECTIONS_SHOWN;
ci = cl->conn_info;
if (ioctl(s, HCIGETCONNLIST, (void *) cl)) {
@@ -190,12 +192,12 @@ static int find_conn(int s, int dev_id, long arg)
struct hci_conn_info *ci;
int i;
- if (!(cl = malloc(10 * sizeof(*ci) + sizeof(*cl)))) {
+ if (!(cl = malloc(MAX_CONNECTIONS_SHOWN * sizeof(*ci) + sizeof(*cl)))) {
perror("Can't allocate memory");
exit(1);
}
cl->dev_id = dev_id;
- cl->conn_num = 10;
+ cl->conn_num = MAX_CONNECTIONS_SHOWN;
ci = cl->conn_info;
if (ioctl(s, HCIGETCONNLIST, (void *) cl)) {