diff options
Diffstat (limited to 'usr.sbin/bluetooth/hccontrol')
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/Makefile | 4 | ||||
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/hccontrol.8 | 201 | ||||
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/hccontrol.c | 8 | ||||
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/hccontrol.h | 2 | ||||
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/host_controller_baseband.c | 2 | ||||
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/info.c | 2 | ||||
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/link_control.c | 47 | ||||
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/link_policy.c | 2 | ||||
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/node.c | 187 | ||||
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/send_recv.c | 2 | ||||
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/status.c | 4 | ||||
-rw-r--r-- | usr.sbin/bluetooth/hccontrol/util.c | 2 |
12 files changed, 270 insertions, 193 deletions
diff --git a/usr.sbin/bluetooth/hccontrol/Makefile b/usr.sbin/bluetooth/hccontrol/Makefile index c816c3c..5b68cd8 100644 --- a/usr.sbin/bluetooth/hccontrol/Makefile +++ b/usr.sbin/bluetooth/hccontrol/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.6 2002/09/06 18:52:41 max Exp $ +# $Id: Makefile,v 1.2 2003/03/15 03:07:39 max Exp $ # $FreeBSD$ DESTDIR= /usr/sbin/ @@ -6,7 +6,7 @@ MANDIR= ../share/man/man PROG= hccontrol MAN8= hccontrol.8 WARNS?= 2 -CFLAGS+= -g -I../../../sys/netgraph/bluetooth/include +CFLAGS+= -g -I${.CURDIR}/../../../sys/netgraph/bluetooth/include SRCS= send_recv.c link_policy.c link_control.c \ host_controller_baseband.c info.c status.c node.c hccontrol.c \ util.c diff --git a/usr.sbin/bluetooth/hccontrol/hccontrol.8 b/usr.sbin/bluetooth/hccontrol/hccontrol.8 index 88e9813..c4553db 100644 --- a/usr.sbin/bluetooth/hccontrol/hccontrol.8 +++ b/usr.sbin/bluetooth/hccontrol/hccontrol.8 @@ -1,6 +1,8 @@ +.\" hccontrol.8 +.\" .\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> .\" All rights reserved. -.\" +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -9,7 +11,7 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" +.\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -21,9 +23,9 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. -.\" +.\" +.\" $Id: hccontrol.8,v 1.3 2003/04/27 19:45:23 max Exp $ .\" $FreeBSD$ -.\" .Dd June 14, 2002 .Dt HCCONTROL 8 .Os @@ -32,35 +34,34 @@ .Nd HCI configuration utility .Sh SYNOPSIS .Nm -.Op Fl n Ar HCI_node_name -.Op Ar command +.Op Fl n Ar HCI node name +.Op Fl h +.Op Ar command .Op Ar parameters ... .Sh DESCRIPTION The .Nm utility connects to the specified Netgraph node of type -.Dv HCI -and attempts to send specified command to the HCI Netgraph node or to the +.Em HCI +and attempts to send specified command to the HCI Netgraph node or to the associated Bluetooth device. -The .Nm -utility -will print results to the standard output and error messages to +will print results to the standard output and error messages to the standard error. .Pp The options are as follows: .Bl -tag -width indent -.It Fl n Ar HCI_node_name +.It Fl n Ar HCI node name Connect to the specified HCI Netgraph node. -.It Ar command -One of the supported commands (see below). -Special command -.Cm help -can be used to obtain the list of all supported commands. -To get more +.It Fl h +Display usage message and exit. +.It command +One of the supported commands (see below). Special command +.Dq help +can be used to obtain the list of all supported commands. To get more information about specific command use -.Cm help Ar command . -.It Ar parameters +.Dq help command . +.It parameters One or more optional space separated command parameters. .El .Sh COMMANDS @@ -68,92 +69,92 @@ The currently supported HCI commands in .Nm are: .Pp -.Bl -tag -offset indent -compact -.It Cm Inquiry -.It Cm Create_Connection -.It Cm Disconnect -.It Cm Add_SCO_Connection -.It Cm Change_Connection_Packet_Type -.It Cm Remote_Name_Request -.It Cm Read_Remote_Supported_Features -.It Cm Read_Remote_Version_Information -.It Cm Read_Clock_Offset -.It Cm Role_Discovery -.It Cm Switch_Role -.It Cm Read_Link_Policy_Settings -.It Cm Write_Link_Policy_Settings -.It Cm Reset -.It Cm Read_Pin_Type -.It Cm Write_Pin_Type -.It Cm Read_Stored_Link_Key -.It Cm Write_Stored_Link_Key -.It Cm Delete_Stored_Link_Key -.It Cm Change_Local_Name -.It Cm Read_Local_Name -.It Cm Read_Connection_Accept_Timeout -.It Cm Write_Connection_Accept_Timeout -.It Cm Read_Page_Timeout -.It Cm Write_Page_Timeout -.It Cm Read_Scan_Enable -.It Cm Write_Scan_Enable -.It Cm Read_Page_Scan_Activity -.It Cm Write_Page_Scan_Activity -.It Cm Read_Inquiry_Scan_Activity -.It Cm Write_Inquiry_Scan_Activity -.It Cm Read_Authentication_Enable -.It Cm Write_Authentication_Enable -.It Cm Read_Encryption_Mode -.It Cm Write_Encryption_Mode -.It Cm Read_Class_Of_Device -.It Cm Write_Class_Of_Device -.It Cm Read_Voice_Settings -.It Cm Write_Voice_Settings -.It Cm Read_Number_Broadcast_Retransmissions -.It Cm Write_Number_Broadcast_Retransmissions -.It Cm Read_Hold_Mode_Activity -.It Cm Write_Hold_Mode_Activity -.It Cm Read_SCO_Flow_Control_Enable -.It Cm Write_SCO_Flow_Control_Enable -.It Cm Read_Link_Supervision_Timeout -.It Cm Write_Link_Supervision_Timeout -.It Cm Read_Local_Version_Information -.It Cm Read_Local_Supported_Features -.It Cm Read_Buffer_Size -.It Cm Read_Country_Code -.It Cm Read_BD_ADDR -.It Cm Read_Failed_Contact_Counter -.It Cm Reset_Failed_Contact_Counter -.It Cm Get_Link_Quality -.It Cm Read_RSSI -.El +.Bd -literal -offset indent -compact +Inquiry +Create_Connection +Disconnect +Add_SCO_Connection +Change_Connection_Packet_Type +Remote_Name_Request +Read_Remote_Supported_Features +Read_Remote_Version_Information +Read_Clock_Offset +Role_Discovery +Switch_Role +Read_Link_Policy_Settings +Write_Link_Policy_Settings +Reset +Read_Pin_Type +Write_Pin_Type +Read_Stored_Link_Key +Write_Stored_Link_Key +Delete_Stored_Link_Key +Change_Local_Name +Read_Local_Name +Read_Connection_Accept_Timeout +Write_Connection_Accept_Timeout +Read_Page_Timeout +Write_Page_Timeout +Read_Scan_Enable +Write_Scan_Enable +Read_Page_Scan_Activity +Write_Page_Scan_Activity +Read_Inquiry_Scan_Activity +Write_Inquiry_Scan_Activity +Read_Authentication_Enable +Write_Authentication_Enable +Read_Encryption_Mode +Write_Encryption_Mode +Read_Class_Of_Device +Write_Class_Of_Device +Read_Voice_Settings +Write_Voice_Settings +Read_Number_Broadcast_Retransmissions +Write_Number_Broadcast_Retransmissions +Read_Hold_Mode_Activity +Write_Hold_Mode_Activity +Read_SCO_Flow_Control_Enable +Write_SCO_Flow_Control_Enable +Read_Link_Supervision_Timeout +Write_Link_Supervision_Timeout +Read_Local_Version_Information +Read_Local_Supported_Features +Read_Buffer_Size +Read_Country_Code +Read_BD_ADDR +Read_Failed_Contact_Counter +Reset_Failed_Contact_Counter +Get_Link_Quality +Read_RSSI +.Ed .Pp The currently supported node commands in .Nm are: .Pp -.Bl -tag -offset indent -compact -.It Cm Read_Node_State -.It Cm Initialize -.It Cm Read_Debug_Level -.It Cm Write_Debug_Level -.It Cm Read_Command_Timeout -.It Cm Write_Command_Timeout -.It Cm Read_Node_Buffer_Size -.It Cm Read_Node_BD_ADDR -.It Cm Read_Node_Features -.It Cm Read_Node_Stat -.It Cm Reset_Node_Stat -.It Cm Flush_Neighbor_Cache -.It Cm Read_Neighbor_Cache -.It Cm Read_Connection_List -.It Cm Read_Node_Link_Policy_Settings_Mask -.It Cm Write_Node_Link_Policy_Settings_Mask -.It Cm Read_Node_Packet_Mask -.It Cm Write_Node_Packet_Mask -.El +.Bd -literal -offset indent -compact +Read_Node_State +Initialize +Read_Debug_Level +Write_Debug_Level +Read_Node_Buffer_Size +Read_Node_BD_ADDR +Read_Node_Features +Read_Node_Stat +Reset_Node_Stat +Flush_Neighbor_Cache +Read_Neighbor_Cache +Read_Connection_List +Read_Node_Link_Policy_Settings_Mask +Write_Node_Link_Policy_Settings_Mask +Read_Node_Packet_Mask +Write_Node_Packet_Mask +Read_Node_Role_Switch +Write_Node_Role_Switch +.Ed +.Pp .Sh BUGS -Most likely. -Please report if found. +Most likely. Please report if found. .Sh DIAGNOSTICS .Ex -std .Sh SEE ALSO diff --git a/usr.sbin/bluetooth/hccontrol/hccontrol.c b/usr.sbin/bluetooth/hccontrol/hccontrol.c index 12b70eb..fafbf7b 100644 --- a/usr.sbin/bluetooth/hccontrol/hccontrol.c +++ b/usr.sbin/bluetooth/hccontrol/hccontrol.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: hccontrol.c,v 1.11 2002/09/12 18:19:43 max Exp $ + * $Id: hccontrol.c,v 1.2 2003/04/27 19:45:24 max Exp $ * $FreeBSD$ */ @@ -63,7 +63,7 @@ main(int argc, char *argv[]) int n; /* Process command line arguments */ - while ((n = getopt(argc, argv, "n:v")) != -1) { + while ((n = getopt(argc, argv, "n:vh")) != -1) { switch (n) { case 'n': node = optarg; @@ -73,7 +73,7 @@ main(int argc, char *argv[]) verbose = 1; break; - case '?': + case 'h': default: usage(); } @@ -268,7 +268,7 @@ print_hci_command(struct hci_command *category) static void usage(void) { - fprintf(stdout, "Usage: hccontrol -n HCI_node_name cmd [p1] [..]]\n"); + fprintf(stdout, "Usage: hccontrol -n HCI_node_name [-h] cmd [p1] [..]]\n"); exit(255); } /* usage */ diff --git a/usr.sbin/bluetooth/hccontrol/hccontrol.h b/usr.sbin/bluetooth/hccontrol/hccontrol.h index 8bcf764..d578fea 100644 --- a/usr.sbin/bluetooth/hccontrol/hccontrol.h +++ b/usr.sbin/bluetooth/hccontrol/hccontrol.h @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: hccontrol.h,v 1.8 2002/09/12 18:19:43 max Exp $ + * $Id: hccontrol.h,v 1.1 2002/11/24 20:22:38 max Exp $ * $FreeBSD$ */ diff --git a/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c b/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c index 3aa1571..5854b00 100644 --- a/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c +++ b/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: host_controller_baseband.c,v 1.12 2002/11/19 18:34:06 max Exp $ + * $Id: host_controller_baseband.c,v 1.1 2002/11/24 20:22:38 max Exp $ * $FreeBSD$ */ diff --git a/usr.sbin/bluetooth/hccontrol/info.c b/usr.sbin/bluetooth/hccontrol/info.c index 447a493..1a8649f 100644 --- a/usr.sbin/bluetooth/hccontrol/info.c +++ b/usr.sbin/bluetooth/hccontrol/info.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: info.c,v 1.7 2002/09/06 18:52:41 max Exp $ + * $Id: info.c,v 1.1 2002/11/24 20:22:38 max Exp $ * $FreeBSD$ */ 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: diff --git a/usr.sbin/bluetooth/hccontrol/link_policy.c b/usr.sbin/bluetooth/hccontrol/link_policy.c index dec9259..0a40f56 100644 --- a/usr.sbin/bluetooth/hccontrol/link_policy.c +++ b/usr.sbin/bluetooth/hccontrol/link_policy.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: link_policy.c,v 1.3 2002/09/17 16:33:44 max Exp $ + * $Id: link_policy.c,v 1.1 2002/11/24 20:22:38 max Exp $ * $FreeBSD$ */ diff --git a/usr.sbin/bluetooth/hccontrol/node.c b/usr.sbin/bluetooth/hccontrol/node.c index b7ff33a..4771027 100644 --- a/usr.sbin/bluetooth/hccontrol/node.c +++ b/usr.sbin/bluetooth/hccontrol/node.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: node.c,v 1.8 2002/11/12 22:33:17 max Exp $ + * $Id: node.c,v 1.4 2003/03/23 21:28:17 max Exp $ * $FreeBSD$ */ @@ -52,7 +52,7 @@ hci_read_node_state(int s, int argc, char **argv) if (ioctl(s, SIOC_HCI_RAW_NODE_GET_STATE, &r, sizeof(r)) < 0) return (ERROR); - fprintf(stdout, "Node: %s\nState: %#x\n", r.hci_node, r.state); + fprintf(stdout, "State: %#x\n", r.state); return (OK); } /* hci_read_node_state */ @@ -61,10 +61,7 @@ hci_read_node_state(int s, int argc, char **argv) static int hci_node_initialize(int s, int argc, char **argv) { - struct ng_btsocket_hci_raw_node_init r; - - memset(&r, 0, sizeof(r)); - if (ioctl(s, SIOC_HCI_RAW_NODE_INIT, &r, sizeof(r)) < 0) + if (ioctl(s, SIOC_HCI_RAW_NODE_INIT) < 0) return (ERROR); return (OK); @@ -80,7 +77,7 @@ hci_read_debug_level(int s, int argc, char **argv) if (ioctl(s, SIOC_HCI_RAW_NODE_GET_DEBUG, &r, sizeof(r)) < 0) return (ERROR); - fprintf(stdout, "Node: %s\nDebug level: %d\n", r.hci_node, r.debug); + fprintf(stdout, "Debug level: %d\n", r.debug); return (OK); } /* hci_read_debug_level */ @@ -117,8 +114,6 @@ hci_read_node_buffer_size(int s, int argc, char **argv) if (ioctl(s, SIOC_HCI_RAW_NODE_GET_BUFFER, &r, sizeof(r)) < 0) return (ERROR); - fprintf(stdout, "Node: %s\n", - r.hci_node); fprintf(stdout, "Number of free command buffers: %d\n", r.buffer.cmd_free); fprintf(stdout, "Max. ACL packet size: %d\n", @@ -147,7 +142,6 @@ hci_read_node_bd_addr(int s, int argc, char **argv) if (ioctl(s, SIOC_HCI_RAW_NODE_GET_BDADDR, &r, sizeof(r)) < 0) return (ERROR); - fprintf(stdout, "Node: %s\n", r.hci_node); fprintf(stdout, "BD_ADDR: %02x:%02x:%02x:%02x:%02x:%02x\n", r.bdaddr.b[5], r.bdaddr.b[4], r.bdaddr.b[3], r.bdaddr.b[2], r.bdaddr.b[1], r.bdaddr.b[0]); @@ -167,7 +161,7 @@ hci_read_node_features(int s, int argc, char **argv) if (ioctl(s, SIOC_HCI_RAW_NODE_GET_FEATURES, &r, sizeof(r)) < 0) return (ERROR); - fprintf(stdout, "Node: %s\nFeatures: ", r.hci_node); + fprintf(stdout, "Features: "); for (n = 0; n < sizeof(r.features)/sizeof(r.features[0]); n++) fprintf(stdout, "%#02x ", r.features[n]); fprintf(stdout, "\n%s\n", hci_features2str(r.features, @@ -186,7 +180,6 @@ hci_read_node_stat(int s, int argc, char **argv) if (ioctl(s, SIOC_HCI_RAW_NODE_GET_STAT, &r, sizeof(r)) < 0) return (ERROR); - fprintf(stdout, "Node: %s\n", r.hci_node); fprintf(stdout, "Commands sent: %d\n", r.stat.cmd_sent); fprintf(stdout, "Events received: %d\n", r.stat.evnt_recv); fprintf(stdout, "ACL packets received: %d\n", r.stat.acl_recv); @@ -203,10 +196,7 @@ hci_read_node_stat(int s, int argc, char **argv) static int hci_reset_node_stat(int s, int argc, char **argv) { - struct ng_btsocket_hci_raw_node_reset_stat r; - - memset(&r, 0, sizeof(r)); - if (ioctl(s, SIOC_HCI_RAW_NODE_RESET_STAT, &r, sizeof(r)) < 0) + if (ioctl(s, SIOC_HCI_RAW_NODE_RESET_STAT) < 0) return (ERROR); return (OK); @@ -216,11 +206,7 @@ hci_reset_node_stat(int s, int argc, char **argv) static int hci_flush_neighbor_cache(int s, int argc, char **argv) { - struct ng_btsocket_hci_raw_node_flush_neighbor_cache r; - - memset(&r, 0, sizeof(r)); - if (ioctl(s, SIOC_HCI_RAW_NODE_FLUSH_NEIGHBOR_CACHE, - &r, sizeof(r)) < 0) + if (ioctl(s, SIOC_HCI_RAW_NODE_FLUSH_NEIGHBOR_CACHE) < 0) return (ERROR); return (OK); @@ -248,7 +234,6 @@ hci_read_neighbor_cache(int s, int argc, char **argv) goto out; } - fprintf(stdout, "Neighbor cache for the node: %s\n", r.hci_node); fprintf(stdout, "BD_ADDR " \ "Features " \ @@ -299,7 +284,6 @@ hci_read_connection_list(int s, int argc, char **argv) goto out; } - fprintf(stdout, "Connections list for the node: %s\n", r.hci_node); fprintf(stdout, "Remote BD_ADDR " \ "Handle " \ @@ -345,9 +329,9 @@ out: return (error); } /* hci_read_connection_list */ -/* Send Read_Link_Policy_Settings_Mask command to the node */ +/* Send Read_Node_Link_Policy_Settings_Mask command to the node */ int -hci_read_link_policy_settings_mask(int s, int argc, char **argv) +hci_read_node_link_policy_settings_mask(int s, int argc, char **argv) { struct ng_btsocket_hci_raw_node_link_policy_mask r; @@ -355,15 +339,14 @@ hci_read_link_policy_settings_mask(int s, int argc, char **argv) if (ioctl(s, SIOC_HCI_RAW_NODE_GET_LINK_POLICY_MASK, &r, sizeof(r)) < 0) return (ERROR); - fprintf(stdout, "Node: %s\nLink Policy Settings mask: %#04x\n", - r.hci_node, r.policy_mask); + fprintf(stdout, "Link Policy Settings mask: %#04x\n", r.policy_mask); return (OK); -} /* hci_read_link_policy_settings_mask */ +} /* hci_read_node_link_policy_settings_mask */ -/* Send Write_Link_Policy_Settings_Mask command to the node */ +/* Send Write_Node_Link_Policy_Settings_Mask command to the node */ int -hci_write_link_policy_settings_mask(int s, int argc, char **argv) +hci_write_node_link_policy_settings_mask(int s, int argc, char **argv) { struct ng_btsocket_hci_raw_node_link_policy_mask r; int m; @@ -386,11 +369,11 @@ hci_write_link_policy_settings_mask(int s, int argc, char **argv) return (ERROR); return (OK); -} /* hci_write_link_policy_settings_mask */ +} /* hci_write_node_link_policy_settings_mask */ -/* Send Read_Packet_Mask command to the node */ +/* Send Read_Node_Packet_Mask command to the node */ int -hci_read_packet_mask(int s, int argc, char **argv) +hci_read_node_packet_mask(int s, int argc, char **argv) { struct ng_btsocket_hci_raw_node_packet_mask r; @@ -398,15 +381,14 @@ hci_read_packet_mask(int s, int argc, char **argv) if (ioctl(s, SIOC_HCI_RAW_NODE_GET_PACKET_MASK, &r, sizeof(r)) < 0) return (ERROR); - fprintf(stdout, "Node: %s\nPacket mask: %#04x\n", - r.hci_node, r.packet_mask); + fprintf(stdout, "Packet mask: %#04x\n", r.packet_mask); return (OK); -} /* hci_read_packet_mask */ +} /* hci_read_node_packet_mask */ -/* Send Write_Packet_Mask command to the node */ +/* Send Write_Node_Packet_Mask command to the node */ int -hci_write_packet_mask(int s, int argc, char **argv) +hci_write_node_packet_mask(int s, int argc, char **argv) { struct ng_btsocket_hci_raw_node_packet_mask r; int m; @@ -429,88 +411,175 @@ hci_write_packet_mask(int s, int argc, char **argv) return (ERROR); return (OK); -} /* hci_write_packet_mask */ +} /* hci_write_node_packet_mask */ + +/* Send Read_Node_Role_Switch command to the node */ +int +hci_read_node_role_switch(int s, int argc, char **argv) +{ + struct ng_btsocket_hci_raw_node_role_switch r; + + memset(&r, 0, sizeof(r)); + if (ioctl(s, SIOC_HCI_RAW_NODE_GET_ROLE_SWITCH, &r, sizeof(r)) < 0) + return (ERROR); + + fprintf(stdout, "Role switch: %d\n", r.role_switch); + + return (OK); +} /* hci_read_node_role_switch */ + +/* Send Write_Node_Role_Switch command to the node */ +int +hci_write_node_role_switch(int s, int argc, char **argv) +{ + struct ng_btsocket_hci_raw_node_role_switch r; + int m; + + memset(&r, 0, sizeof(r)); + + switch (argc) { + case 1: + if (sscanf(argv[0], "%d", &m) != 1) + return (USAGE); + + r.role_switch = m? 1 : 0; + break; + + default: + return (USAGE); + } + + if (ioctl(s, SIOC_HCI_RAW_NODE_SET_ROLE_SWITCH, &r, sizeof(r)) < 0) + return (ERROR); + + return (OK); +} /* hci_write_node_role_switch */ struct hci_command node_commands[] = { { "read_node_state", -"Get HCI node state", +"Get the HCI node state", &hci_read_node_state }, { "initialize", -"Initialize HCI node", +"Initialize the HCI node", &hci_node_initialize }, { "read_debug_level", -"Read HCI node debug level", +"Read the HCI node debug level", &hci_read_debug_level }, { "write_debug_level <level>", -"Write HCI node debug level", +"Write the HCI node debug level", &hci_write_debug_level }, { "read_node_buffer_size", -"Read HCI node buffer information", +"Read the HCI node buffer information. This will return current state of the\n"\ +"HCI buffer for the HCI node", &hci_read_node_buffer_size }, { "read_node_bd_addr", -"Read HCI node BD_ADDR", +"Read the HCI node BD_ADDR. Returns device BD_ADDR as cached by the HCI node", &hci_read_node_bd_addr }, { "read_node_features", -"Read HCI node features", +"Read the HCI node features. This will return list of supported features as\n" \ +"cached by the HCI node", &hci_read_node_features }, { "read_node_stat", -"Read HCI node statistic information", +"Read packets and bytes counters for the HCI node", &hci_read_node_stat }, { "reset_node_stat", -"Reset HCI node statistic information", +"Reset packets and bytes counters for the HCI node", &hci_reset_node_stat }, { "flush_neighbor_cache", -"Flush HCI node neighbor cache", +"Flush content of the HCI node neighbor cache", &hci_flush_neighbor_cache }, { "read_neighbor_cache", -"Read HCI node neighbor cache", +"Read content of the HCI node neighbor cache", &hci_read_neighbor_cache }, { "read_connection_list", -"Read connection list", +"Read the baseband connection descriptors list for the HCI node", &hci_read_connection_list }, { "read_node_link_policy_settings_mask", -"Read Link Policy Settinngs mask for the node", -&hci_read_link_policy_settings_mask +"Read the value of the Link Policy Settinngs mask for the HCI node", +&hci_read_node_link_policy_settings_mask }, { "write_node_link_policy_settings_mask <policy_mask>", -"Write Link Policy Settinngs mask for the node. Policy mask - xxxx", -&hci_write_link_policy_settings_mask +"Write the value of the Link Policy Settings mask for the HCI node. By default\n" \ +"all supported Link Policy modes (as reported by the local device features) are\n"\ +"enabled. The particular Link Policy mode is enabled if local device supports\n"\ +"it and correspinding bit in the mask was set\n\n" \ +"\t<policy_mask> - xxxx; Link Policy mask\n" \ +"\t\t0x0000 - Disable All LM Modes\n" \ +"\t\t0x0001 - Enable Master Slave Switch\n" \ +"\t\t0x0002 - Enable Hold Mode\n" \ +"\t\t0x0004 - Enable Sniff Mode\n" \ +"\t\t0x0008 - Enable Park Mode\n", +&hci_write_node_link_policy_settings_mask }, { "read_node_packet_mask", -"Read Packet mask for the node", -&hci_read_packet_mask +"Read the value of the Packet mask for the HCI node", +&hci_read_node_packet_mask }, { "write_node_packet_mask <packet_mask>", -"Write Packet mask for the node. Packet mask - xxxx", -&hci_write_packet_mask +"Write the value of the Packet mask for the HCI node. By default all supported\n" \ +"packet types (as reported by the local device features) are enabled. The\n" \ +"particular packet type is enabled if local device supports it and corresponding\n" \ +"bit in the mask was set\n\n" \ +"\t<packet_mask> - xxxx; packet type mask\n" \ +"" \ +"\t\tACL packets\n" \ +"\t\t-----------\n" \ +"\t\t0x0008 DM1\n" \ +"\t\t0x0010 DH1\n" \ +"\t\t0x0400 DM3\n" \ +"\t\t0x0800 DH3\n" \ +"\t\t0x4000 DM5\n" \ +"\t\t0x8000 DH5\n" \ +"\n" \ +"\t\tSCO packets\n" \ +"\t\t-----------\n" \ +"\t\t0x0020 HV1\n" \ +"\t\t0x0040 HV2\n" \ +"\t\t0x0080 HV3\n", +&hci_write_node_packet_mask +}, +{ +"read_node_role_switch", +"Read the value of the Role Switch parameter for the HCI node", +&hci_read_node_role_switch +}, +{ +"write_node_role_switch {0|1}", +"Write the value of the Role Switch parameter for the HCI node. By default,\n" \ +"if Role Switch is supported, local device will try to perform Role Switch\n" \ +"and become Master on incoming connection. Some devices do not support Role\n" \ +"Switch and thus incomming connections from such devices will fail. Setting\n" \ +"this parameter to zero will prevent Role Switch and thus accepting device\n" \ +"will remain Slave", +&hci_write_node_role_switch }, { NULL, diff --git a/usr.sbin/bluetooth/hccontrol/send_recv.c b/usr.sbin/bluetooth/hccontrol/send_recv.c index aff6f93..43a2e2a 100644 --- a/usr.sbin/bluetooth/hccontrol/send_recv.c +++ b/usr.sbin/bluetooth/hccontrol/send_recv.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: send_recv.c,v 1.4 2002/09/04 21:31:30 max Exp $ + * $Id: send_recv.c,v 1.1 2002/11/24 20:22:38 max Exp $ * $FreeBSD$ */ diff --git a/usr.sbin/bluetooth/hccontrol/status.c b/usr.sbin/bluetooth/hccontrol/status.c index 0494aa7..fdbf61f 100644 --- a/usr.sbin/bluetooth/hccontrol/status.c +++ b/usr.sbin/bluetooth/hccontrol/status.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: status.c,v 1.2 2002/09/06 18:52:41 max Exp $ + * $Id: status.c,v 1.1 2002/11/24 20:22:38 max Exp $ * $FreeBSD$ */ @@ -231,7 +231,7 @@ struct hci_command status_commands[] = { "read_rssi <connection_handle>", "\nThis command will read the value for the difference between the\n" \ "measured Received Signal Strength Indication (RSSI) and the limits of\n" \ -"the Golden Receive Power Range for an ACL connection handle to another\n" \ +"the Golden Receive Power Range for a ACL connection handle to another\n" \ "Bluetooth device. Any positive RSSI value returned by the Host Controller\n" \ "indicates how many dB the RSSI is above the upper limit, any negative\n" \ "value indicates how many dB the RSSI is below the lower limit. The value\n" \ diff --git a/usr.sbin/bluetooth/hccontrol/util.c b/usr.sbin/bluetooth/hccontrol/util.c index 51868b4..7abe4d4 100644 --- a/usr.sbin/bluetooth/hccontrol/util.c +++ b/usr.sbin/bluetooth/hccontrol/util.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: util.c,v 1.2 2002/09/12 18:19:43 max Exp $ + * $Id: util.c,v 1.1 2002/11/24 20:22:38 max Exp $ * $FreeBSD$ */ |