# 验证 FTP 功能

FTP 定义了两个蓝牙设备之间交换文件的要求。

要执行蓝牙 FTP 功能，您必须首先完成以下过程中的步骤。

## 前提条件

- 启用 SSH 以访问您的主机设备。有关说明，请参阅[使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70022-254/how_to.html#use-ssh)。
- 确保 DUT 和远程设备支持 BlueZ 协议栈。一台设备充当服务器，另一台设备充当客户端。

Note

要测试或验证 FTP 服务器功能，不需要测试应用程序。通过客户端连接执行 FTP 功能。
- 配对 DUT 和远程设备。有关说明，请参阅[与远程蓝牙设备配对](https://docs.qualcomm.com/doc/80-70022-13SC/topic/bluez-perform-bluetooth-gap-functions.html#section-h4c-1bs-lcc-navyanka-08-21-24-1205-46-507)。
- 将 DUT 和远程设备放置在蓝牙附近。

## 设置设备的蓝牙 FTP 功能

1. 在命令提示符下使用以下命令运行 SSH：

ssh root@<device_IP_address>
        Copy to clipboard

    **示例**

    如果设备的 IP 地址为 `10.92.160.222`，则运行以下命令：

ssh root@10.92.160.222
        Copy to clipboard
2. 输入以下密码来连接 SSH：

oelinux123
        Copy to clipboard
3. 通过运行以下命令打开蓝牙测试应用程序：

obexctl
        Copy to clipboard

    要查看 OBEX 功能，请运行以下命令：

help
        Copy to clipboard

    此命令提供 **obexctl** 的主菜单。

    **示例输出**

sh-5.1# obexctl
        [NEW] Client /org/bluez/obex
        [obex]# help
        Menu main:
        Available commands:
        -------------------
        connect <dev> [uuid] [channel]                    Connect session
        disconnect [session]                              Disconnect session
        list                                              List available sessions
        show [session]                                    Session information
        select <session>                                  Select default session
        info <object>                                     Object information
        cancel <transfer>                                 Cancel transfer
        suspend <transfer>                                Suspend transfer
        resume <transfer>                                 Resume transfer
        send <file>                                       Send file
        pull <file>                                       Pull Vobject & stores in file
        cd <path>                                         Change current folder
        ls <options>                                      List current folder
        cp <source file> <destination file>               Copy source file to destination file
        mv <source file> <destination file>               Move source file to destination file
        rm <file>                                         Delete file
        mkdir <folder>                                    Create folder
        version                                           Display version
        quit                                              Quit program
        exit                                              Quit program
        help                                              Display help about this program
        export                                            Print environment variables
        [obex]#
        Copy to clipboard
4. 通过从 `obexctl` 菜单运行以下命令连接到远程设备：

connect <bt_address> <profile_name>
        Copy to clipboard

    **参数**

    - `<bt_address>` 是远程设备的蓝牙地址。
    - `<profile_name>` 是 `ftp`.

    **示例**

    要使用 `<bt_address>` `E8:48:B8:C8:20:00` 连接到远程设备，请运行以下命令：

connect E8:48:B8:C8:20:00 ftp
        Copy to clipboard

    **示例输出**

[E8:48:B8:C8:20:00]# connect E8:48:B8:C8:20:00 ftp
        Attempting to connect to E8:48:B8:C8:20:00
        [NEW] Session /org/bluez/obex/client/session7
        [NEW] FileTransfer /org/bluez/obex/client/session7
        Connection successful
        Copy to clipboard

    要执行 FTP 客户端功能，请参阅[执行蓝牙 FTP 客户端功能](https://docs.qualcomm.com/doc/80-70022-13SC/topic/bluez-perform-bluetooth-ftp-server-and-client-functions.html#bluez-perform-bluetooth-ftp-server-and-client-functions)。

## 后续步骤

- [执行蓝牙 FTP 客户端功能](https://docs.qualcomm.com/doc/80-70022-13SC/topic/bluez-perform-bluetooth-ftp-server-and-client-functions.html)
您可以使用 `obexctl` 主菜单中提供的命令验证蓝牙 FTP 客户端功能。

Last Published: Nov 03, 2025

[Previous Topic
执行蓝牙 OPP 客户端功能](https://docs.qualcomm.com/bundle/publicresource/80-70022-13SC/topics/bluez-perform-bluetooth-opp-client-functions.md) [Next Topic
执行蓝牙 FTP 客户端功能](https://docs.qualcomm.com/bundle/publicresource/80-70022-13SC/topics/bluez-perform-bluetooth-ftp-server-and-client-functions.md)