> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Verify HFP functions

> HFP defines how an audio gateway device can connect to a hands-free device for functions like remote control and audio connection.

<a id="bluez-hfp" />

To perform HFP client or audio gateway functions, you must first complete the steps in the following procedure.

## Prerequisites

* Enable SSH to access your host device. For instructions, see <a href="https://dragonwingdocs.qualcomm.com/Key-Documents/Flash-Guide/how-to-sign-in-with-ssh" target="_self">Sign in using SSH</a>.

* Place the DUT and the remote device in the Bluetooth vicinity.

## Set up the device for HFP functions

1. Run the SSH in command prompt using the following command:

   ```text theme={null}
   ssh root@<device_IP_address>
   ```

   **Example**

   If the IP address of the device is `10.92.160.222`, run the following command:

   ```text theme={null}
   ssh root@10.92.160.222
   ```

2. Connect to the SSH by entering the following password:

   ```text theme={null}
   oelinux123
   ```

3. Configure the DUT for the HFP <a href="#configure-the-dut-for-hfp-client-functions" target="_self">client</a> or <a href="#configure-the-dut-for-hfp-audio-gateway-functions" target="_self">audio gateway</a> functions, as required.

## Configure the DUT for HFP client functions

After the <a href="#set-up-the-device-for-hfp-functions" target="_self">initial device set up</a> for HFP functions, do the following for an HFP client:

1. Verify the status of ofono service by running the following command in SSH:

   ```text theme={null}
   systemctl status ofono
   ```

2. Download the Bluetooth configuration file `bluetooth.conf` from <a href="https://github.com/PipeWire/wireplumber/blob/0.5.1/src/config/wireplumber.conf.d.examples/" target="_self">GitHub PipeWire page</a>.

3. Push the `bluetooth.conf` file to the device at the `/usr/share/wireplumber/wireplumber.conf.d` directory.

4. Open the `bluetooth.conf` file in a text editor.

5. Uncomment the `bluez5.hfphsp-backend = "native"` property. Change its value from `"native"` to `"ofono"`.

   The file must appear as follows:

   ```text theme={null}
   # bluez5.enable-hw-volume = true

   ## HFP/HSP backend (default: native).
   ## Available values: any, none, hsphfpd, ofono, native
   bluez5.hfphsp-backend = "ofono"

   ## HFP/HSP native backend modem (default: none).
   ```

6. Save the file.

7. Reload the daemon by running the following command:

   ```text theme={null}
   systemctl daemon-reload
   ```

8. Restart the WirePlumber service by running the following command:

   ```text theme={null}
   systemctl restart wireplumber
   ```

   After you reload the daemon and restart the WirePlumber service, the changes in the `bluetooth.conf` configuration file reflect in the system. PipeWire establishes a connection with ofono using DBUS.

9. Run `bluetoothctl` by running the following command in SSH:

   ```text theme={null}
   bluetoothctl
   ```

10. Verify if the UUID of the hands-free-client device appears in the list by running the following command from the `bluetoothctl` menu:

    ```text theme={null}
    show
    ```

**Sample output**

```text theme={null}
[bluetooth]# show
Controller 22:22:9B:2C:79:1E (public)
   Name: qcm6490
   Alias: qcm6490
   Class: 0x002c0000
   Powered: yes
   Discoverable: no
   DiscoverableTimeout: 0x000000b4
   Pairable: yes
   UUID: A/V Remote Control        (e000110e-0000-1000-8000-00805f9b34fb)
   UUID: PnP Information           (e0001200-0000-1000-8000-00805f9b34fb)
   UUID: Audio Source              (e000110a-0000-1000-8000-00805f9b34fb)
   UUID: Audio Sink                (e000110b-0000-1000-8000-00805f9b34fb)
   UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
   UUID: Generic Access Profile    (e0001800-0000-1000-8000-00805f9b34fb)
   UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
   UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
   UUID: Handsfree                 (e000111e-0000-1000-8000-00805f9b34fb)
   Modalias: usb:v1D6Bp0246d0541
   Discovering: no
   Roles: central
   Roles: peripheral
Advertising Features:
   ActiveInstances: 0x00 (0)
   SupportedInstances: 0x10 (16)
   SupportedIncludes: tx-power
   SupportedIncludes: appearance
   SupportedIncludes: local-name
   SupportedSecondaryChannels: 1M
   SupportedSecondaryChannels: 2M
   SupportedSecondaryChannels: Coded
[bluetooth]#
```

<Note>
  The hands-free audio gateway and headset UUIDs aren't listed. Only the hands-free client UUID that's configured from PipeWire appears in the list.
</Note>

11. Open the `ofono/test` menu by running the following command in SSH:

    ```text theme={null}
    ls -rt /usr/lib/ofono/test
    ```

    <Note>
      Build and install the `ofono-tests` package on your device for the `ofono/test` application.
    </Note>

**Sample output**

