summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-02-22 11:42:03 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-02-22 11:42:03 +0000
commit1ec0481800a50aa14afe0513f69b4c7c04d5962a (patch)
treec8d632e97e175c8f9639c18bd1812164cdc37e2b
parentdb01d7596aa2ba2e40df5d3c7ef9b7cd0489ecad (diff)
Support pscan_rep_mode for remote name request
-rw-r--r--include/hci.h6
-rw-r--r--include/hci_lib.h3
-rw-r--r--src/hci.c29
3 files changed, 34 insertions, 4 deletions
diff --git a/include/hci.h b/include/hci.h
index 4ffa34fc..b651e22d 100644
--- a/include/hci.h
+++ b/include/hci.h
@@ -395,6 +395,12 @@ typedef struct {
} __attribute__ ((packed)) remote_name_req_cp;
#define REMOTE_NAME_REQ_CP_SIZE 10
+#define OCF_REMOTE_NAME_REQ_CANCEL 0x001A
+typedef struct {
+ bdaddr_t bdaddr;
+} __attribute__ ((packed)) remote_name_req_cancel_cp;
+#define REMOTE_NAME_REQ_CANCEL_CP_SIZE 6
+
#define OCF_READ_REMOTE_FEATURES 0x001B
typedef struct {
uint16_t handle;
diff --git a/include/hci_lib.h b/include/hci_lib.h
index d140444a..b1ab43cd 100644
--- a/include/hci_lib.h
+++ b/include/hci_lib.h
@@ -69,7 +69,8 @@ int hci_devid(const char *str);
int hci_read_local_name(int dd, int len, char *name, int to);
int hci_write_local_name(int dd, const char *name, int to);
int hci_read_remote_name(int dd, const bdaddr_t *bdaddr, int len, char *name, int to);
-int hci_read_remote_name_with_clock_offset(int dd, const bdaddr_t *bdaddr, uint16_t clkoffset, int len, char *name, int to);
+int hci_read_remote_name_with_clock_offset(int dd, const bdaddr_t *bdaddr, uint8_t pscan_rep_mode, uint16_t clkoffset, int len, char *name, int to);
+int hci_read_remote_name_cancel(int dd, const bdaddr_t *bdaddr, int to);
int hci_read_remote_features(int dd, uint16_t handle, uint8_t *features, int to);
int hci_read_remote_version(int dd, uint16_t handle, struct hci_version *ver, int to);
int hci_read_clock_offset(int dd, uint16_t handle, uint16_t *clkoffset, int to);
diff --git a/src/hci.c b/src/hci.c
index 83f09d9f..a0c0775e 100644
--- a/src/hci.c
+++ b/src/hci.c
@@ -886,7 +886,9 @@ int hci_write_local_name(int dd, const char *name, int to)
change_local_name_cp cp;
struct hci_request rq;
+ memset(&cp, 0, sizeof(cp));
strncpy(cp.name, name, sizeof(cp.name));
+
memset(&rq, 0, sizeof(rq));
rq.ogf = OGF_HOST_CTL;
rq.ocf = OCF_CHANGE_LOCAL_NAME;
@@ -895,10 +897,11 @@ int hci_write_local_name(int dd, const char *name, int to)
if (hci_send_req(dd, &rq, to) < 0)
return -1;
+
return 0;
}
-int hci_read_remote_name_with_clock_offset(int dd, const bdaddr_t *bdaddr, uint16_t clkoffset, int len, char *name, int to)
+int hci_read_remote_name_with_clock_offset(int dd, const bdaddr_t *bdaddr, uint8_t pscan_rep_mode, uint16_t clkoffset, int len, char *name, int to)
{
evt_remote_name_req_complete rn;
remote_name_req_cp cp;
@@ -906,7 +909,7 @@ int hci_read_remote_name_with_clock_offset(int dd, const bdaddr_t *bdaddr, uint1
memset(&cp, 0, sizeof(cp));
bacpy(&cp.bdaddr, bdaddr);
- cp.pscan_rep_mode = 0x02;
+ cp.pscan_rep_mode = pscan_rep_mode;
cp.clock_offset = clkoffset;
memset(&rq, 0, sizeof(rq));
@@ -933,7 +936,27 @@ int hci_read_remote_name_with_clock_offset(int dd, const bdaddr_t *bdaddr, uint1
int hci_read_remote_name(int dd, const bdaddr_t *bdaddr, int len, char *name, int to)
{
- return hci_read_remote_name_with_clock_offset(dd, bdaddr, 0x0000, len, name, to);
+ return hci_read_remote_name_with_clock_offset(dd, bdaddr, 0x02, 0x0000, len, name, to);
+}
+
+int hci_read_remote_name_cancel(int dd, const bdaddr_t *bdaddr, int to)
+{
+ remote_name_req_cancel_cp cp;
+ struct hci_request rq;
+
+ memset(&cp, 0, sizeof(cp));
+ bacpy(&cp.bdaddr, bdaddr);
+
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = OGF_LINK_CTL;
+ rq.ocf = OCF_REMOTE_NAME_REQ_CANCEL;
+ rq.cparam = &cp;
+ rq.clen = REMOTE_NAME_REQ_CANCEL_CP_SIZE;
+
+ if (hci_send_req(dd, &rq, to) < 0)
+ return -1;
+
+ return 0;
}
int hci_read_remote_features(int dd, uint16_t handle, uint8_t *features, int to)