Using the hciconfig and hcitool Commands#

The hcitool and hciconfig commands are used to control and configure parameters for the Bluetooth interface. The most frequently used HCI commands are explained here. For other HCI commands, see the Bluetooth specification, Volume 2, Part E, Chapter 7, from www.bluetooth.org.

Reset

Description

This command is used to issue a soft reset to the Bluetooth module

Default Value

-

Input Parameters

None

Output Parameter

None

Reset Required

No.

Usage

hcitool -i <hciX> cmd 0x03 0x03

Read Local Version Information

Description

This command is used to read the local version information

Default Value

-

Input Parameters

None

Output Parameter

Run the btmon command in another terminal before running this command. So, the below parameters will be available. HCI version HCI revision LMP version Manufacturer name LMP subversion

Reset Required

No.

Usage

hcitool -i <hciX> cmd 0x04 0x01

Read Local Supported Commands

Description

This command is used to read the local controller supported HCI commands.

Default Value

-

Input Parameters

None

Output Parameter

List of supported commands (64 bytes of bit field)

Reset Required

No.

Usage

hcitool -i <hciX> cmd 0x04 0x02

Get Local BD Address

Description

This command is used to get the local BD Address

Default Value

-

Input Parameters

None

Output Parameter

6 Byte BD Address

Reset Required

No.

Usage

hcitool -i <hciX> cmd 0x04 0x09

List of supported HCI commands#

For OGF  0x02#

HCI Commands(OCF)

Supported

