# Hands-Free Profile

Source: [https://docs.qualcomm.com/doc/80-70017-13/topic/bluez-hfp.html](https://docs.qualcomm.com/doc/80-70017-13/topic/bluez-hfp.html)

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

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

## Set up the device for HFP functions

**Prerequisites**

- Enable SSH to access your host device. For instructions, see [Log in using SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh).
- Place the DUT and the remote device in the Bluetooth vicinity.

**Procedure**

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

        ssh root@<device_IP_address>Copy to clipboard

    **Example**

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

        ssh root@10.92.160.222Copy to clipboard
2. Connect to the SSH by entering the following password: 

        oelinux123Copy to clipboard
3. Configure the DUT for the HFP [client](https://docs.qualcomm.com/doc/80-70017-13/topic/bluez-hfp.html#bluez-hfp__section_nlh_q3v_mcc_navyanka_08-25-24-1246-29-767) or
                        [audio
                        gateway](https://docs.qualcomm.com/doc/80-70017-13/topic/bluez-hfp.html#bluez-hfp__section_jgk_r3v_mcc_navyanka_08-25-24-1246-49-237) functions, as required.

## Configure the DUT for HFP client functions

After the [initial
                    device set up](https://docs.qualcomm.com/doc/80-70017-13/topic/bluez-hfp.html#bluez-hfp__section_rmp_dgv_mcc_navyanka_08-25-24-1227-32-765) for HFP functions, do the following for an HFP client:

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

        systemctl status ofonoCopy to clipboard
2. Open the pulse configuration file system.pa at the
                            /etc/pulse/ directory in a text editor.
3. Add `headset=ofono` to the following lines in the
                            file:

        Load module bluetooth discover
        load-module module-bluetooth-discover headset=ofonoCopy to clipboard

    The
                            file must appear as follows:

### Load module bluetooth discover
        load-module module-bluetooth-discover headset=ofono
        
        ### Load module bluetooth policy
        load-module module-bluetooth-policy
        sh-5.1#Copy to clipboard
4. Save the file.
5. Reload the daemon by running the following
                        command:

        systemctl daemon-reloadCopy to clipboard
6. Restart PulseAudio by running the following command:

        systemctl restart pulseaudioCopy to clipboard

    After
                            you reload the daemon and restart PulseAudio, the changes in the
                                system.pa configuration file reflect in the
                            system. A connection is established between PulseAudio and ofono using
                            DBUS.
7. Run `bluetoothctl` by running the following command in
                        SSH:

        bluetoothctlCopy to clipboard
8. Verify if the UUID of the hands-free-client device is listed by running the
                        following command from the `bluetoothctl`
                                menu:

        showCopy to clipboard

    **Sample                                output**

[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]#Copy to clipboard

Note: 
                            
The hands-free audio gateway and headset UUIDs are not listed. Only
                                the hands-free client UUID that is configured from PulseAudio is
                                listed.
9. Open the `ofono/test` menu by running the following command
                        in SSH:

        ls -rt /usr/lib/ofono/testCopy to clipboard

Note: The
                                    ofono/test application is available only in
                                    `qcom-multimedia-test-image`. To run the
                                    ofono/test application on the user build,
                                you must compile it.

    **Sample output**

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
        sh-5.1#Copy to clipboard

For HFP client functions, see [Perform Bluetooth HFP client functions](https://docs.qualcomm.com/doc/80-70017-13/topic/bluez-perform-bluetooth-hfp-client-functions.html).

## Configure the DUT for HFP audio gateway functions

After the [initial
                    device set up](https://docs.qualcomm.com/doc/80-70017-13/topic/bluez-hfp.html#bluez-hfp__section_rmp_dgv_mcc_navyanka_08-25-24-1227-32-765) for HFP functions, do the following for an HFP audio
                gateway:

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

        bluetoothctlCopy to clipboard
2. Verify if the UUID of the hands-free audio gateway and the headset are
                        listed by running the following command from the
                            `bluetoothctl`
                            menu:

        showCopy to clipboard

**Sample                            output**
[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]# |Copy to clipboard

For HFP audio gateway functions, see [Perform Bluetooth HFP audio gateway functions](https://docs.qualcomm.com/doc/80-70017-13/topic/bluez-perform-bluetooth-hfp-ag-functions.html).

- **[Perform Bluetooth HFP client functions](https://docs.qualcomm.com/doc/80-70017-13/topic/bluez-perform-bluetooth-hfp-client-functions.html)**  

You can perform HFP client functions using the `bluetoothctl` menu and             `ofono/test` tools.
- **[Perform Bluetooth HFP audio gateway functions](https://docs.qualcomm.com/doc/80-70017-13/topic/bluez-perform-bluetooth-hfp-ag-functions.html)**  

You can perform HFP audio gateway functions using the `bluetoothctl`         menu and `paplay` commands.

**Parent Topic:** [Verify functionality of BlueZ stack](https://docs.qualcomm.com/doc/80-70017-13/topic/verify-bluetooth-functionality-of-bluez-stack.html)

Last Published: Dec 26, 2024

[Previous Topic
Perform Bluetooth A2DP sink functions](https://docs.qualcomm.com/bundle/publicresource/80-70017-13/topics/bluez-perform-bluetooth-a2dp-sink-functions.md) [Next Topic
Perform Bluetooth HFP client functions](https://docs.qualcomm.com/bundle/publicresource/80-70017-13/topics/bluez-perform-bluetooth-hfp-client-functions.md)