diff options
Diffstat (limited to 'usr.sbin/bluetooth/hccontrol/link_control.c')
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/link_control.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/usr.sbin/bluetooth/hccontrol/link_control.c b/usr.sbin/bluetooth/hccontrol/link_control.c index 68bf35f..2f3b4b2 100644 --- a/usr.sbin/bluetooth/hccontrol/link_control.c +++ b/usr.sbin/bluetooth/hccontrol/link_control.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: link_control.c,v 1.12 2002/09/17 16:36:46 max Exp $ + * $Id: link_control.c,v 1.2 2003/03/15 03:07:39 max Exp $ * $FreeBSD$ */ @@ -536,39 +536,46 @@ hci_remote_name_request(int s, int argc, char **argv) ng_hci_remote_name_req_cp cp; ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b; + memset(&cp, 0, sizeof(cp)); + cp.page_scan_rep_mode = NG_HCI_SCAN_REP_MODE0; + cp.page_scan_mode = NG_HCI_MANDATORY_PAGE_SCAN_MODE; + /* parse command parameters */ switch (argc) { case 4: - /* BD_ADDR */ - if (sscanf(argv[0], "%x:%x:%x:%x:%x:%x", - &n5, &n4, &n3, &n2, &n1, &n0) != 6) - return (USAGE); - - cp.bdaddr.b[0] = (n0 & 0xff); - cp.bdaddr.b[1] = (n1 & 0xff); - cp.bdaddr.b[2] = (n2 & 0xff); - cp.bdaddr.b[3] = (n3 & 0xff); - cp.bdaddr.b[4] = (n4 & 0xff); - cp.bdaddr.b[5] = (n5 & 0xff); - - /* page_scan_rep_mode */ - if (sscanf(argv[1], "%d", &n0) != 1 || n0 < 0x00 || n0 > 0x02) + /* clock_offset */ + if (sscanf(argv[3], "%x", &n0) != 1) return (USAGE); - cp.page_scan_rep_mode = (n0 & 0xff); + cp.clock_offset = (n0 & 0xffff); + cp.clock_offset = htole16(cp.clock_offset); + case 3: /* page_scan_mode */ if (sscanf(argv[2], "%d", &n0) != 1 || n0 < 0x00 || n0 > 0x03) return (USAGE); cp.page_scan_mode = (n0 & 0xff); - /* clock_offset */ - if (sscanf(argv[3], "%x", &n0) != 1) + case 2: + /* page_scan_rep_mode */ + if (sscanf(argv[1], "%d", &n0) != 1 || n0 < 0x00 || n0 > 0x02) return (USAGE); - cp.clock_offset = (n0 & 0xffff); - cp.clock_offset = htole16(cp.clock_offset); + cp.page_scan_rep_mode = (n0 & 0xff); + + case 1: + /* BD_ADDR */ + if (sscanf(argv[0], "%x:%x:%x:%x:%x:%x", + &n5, &n4, &n3, &n2, &n1, &n0) != 6) + return (USAGE); + + cp.bdaddr.b[0] = (n0 & 0xff); + cp.bdaddr.b[1] = (n1 & 0xff); + cp.bdaddr.b[2] = (n2 & 0xff); + cp.bdaddr.b[3] = (n3 & 0xff); + cp.bdaddr.b[4] = (n4 & 0xff); + cp.bdaddr.b[5] = (n5 & 0xff); break; default: |