Comments(Macro's Defined in the source code)

HCI_Hold_Mode

Yes

/* HCI link policy command OCF types */HCI_OP_HOLD_MODE

HCI_Sniff_Mode

Yes

HCI_OP_SNIFF_MODE

HCI_Exit_Sniff_Mode

Yes

HCI_OP_EXIT_SNIFF_MODE

HCI_QoS_Setup

Yes

HCI_OP_QOS_SETUP

HCI_Role_Discovery

Yes

HCI_OP_ROLE_DISCOVERY

HCI_Switch_Role

Yes

HCI_OP_SWITCH_ROLE

HCI_Read_Link_Policy_Settings

Yes

HCI_OP_READ_LINK_POLICY

HCI_Write_Link_Policy_Settings

Yes

HCI_OP_WRITE_LINK_POLICY

HCI_Read_Default_Link_Policy_Settings

Yes

HCI_OP_READ_DEF_LINK_POLICY

HCI_Write_Default_Link_Policy_Settings

Yes

HCI_OP_WRITE_DEF_LINK_POLICY

HCI_Flow_Specification

Yes

HCI_OP_FLOW_SPECIFICATION

HCI_Sniff_Subrating

Yes

HCI_OP_SNIFF_SUBRATING

For OGF 0x03#

HCI Commands(OCF)

Supported

Comments(Macro's Defined in the source code)

HCI_Set_Event_Mask

Yes

HCI_OP_SET_EVENT_MASK

For OGF 0x04#

HCI Commands(OCF)

Supported

Comments(Macro's Defined in the source code)

HCI_Reset

Yes

HCI_OP_RESET

HCI_Set_Event_Filter

Yes

HCI_OP_SET_EVENT_FLT

HCI_Flush

Yes

HCI_OP_FLUSH

HCI_Read_PIN_Type

Yes

HCI_OP_READ_PIN_TYPE

HCI_Write_PIN_Type

Yes

HCI_OP_WRITE_PIN_TYPE

HCI_Create_New_Unit_Key

Yes

HCI_OP_CREATE_NEW_UNIT_KEY

HCI_Read_Stored_Link_Key

Yes

HCI_OP_READ_STORED_LINK_KEY

HCI_Write_Stored_Link_Key

Yes

HCI_OP_WRITE_STORED_LINK_KEY

HCI_Delete_Stored_Link_Key

Yes

HCI_OP_DELETE_STORED_LINK_KEY

HCI_Read_Local_Name

Yes

HCI_OP_READ_LOCAL_NAME

HCI_Write_Local_Name

Yes

HCI_OP_WRITE_LOCAL_NAME

HCI_Read_Connection_Accept_Timeout

Yes

HCI_OP_READ_CA_TIMEOUT

HCI_Write_Connection_Accept_Timeout

Yes

HCI_OP_WRITE_CA_TIMEOUT

HCI_Read_Page_Timeout

Yes

HCI_OP_READ_PAGE_TIMEOUT

HCI_Write_Page_Timeout

yes

HCI_OP_WRITE_PAGE_TIMEOUT

HCI_Read_Scan_Enable

yes

HCI_OP_READ_SCAN_ENABLE

HCI_Write_Scan_Enable

yes

HCI_OP_WRITE_SCAN_ENABLE

HCI_Read_Page_Scan_Activity

Yes

HCI_OP_READ_PAGE_SCAN_ACTIVITY

HCI_Write_Page_Scan_Activity

Yes

HCI_OP_WRITE_PAGE_SCAN_ACTIVITY

HCI_Read_Inquiry_Scan_Activity

Yes

HCI_OP_READ_INQUIRY_SCAN_ACTIVITY

HCI_Write_Inquiry_Scan_Activity

Yes

HCI_OP_WRITE_INQUIRY_SCAN_ACTIVITY

HCI_Read_Authentication_Enable

Yes

HCI_OP_READ_AUTH_ENABLE

HCI_Write_Authentication_Enable

Yes

HCI_OP_WRITE_AUTH_ENABLE

HCI_Read_Class_of_Device

Yes

HCI_OP_READ_CLASS_OF_DEVICE

HCI_Write_Class_of_Device

Yes

HCI_OP_WRITE_CLASS_OF_DEVICE

HCI_Read_Voice_Setting

Yes

HCI_OP_READ_VOICE_SETTING

HCI_Write_Voice_Setting

Yes

HCI_OP_WRITE_VOICE_SETTING

HCI_Read_Automatic_Flush_Timeout

Yes

HCI_OP_READ_AUTO_FLUSH_TOUT

HCI_Write_Automatic_Flush_Timeout

Yes

HCI_OP_WRITE_AUTO_FLUSH_TOUT

HCI_OP_READ_NUM_BROADCAST_RETRY

NO

HCI_OP_WRITE_NUM_BROADCAST_RETRY

NO

HCI_Read_Hold_Mode_Activity

NO

HCI_OP_READ_HOLD_MODE_ACTIVITY → Not defined in the code

HCI_Write_Hold_Mode_Activity

No

HCI_Read_Transmit_Power_Level

Yes

HCI_OP_READ_TX_PWR_LEVEL

HCI_Read_Synchronous_Flow_Control_Enable

No

HCI_OP_READ_SYNCHRONOUS_FLOW_CTRL_EN

HCI_Write_Synchronous_Flow_Control_Enable

No

HCI_Set_Controller_To_Host_Flow_Control

No

HCI_OP_SET_CNTRLER_TO_HOST_FLOW_CTRL

HCI_Host_Buffer_Size

Yes

HCI_OP_HOST_BUFFER_SIZE

HCI_Host_Number_Of_Completed_Packets

No

HCI_OP_HOST_NUM_COMPLETED_PKTS

HCI_Read_Link_Supervision_Timeout

Yes

HCI_OP_READ_LINK_SUPERVISION_TOUT

HCI_Write_Link_Supervision_Timeout

Yes

HCI_OP_WRITE_LINK_SUPERVISION_TOUT

HCI_Read_Number_Of_Supported_IAC

Yes

HCI_OP_READ_NUM_SUPPORTED_IAC

Set_AFH_Host_Channel_Classification

Yes

HCI_OP_SET_AFH_HOST_CH_CLASSIFICATION

HCI_Read_Inquiry_Scan_Type

Yes

HCI_OP_READ_INQUIRY_SCAN_TYPE

HCI_Write_Inquiry_Scan_Type

Yes

HCI_OP_WRITE_INQUIRY_SCAN_TYPE

HCI_Read_Inquiry_Mode

Yes

HCI_OP_READ_INQUIRY_MODE

HCI_Write_Inquiry_Mode

Yes

HCI_OP_WRITE_INQUIRY_MODE

HCI_Read_Page_Scan_Type

Yes

HCI_OP_READ_PAGE_SCAN_TYPE

HCI_Write_Page_Scan_Type

Yes

HCI_OP_WRITE_PAGE_SCAN_TYPE

Read_AFH_Channel_Assessment_Mode

Yes

HCI_OP_READ_AFH_CH_ASSESSMENT_MODE

Write_AFH_Channel_Assessment_Mode

Yes

HCI_OP_WRITE_AFH_CH_ASSESSMENT_MODE

HCI_Read_Extended_Inquiry_Response

Yes

HCI_OP_READ_EXT_INQUIRY_RESP

HCI_Write_Extended_Inquiry_Response

Yes

HCI_OP_WRITE_EXT_INQUIRY_RESP

HCI_Refresh_Encryption_Key

yes

HCI_OP_REFRESH_ENCRYPTION_KEY

HCI_Read_Simple_Pairing_Mode

Yes

HCI_OP_READ_SIMPLE_PAIRING_MODE

HCI_Write_Simple_Pairing_Mode

Yes

HCI_OP_WRITE_SIMPLE_PAIRING_MODE

HCI_Read_Local_OOB_Data

Yes

HCI_OP_READ_LOCAL_OOB_DATA

HCI_Read_Inquiry_Response_Transmit_Power_Leve

Yes

HCI_OP_READ_INQUIRY_RESP_TX_PWR_LEVEL

HCI_Write_Inquiry_Transmit_Power_Level

Yes

HCI_OP_WRITE_INQUIRY_RESP_TX_PWR_LEVEL

HCI_Send_Keypress_Notification

Yes

HCI_OP_SEND_KEY_PRESS_NOTIFICATION

HCI_Read_Default_Erroneous_Data_Reporting

NO

HCI_OP_READ_DEF_ERRONEOUS_DATA_REP

HCI_Write_Default_Erroneous_Data_Reporting

No

HCI_OP_WRITE_DEF_ERRONEOUS_DATA_REP

HCI_Enhanced_Flush

Yes

HCI_OP_ENHANCED_FLUSH

HCI_Read_Logical_Link_Accept_Timeout

No

HCI_OP_READ_LOGICAL_LINK_ACCEPT_TOUT

HCI_Write_Logical_Link _Accept_Timeout

No

HCI_OP_WRITE_LOGICAL_LINK_ACCEPT_TOUT

HCI_Set_Event_Mask_Page_2

Yes

HCI_OP_SET_EVENT_MASK_PAGE_2

HCI_Read_Location_Data

No

HCI_OP_READ_LOCATION_DATA

HCI_Write_Location_Data

No

HCI_OP_WRITE_LOCATION_DATA

HCI_Read_Flow_Control_Mode

HCI_Write_Flow_Control_Mode

HCI_Read_Enhanced_Transmit_Power_Level

Yes

HCI_OP_READ_ENHANCED_TX_PWR_LEVEL

HCI_Read_Best_Effort_Flush_Timeout

No

HCI_OP_READ_BE_FLUSH_TOUT

HCI_Write_Best_Effort_Flush_Timeout

No

HCI_OP_WRITE_BE_FLUSH_TOUT

HCI_Short_Range_Mode

No

HCI_OP_SHORT_RANGE_MODE

HCI_Read_LE_Host_Support

No

HCI_OP_READ_LE_HOST_SUPPORT

HCI_Write_LE_Host_Support

No

HCI_OP_WRITE_LE_HOST_SUPPORT

HCI_Set_MWS_Channel_Parameters

No

HCI_ Set_ External_Frame_Configuration

No

HCI_Set_MWS_Transport_Layer

No

HCI_Set_MWS_Scan_Frequency_Table

No

HCI_Set_MWS_PATTERN_Configuration

No

HCI_Set_Reserved_LT_ADDR

No

HCI_Read_Local_Version_Information

No

HCI_Read_Local_Supported_Commands

No

HCI_Read_Local_Supported_Features

No

HCI_Read_Local_Extended_Features

No

HCI_Read_Buffer_Size

No

HCI_Read_BD_ADDR

No

HCI_Read_Data_Block_Size

No

HCI_Read_Local_Supported_Codecs

No

For OGF 0x05#

HCI Commands(OCF)

Supported

Comments(Macro's Defined in the source code)

HCI_Read_Failed_Contact_Counter

Yes

HCI_OP_READ_FAILED_CONTACT_COUNTER

HCI_Reset_Failed_Contact_Counter

Yes

HCI_OP_RESET_FAILED_CONTACT_COUNTER

HCI_Read_Link_Quality 0

Yes

HCI_OP_READ_LINK_QUALITY

HCI_Read_RSSI

Yes

HCI_OP_READ_RSSI

HCI_Read_AFH_Channel_Map

Yes

HCI_OP_READ_AFH_CH_MAP

HCI_Read_Clock

Yes

HCI_OP_READ_CLK

HCI_Read_Encryption_Key_Size

Yes

HCI_OP_READ_ENCRYPTION_KEY_SIZE

HCI_Read_Local_AMP_Info

No

HCI_OP_READ_LOCAL_AMP_INFO

HCI_Write_Local_AMP_Info

No

HCI_Read_Local_AMP_ASSOC

NO

HCI_OP_READ_LOCAL_AMP_ASSOC

HCI_Write_Remote_AMP_ASSOC

No

HCI_OP_WRITE_REMOTE_AMP_ASSOC

For OGF 0x06#

HCI Commands(OCF)

Supported

Comments(Macro's Defined in the source code)

HCI_Read_Loopback_Mode

No

HCI_Write_Loopback_Mode

No

HCI_Enable_Device_Under_Test_Mode

Yes

HCI_OP_ENABLE_DEV_UNDER_TEST_MODE

HCI_Write_Simple_Pairing_Debug_Mode

Yes

HCI_OP_WRITE_PAIRING_DBG_MODE

HCI_Enable_AMP_Receiver_Reports

No

HCI_AMP_Test_End

No

HCI_AMP_Test

No

HCI_Write_Secure_Connections_Test_Mode

No