```text theme={null}
sh-5.1# ls -rt /usr/lib/ofono/test
unlock-pin                 set-ddr                     hangup-call
test-stk-menu              set-context-property        hangup-all
test-ss-control-cs         set-cbs-topics              hangup-active
test-ss-control-cf         set-call-forwarding         get-tech-preference
test-ss-control-cb         send-vcard                  get-serving-cell-info
test-ss                    send-vcal                   get-operators
test-sms                   send-ussd                   get-icon
test-smart-messaging       send-sms                    enter-pin
test-serving-cell-info     scan-for-operators          enable-throttling
test-push-notification     reset-pin                   enable-modem
test-phonebook             remove-contexts             enable-gprs
test-network-registration  release-and-swap            enable-cbs
test-modem                 release-and-answer          display-icon
test-message-waiting       reject-calls                disable-throttling
test-gnss                  register-operator           disable-modem
test-cbs                   register-auto               disable-gprs
test-call-settings         receive-sms                 disable-call-forwarding
test-call-forwarding       process-context-settings    dial-number
test-call-barring          private-chat                deactivate-context
test-advice-of-charge      online-modem                deactivate-all
swap-calls                 offline-modem               create-multiparty
set-use-sms-reports        monitor-ofono               create-mms-context
set-umts-band              lockdown-modem              create-internet-context
set-tty                    lock-pin                    change-pin
set-tech-preference        list-operators              cdma-set-credentials
set-speaker-volume         list-modems                 cdma-list-call
set-sms-smsc               list-messages               cdma-hangup
set-sms-bearer             list-contexts               cdma-dial-number
set-sms-alphabet           list-calls                  cdma-connman-enable
set-roaming-allowed        list-applications           cdma-connman-disable
set-msisdn                 list-allowed-access-points  cancel-ussd
set-mms-details            initiate-ussd               cancel-sms
set-mic-volume             ims-unregister              backtrace
set-lte-property           ims-register                answer-calls
set-gsm-band               hold-and-answer             activate-context
set-fast-dormancy          hangup-multiparty
```

For HFP client functions, see <a href="perform-bluetooth-hfp-client-functions" target="_self">Perform Bluetooth HFP client functions</a>.

## Configure the DUT for HFP audio gateway functions

After the <a href="#set-up-the-device-for-hfp-functions" target="_self">initial device set up</a> for HFP functions, do the following for an HFP audio gateway:

1. Run `bluetoothctl` by running the following command in SSH:

   ```text theme={null}
   bluetoothctl
   ```

2. Verify if the UUID of the hands-free audio gateway and the headset appear in the list by running the following command from the `bluetoothctl` menu:

   ```text theme={null}
   show
   ```

   **Sample output**

   ```text theme={null}
   [bluetooth]# show
   Controller 22:22:9B:2C:79:1E (public)
      Name: qcm6490
      Alias: qcm6490
      Class: 0x006c0000
      Powered: yes
      Discoverable: no
      DiscoverableTimeout: 0x000000b4
      Pairable: yes
      UUID: A/V Remote Control        (0000110a-0000-1000-8000-00805f9b34fb)
      UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
      UUID: Handsfree Audio Gateway   (0000111f-0000-1000-8000-00805f9b34fb)
      UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
      UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
      UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
      UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
      UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
      UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
      UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
      UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
      Modalias: usb:v1D6Bp0246d0541
      Discovering: no
      Roles: central
      Roles: peripheral
   Advertising Features:
      ActiveInstances: 0x00 (0)
      SupportedInstances: 0x10 (16)
      SupportedIncludes: tx-power
      SupportedIncludes: appearance
      SupportedIncludes: local-name
      SupportedSecondaryChannels: 1M
      SupportedSecondaryChannels: 2M
      SupportedSecondaryChannels: Coded
   [bluetooth]# |
   ```

3. Enable Modified Sub Band Coding (mSBC) codec as the default codec for HFP audio gateway connection as follows:

   a. Open the `bluetooth.conf` file using a text editor on the device.

   b. Uncomment `bluez5.enable-msbc = true` line in the bluetooth.conf file.

   c. Save the `bluetooth.conf` file.

4. Reload the Bluetooth daemon by running the following command:

   ```text theme={null}
   systemctl daemon-reload
   ```

5. Restart the WirePlumber service by running the following command:

   ```text theme={null}
   systemctl restart wireplumber
   ```

   The changes in the `bluetooth.conf` configuration file are applied in the device.

For HFP audio gateway functions, see <a href="perform-bluetooth-hfp-audio-gateway-functions" target="_self">Perform Bluetooth HFP audio gateway functions</a>.

## Next steps

### <a href="perform-bluetooth-hfp-client-functions" target="_self">Perform Bluetooth HFP client functions</a>

You can perform HFP client functions using the **bluetoothctl** menu and **ofono/test** tools. Bluetooth HFP client functions include connecting or disconnecting to a remote device and managing phone calls over Bluetooth. You can dial a phone number, answer or reject incoming calls, and list active calls using HFP client functions.

### <a href="perform-bluetooth-hfp-audio-gateway-functions" target="_self">Perform Bluetooth HFP audio gateway functions</a>

You can perform HFP audio gateway functions using the **bluetoothctl** menu and **paplay** commands. Bluetooth HFP audio gateway functions allow you to connect or disconnect to a remote device and verify audio gateway functionality to ensure proper hands-free operation.
