# 测试与故障排除

## 工具

支持使用以下工具进行功能测试和搭建编译环境。

### 传感器功能测试工具

传感器信息测试、驱动程序验收测试以及 sensor workhorse 工具可助力对传感器各项功能进行全面测试。

- 传感器信息测试提供有关传感器的详细信息。
- 驱动程序验收测试可确保传感器驱动程序正常运行并与 QSH 兼容。
- Sensor workhorse 是在多种条件下对传感器进行压力测试的工具。

测试工具可确保应用中基于硬件和软件的传感器的准确性、可靠性和最佳性能。以下部分提供有关测试工具的信息。

#### 传感器信息测试 (ssc\_sensor\_info)，列出 QSH 支持的传感器及其属性

**传感器信息测试定义**

传感器信息测试 `ssc_sensor_info` 是 QSH 测试套件中的一个应用程序。其中列出了 QSH 支持的传感器及其属性。您可以查询指定数据类型的属性。

ssc_sensor_info [-sensor=<sensor_type>] [-delay=<time_in_seconds>][-duration=<time_in_seconds>][-default_only=<1|0>][-log=<1|0>][-help]
    Copy to clipboard

表：ssc_sensor_info 的参数

| **标志** | **类型** | **值** | **单位** | 备注 |
| --- | --- | --- | --- | --- |
| Sensor | `string` | 任何有效的传感器类型，例如 *accel* 和 *gyro*。 | – | 为指定的传感器类型查询属性信息。 |
| Log | `int` | 0 | 1 | – | 启用或禁用诊断 (API) 日志。 |
| help(h) | `int` | – | – | 显示命令用法帮助。 |
| Duration | `int` | 正值 | 秒 | 指定传感器属性更新的等待时间。 |
| Delay | `int` | 正值 | 秒 | 指定发送传感器请求之前的时间延迟。 |
| default\_only | `int` | 0 | 1 | – | 如果 `default_only` 标志设置为 False，则发送支持指定数据类型的所有可用传感器的 UID。如果 `default_only` 标志设置为 True，则仅发送默认传感器可用性的 UID。 |

**传感器信息测试示例**

- 查询传感器属性并生成诊断日志。

ssc_sensor_info
        Copy to clipboard

root@qcm6490:~# ssc_sensor_info
        ssc_sensor_info v1.86
        
        SUID           = 0xebd5604d09d379bca54dcf30ec041e0f
        NAME           = ak0991x
        VENDOR         = akm
        TYPE           = mag
        AVAILABLE      = true
        VERSION        = 2.62.47
        API            = sns_mag.proto
        RATES          = [1.000000, 10.000000, 20.000000, 50.000000, 100.000000]
        RESOLUTIONS    = 0.150000
        RANGES         = [-4912.000000,4912.000000]
        DRI            = false
        FIFO_SIZE      = 0
        STREAM_TYPE    = streaming
        STREAM_SYNC    = false
        DYNAMIC        = false
        EVENT_SIZE     = 16
        OP_MODES       = [LOW_POWER, LOW_NOISE]
        ACTIVE_CURRENT = 900
        SLEEP_CURRENT  = 3
        HW_ID          = 0
        RIGID_BODY     = display
        PHYSICAL_SENSOR       = true
        PHYSICAL_SENSOR_TESTS = [3, 1]
        SELECTED_RESOLUTION   = 0.150000
        SELECTED_RANGE        = [-4912.000000,4912.000000]
        
        SUID           = 0xaddeaddeaddeaddeaddeaddeaddeadde
        NAME           = da_test
        VENDOR         = QTI
        TYPE           = da_test
        AVAILABLE      = true
        VERSION        = 0.51.0
        API            = sns_da_test.proto
        STREAM_TYPE    = on_change
        
        SUID           = 0x69def905fea2fbac6a43ca273221a2eb
        NAME           = aont
        VENDOR         = QTI
        TYPE           = aont
        AVAILABLE      = true
        VERSION        = 0.0.1
        API            = sns_aont.proto
        STREAM_TYPE    = on_change
        
        SUID           = 0xabababababababababababababababab
        NAME           = suid
        VENDOR         = QTI
        TYPE           = suid
        AVAILABLE      = true
        VERSION        = 0.0.1
        API            = sns_suid.proto
        STREAM_TYPE    = single_output
        
        SUID           = 0xe12754a7007f27595e2541b4701e2275
        NAME           = registry
        VENDOR         = QTI
        TYPE           = registry
        AVAILABLE      = true
        VERSION        = 0.0.1
        API            = sns_registry.proto
        STREAM_TYPE    = single_output
        
        SUID           = 0xadfeadfeadfeadfeadfeadfeadfeadfe
        NAME           = da_test_big_image
        VENDOR         = QTI
        TYPE           = da_test
        AVAILABLE      = true
        VERSION        = 0.49.0
        API            = sns_da_test.proto
        STREAM_TYPE    = on_change
        
        SUID           = 0x61ab5376b4a5c9aa58442ede47acd316
        NAME           = icm4x6xx
        VENDOR         = TDK-Invensense
        TYPE           = accel
        AVAILABLE      = true
        VERSION        = 1.65.2
        API            = sns_accel.proto
        RATES          = [12.500000, 25.000000, 50.000000, 100.000000, 200.000000, 500.000000]
        RESOLUTIONS    = [0.000019, 0.000037, 0.000075, 0.000150, 0.000299]
        RANGES         = [[-9.806650,9.806650], [-19.613300,19.613300], [-39.226601,39.226601], [-78.453201,78.453201], [-156.906403,156.906403]]
        DRI            = true
        FIFO_SIZE      = 200
        STREAM_TYPE    = streaming
        STREAM_SYNC    = false
        DYNAMIC        = false
        EVENT_SIZE     = 16
        OP_MODES       = [LPM, NORMAL, HIGH_PERF]
        ACTIVE_CURRENT = [50, 240, 240]
        SLEEP_CURRENT  = 6
        HW_ID          = 0
        RIGID_BODY     = display
        PHYSICAL_SENSOR       = true
        PHYSICAL_SENSOR_TESTS = [3, 2, 1]
        SELECTED_RESOLUTION   = 0.000299
        SELECTED_RANGE        = [-156.906403,156.906403]
        LOW_LATENCY_RATES     = 1000.000000
        PASSIVE_REQUEST       = true
        Copy to clipboard
- 查询所有 *accel* 传感器属性

ssc_sensor_info -sensor=accel
        Copy to clipboard

root@qcm6490:~# ssc_sensor_info -sensor=accel
        ssc_sensor_info v1.86
        
        SUID           = 0x61ab5376b4a5c9aa58442ede47acd316
        NAME           = icm4x6xx
        VENDOR         = TDK-Invensense
        TYPE           = accel
        AVAILABLE      = true
        VERSION        = 1.65.2
        API            = sns_accel.proto
        RATES          = [12.500000, 25.000000, 50.000000, 100.000000, 200.000000, 500.000000]
        RESOLUTIONS    = [0.000019, 0.000037, 0.000075, 0.000150, 0.000299]
        RANGES         = [[-9.806650,9.806650], [-19.613300,19.613300], [-39.226601,39.226601], [-78.453201,78.453201], [-156.906403,156.906403]]
        DRI            = true
        FIFO_SIZE      = 80
        STREAM_TYPE    = streaming
        STREAM_SYNC    = false
        DYNAMIC        = false
        EVENT_SIZE     = 16
        OP_MODES       = [LPM, NORMAL, HIGH_PERF]
        ACTIVE_CURRENT = [50, 240, 240]
        SLEEP_CURRENT  = 6
        HW_ID          = 0
        RIGID_BODY     = display
        PHYSICAL_SENSOR       = true
        PHYSICAL_SENSOR_TESTS = [3, 2, 1]
        SELECTED_RESOLUTION   = 0.000299
        SELECTED_RANGE        = [-156.906403,156.906403]
        LOW_LATENCY_RATES     = [1000.000000, 2000.000000]
        PASSIVE_REQUEST       = true
        Copy to clipboard

**输出**

测试程序生成以下输出：

- 控制台上的标准输出
- 结果文件

#### 驱动程序验收测试 (ssc\_drva\_test)，用于验证传感器驱动程序

**驱动程序验收测试定义**

`ssc_drva_test` 驱动程序验收测试工具执行以下操作：

- 执行传感器驱动程序验证，并在 QSH 传感器 API 层运行。
- 执行一系列传感器用例。
- 直接从命令行接受参数，从而无需使用编译时选项。

这种方法使该工具成为执行基本驱动程序级测试或验证的便捷而有效的工具。

ssc_drva_test [-sensor=<sensor_type>] [-duration=<time_in_seconds>] [-sample_rate=<value_in_Hz>] [-batch_period=<value_in_seconds>] [-iterations=<value>] [-num_samples=<value>] [-factory_test=<value>]
    Copy to clipboard

表：ssc_drva_test 参数

| **标志** | **类型** | **值** | **单位** | **备注** |
| --- | --- | --- | --- | --- |
| `sensor` | `string` | <ul class="simple"><br><li><p><code class="docutils literal notranslate"><span class="pre">accel</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">gyro</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">sensor_temperature</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">pressure</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">mag</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">humidity</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">ambient_temperature</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">ultra_violet</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">proximity</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">ambient_light</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">rgb</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">hall</span></code></p></li><br><li><p>添加的任何自定义传感器</p></li><br></ul> | – | 强制参数：仅限于可用的传感器类型。 |
| `duration` | `float` | 仅限正值 | 秒 | 强制参数：传感器测试持续时间（以 s 为单位）。 |
| `sample_rate` | `float` | 正浮点数值：<br><br><br><br>> <br>> <br>> <ul class="simple"><br>> <li><p>-1：最大采样率</p></li><br>> <li><p>-2：最小采样率</p></li><br>> </ul> | Hz | 对于流传感器是强制性的，对于变化传感器则是可选的。 |
| `batch_period` | `float` | 正浮点数 | 秒 | 该周期与报告周期相同，指示在低功耗处理器外部缓冲示例和报告的时间。 |
| `iterations` | `int` | 仅限正值 | 不适用 | 提供必须重复测试的次数。 |
| `num_samples` | `int` | 仅限正值 | 不适用 | 指示要收集的最小示例数。如果已指定 `num_samples` 参数，并且测试在测试期间未收集到足够的示例，则测试传感器将生成 FAIL。<br><br><br>`num_samples` 参数强制测试运行一段时间，此时间的最大值为指定的持续时间或由以下公式计算的值：<br><ul class="simple"><br><li><p><code class="docutils literal notranslate"><span class="pre">num_samples*</span></code> 预期采样率，其中的预期采样率是传感器的预期工作速率。</p></li><br></ul> |
| `factory_test` | `int` | <ul class="simple"><br><li><p><code class="docutils literal notranslate"><span class="pre">0</span> <span class="pre">(SNS_PHYSICAL_SENSOR_TEST_TYPE_SW)</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">1</span> <span class="pre">(SNS_PHYSICAL_SENSOR_TEST_TYPE_HW)</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">2</span> <span class="pre">(SNS_PHYSICAL_SENSOR_TEST_TYPE_FACTORY)</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">3</span> <span class="pre">(SNS_PHYSICAL_SENSOR_TEST_TYPE_COM)</span></code></p></li><br></ul> | 不适用 | 选择要运行的工厂测试类型（从值列中选择）。 |

**驱动程序验收测试示例**

- 在已知持续时间内以选定的采样频率对单个传感器进行数据流动：

ssc_drva_test -sensor=accel -duration=5 -sample_rate=500
        Copy to clipboard

root@qcm6490:~# ssc_drva_test -sensor=accel -duration=5 -sample_rate=500
        6 ssc_drva_test version 1.27k
        6 ssc_drva_test -sensor=accel -duration=5 -sample_rate=500
        diag: Diag_LSM_Init: invoked for pid: 1141 with init_count: 0
        diag:successfully connected to socket 3
        diag: Diag_LSM_Init: done for pid: 1141 with init_count: 1
        6 event_cb attribute event for da_test
        6 event_cb attribute event for da_test
        6 using da_test name=da_test, suid = [high addeaddeaddeadde, low addeaddeaddeadde
        6 enter send_memory_log_req cookie: 6
        6 exit send_memory_log_req
        6 enter da_test runner. -rumifact=1
        6 -time_to_first_event=233206
        6 -time_to_last_event=-20008
        6 -sample_ts=50267544823
        6 -total_samples=2528
        6 -avg_delta=37875
        6 -recvd_phy_config_sample_rate=500
        6 -random_seed_used=2926886043
        6 -num_request_sent=2
        6 -first_sample_timestamp=50171775915
        6 received event: PASS
        6 enter send_memory_log_req cookie: 6
        6 exit send_memory_log_req
        6 PASS
        Copy to clipboard
- 在已知持续时间内以选定的采样频率和报告周期批处理单个传感器：

ssc_drva_test -sensor=accel -duration=30.0 -sample_rate=100 -batch_period=2.0
        Copy to clipboard

root@qcm6490:~# ssc_drva_test -sensor=accel -duration=30.0 -sample_rate=100 -batch_period=2.0
        3 ssc_drva_test version 1.27k
        3 ssc_drva_test -sensor=accel -duration=30.0 -sample_rate=100 -batch_period=2.0
        diag: Diag_LSM_Init: invoked for pid: 1413 with init_count: 0
        diag:successfully connected to socket 3
        diag: Diag_LSM_Init: done for pid: 1413 with init_count: 1
        3 event_cb attribute event for da_test
        3 event_cb attribute event for da_test
        3 using da_test name=da_test, suid = [high addeaddeaddeadde, low addeaddeaddeadde
        3 enter send_memory_log_req cookie: 3
        3 exit send_memory_log_req
        3 enter da_test runner. -rumifact=1
        3 -time_to_first_event=15321140
        3 -time_to_last_event=-13606286
        3 -sample_ts=8591389823
        3 -total_samples=2960
        3 -avg_delta=184826
        3 -recvd_phy_config_sample_rate=100.000000
        3 -random_seed_used=3720387971
        3 -num_request_sent=2
        3 -first_sample_timestamp=8030694123
        3 received event: PASS
        3 enter send_memory_log_req cookie: 3
        3 exit send_memory_log_req
        3 PASS
        Copy to clipboard
- 加速度计自检（硬件自检）：

ssc_drva_test -sensor=accel -factory_test=1 -duration=10
        Copy to clipboard

root@qcm6490:~# ssc_drva_test -sensor=accel -factory_test=1 -duration=10
        4 ssc_drva_test version 1.27k
        4 ssc_drva_test -sensor=accel -factory_test=1 -duration=10
        diag: Diag_LSM_Init: invoked for pid: 1439 with init_count: 0
        diag:successfully connected to socket 3
        diag: Diag_LSM_Init: done for pid: 1439 with init_count: 1
        4 event_cb attribute event for da_test
        4 event_cb attribute event for da_test
        4 using da_test name=da_test, suid = [high addeaddeaddeadde, low addeaddeaddeadde
        4 enter send_memory_log_req cookie: 4
        4 exit send_memory_log_req
        4 enter da_test runner. -rumifact=1
        4 -time_to_first_event=0
        4 -time_to_last_event=-2032137957
        4 -sample_ts=10622073335
        4 -total_samples=0
        4 -avg_delta=0
        4 -recvd_phy_config_sample_rate=0.000000
        4 -random_seed_used=1840104635
        4 -num_request_sent=2
        4 -first_sample_timestamp=0
        4 received event: PASS
        4 enter send_memory_log_req cookie: 4
        4 exit send_memory_log_req
        4 PASS
        Copy to clipboard

**输出**

在控制台命令行上，此测试仅输出为 pass 或 fail，仅指示测试执行状态（测试是否完成）。

#### Sensor workhorse (see\_workhorse)，用于执行传感器压力测试

**Sensor workhorse 定义**

`see_workhorse` sensor workhorse 工具执行以下操作：
- 根据命令行参数操作特定传感器。
- 简化各种配置下的传感器测试和数据收集。

see_workhorse [-sensor=<sensor_type>][-sample_rate=<min | max | number>] [-batch_period=<seconds>] [-calibrated=<0 | 1>] [-wakeup=<0 | 1>]
    Copy to clipboard

表：see_workhorse 的参数

| 标志 | 类型 | 取值范围 | 单位 | 备注 |
| --- | --- | --- | --- | --- |
| `sensor` | `string` | <ul class="simple"><br><li><p><code class="docutils literal notranslate"><span class="pre">accel</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">gyro</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">sensor_temperature</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">pressure</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">mag</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">humidity</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">ambient_temperature</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">ultra_violet</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">proximity</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">ambient_light</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">rgb</span></code></p></li><br><li><p><code class="docutils literal notranslate"><span class="pre">hall</span></code></p></li><br><li><p>添加的任何自定义传感器</p></li><br></ul> | 不适用 | 强制参数：仅限于可用的传感器类型。 |
| `on_change` | `int` | 0 | 1 | 不适用 | <ul class="simple"><br><li><p>0 使用 <code class="docutils literal notranslate"><span class="pre">SNS_STD_SENSOR_STREAM_TYPE_STREAMING</span></code> 选择。</p></li><br><li><p>1 使用 <code class="docutils literal notranslate"><span class="pre">SNS_STD_SENSOR_STREAM_TYPE_ON_CHANGE</span></code> 选择。</p></li><br></ul> |
| `sample_rate` | `float` | 正浮点数值：<br><ul class="simple"><br><li><p>-1：最大采样率</p></li><br><li><p>-2：最小采样率</p></li><br></ul> | Hz | 对于流传感器是强制性的，对于变化传感器则是可选的。 |
| `batch_period` | `float` | 正浮点数 | 秒 | 与批处理周期或报告周期相同。 |
| `calibrated` | `int` | 0 | 1 | 不适用 | <ul class="simple"><br><li><p>0: nop（默认值）。</p></li><br><li><p>1：如果 <code class="docutils literal notranslate"><span class="pre">sensor_type</span></code> 是 gyro 或 mag，则还分别激活 <code class="docutils literal notranslate"><span class="pre">gyro_cal</span></code> 或 <code class="docutils literal notranslate"><span class="pre">/mag_cal</span></code>。</p></li><br></ul> |
| `wakeup` | `int` | 0 | 1 | 不适用 | <ul class="simple"><br><li><p>0：将 <code class="docutils literal notranslate"><span class="pre">suspend_config</span></code> 唤醒设置为 <code class="docutils literal notranslate"><span class="pre">SEE_CLIENT_DELIVERY_NO_WAKEUP</span></code>。</p></li><br><li><p>1：将 <code class="docutils literal notranslate"><span class="pre">suspend_config</span></code> 唤醒设置为 <code class="docutils literal notranslate"><span class="pre">SEE_CLIENT_DELIVERY_WAKEUP</span></code>（默认）。</p></li><br></ul> |
| `display_events` | `int` | 0 | 1 | 不适用 | 使用事件回调以 JSON 格式显示传感器事件。 |

**Sensor workhorse 示例**

例如，使用以下命令以最大速率对加速度传感器数据进行 30 秒数据流传输：

see_workhorse -sensor=accel -sample_rate=max -duration=30 -display_events=1
    Copy to clipboard

root@qcm6490:~# see_workhorse -sensor=accel -sample_rate=max -duration=30 -display_events=1
    see_workhorse version 2.04
    20:22:15.406 see_workhorse -sensor=accel -sample_rate=max -duration=30 -display_events=1
    begin usta_get_sensor_list
    Copy to clipboard

此命令指示 `see_workhorse` 以最大采样率运行加速度计 `accel`，持续 30 秒。

20:22:15.731 stream_sensor( accel)
    20:22:15.731 + sample_rate: 500.000000 hz
    20:22:15.838 config_stream_sensor() complete rc 0
    20:22:15.838 sleep(30) seconds
    
    "sns_client_event_msg" : {
     "suid" : {
      "suid_low" : "0x58442ede47acd316",
      "suid_high" : "0x61ab5376b4a5c9aa"
     },
     "events" : [
      {
       "msg_id" : 768,
       "timestamp" : 78497742089,
       "payload" : {
        "sample_rate" : 500.000000,
        "water_mark" : 1,
    Copy to clipboard

### 其他工具

请使用以下工具进行编译环境设置和功能诊断：

- **Qualcomm® Hexagon™ DSP 工具链**

    Hexagon 8.4.07 工具链
- **QXDM Professional 工具**

    The Qualcomm® eXtensible diagnostic monitor (QXDM) Professional™ 工具是一个诊断客户端。

    - QSH 框架可以直接调用宏和 API 来发送调试信息以打印字符串和日志数据包。
    - QXDM 日志主要用于 aDSP 端调试。有关更多信息，请参见 [Qualcomm Linux Sensors Guide - Addendum](https://docs.qualcomm.com/bundle/resource/topics/80-70018-7A/overview.html) 中的 [Troubleshoot sensors](https://docs.qualcomm.com/bundle/resource/topics/80-70018-7A/debugging.html)。

Note

[Qualcomm Linux Sensors Guide -  Addendum](https://docs.qualcomm.com/bundle/resource/topics/80-70018-7A/overview.html) 仅可由许可用户访问。
    - QXDM Professional 工具需要 USB 连接。应用处理器可直接连接到 USB 端口，而 aDSP 却不具备这样的连接能力。

## 验证

用户可以使用可用于验证这些功能的工具来确定配置的 QSH 功能是否正常运行，或者是否需要注意任何差异。用户可以使用测试工具或 QXDM Professional 检查配置的设置并采取必要的操作。

`ssc_sensor_info` 测试工具会验证 QSH 的功能，并列出所支持的传感器及其各项功能。

ssc_sensor_info
    Copy to clipboard

以下 shell 输出列出了所有支持的传感器及其属性：

root@qcm6490:~# ssc_sensor_info
    ssc_sensor_info v1.86
    
    SUID           = 0xebd5604d09d379bca54dcf30ec041e0f
    NAME           = ak0991x
    VENDOR         = akm
    TYPE           = mag
    AVAILABLE      = true
    VERSION        = 2.62.47
    API            = sns_mag.proto
    RATES          = [1.000000, 10.000000, 20.000000, 50.000000, 100.000000]
    RESOLUTIONS    = 0.150000
    RANGES         = [-4912.000000,4912.000000]
    DRI            = false
    FIFO_SIZE      = 0
    STREAM_TYPE    = streaming
    STREAM_SYNC    = false
    DYNAMIC        = false
    EVENT_SIZE     = 16
    OP_MODES       = [LOW_POWER, LOW_NOISE]
    ACTIVE_CURRENT = 900
    SLEEP_CURRENT  = 3
    HW_ID          = 0
    RIGID_BODY     = display
    PHYSICAL_SENSOR       = true
    PHYSICAL_SENSOR_TESTS = [3, 1]
    SELECTED_RESOLUTION   = 0.150000
    SELECTED_RANGE        = [-4912.000000,4912.000000]
    
    SUID           = 0xaddeaddeaddeaddeaddeaddeaddeadde
    NAME           = da_test
    VENDOR         = QTI
    TYPE           = da_test
    AVAILABLE      = true
    VERSION        = 0.51.0
    API            = sns_da_test.proto
    STREAM_TYPE    = on_change
    
    SUID           = 0x69def905fea2fbac6a43ca273221a2eb
    NAME           = aont
    VENDOR         = QTI
    TYPE           = aont
    AVAILABLE      = true
    VERSION        = 0.0.1
    API            = sns_aont.proto
    STREAM_TYPE    = on_change
    
    SUID           = 0xabababababababababababababababab
    NAME           = suid
    VENDOR         = QTI
    TYPE           = suid
    AVAILABLE      = true
    VERSION        = 0.0.1
    API            = sns_suid.proto
    STREAM_TYPE    = single_output
    
    SUID           = 0xe12754a7007f27595e2541b4701e2275
    NAME           = registry
    VENDOR         = QTI
    TYPE           = registry
    AVAILABLE      = true
    VERSION        = 0.0.1
    API            = sns_registry.proto
    STREAM_TYPE    = single_output
    
    SUID           = 0xadfeadfeadfeadfeadfeadfeadfeadfe
    NAME           = da_test_big_image
    VENDOR         = QTI
    TYPE           = da_test
    AVAILABLE      = true
    VERSION        = 0.49.0
    API            = sns_da_test.proto
    STREAM_TYPE    = on_change
    
    SUID           = 0x61ab5376b4a5c9aa58442ede47acd316
    NAME           = icm4x6xx
    VENDOR         = TDK-Invensense
    TYPE           = accel
    AVAILABLE      = true
    VERSION        = 1.65.2
    API            = sns_accel.proto
    RATES          = [12.500000, 25.000000, 50.000000, 100.000000, 200.000000, 500.000000]
    RESOLUTIONS    = [0.000019, 0.000037, 0.000075, 0.000150, 0.000299]
    RANGES         = [[-9.806650,9.806650], [-19.613300,19.613300], [-39.226601,39.226601], [-78.453201,78.453201], [-156.906403,156.906403]]
    DRI            = true
    FIFO_SIZE      = 200
    STREAM_TYPE    = streaming
    STREAM_SYNC    = false
    DYNAMIC        = false
    EVENT_SIZE     = 16
    OP_MODES       = [LPM, NORMAL, HIGH_PERF]
    ACTIVE_CURRENT = [50, 240, 240]
    SLEEP_CURRENT  = 6
    HW_ID          = 0
    RIGID_BODY     = display
    PHYSICAL_SENSOR       = true
    PHYSICAL_SENSOR_TESTS = [3, 2, 1]
    SELECTED_RESOLUTION   = 0.000299
    Copy to clipboard

关于常见问题的故障排除，请参阅[排除传感器故障](https://docs.qualcomm.com/doc/80-70018-7SC/topic/test_troubleshoot.html#debug)。

以下 QXDM 输出显示了低功耗处理器中所有支持的传感器及其属性的验证/确认日志：

Note

此功能当前仅适用于授权用户。要升级您的访问权限，前往 [www.qualcomm.com/support/working-with-qualcomm](https://www.qualcomm.com/support/working-with-qualcomm)。

[ 123/   2]   MSG    18:47:22.898750     SNS PLATFORM/High          [sns_registry_parser.c   2099] REG INIT DONE... ts=63248955
    [ 122/   1]   MSG    18:47:22.925000     SNS FRAMEWORK/Medium       [  sns_diag_service.c   1072] Sensor registry Vendor:QTI SSID:53 registered with diag
    [ 122/   1]   MSG    18:47:22.925000     SNS FRAMEWORK/Medium       [        sns_sensor.c    769] Populating sensor b2926130 in island: 2, with SUID e12754a7 007f2759 5e2541b4 701e2275
    [ 122/   2]   MSG    18:47:22.925000     SNS FRAMEWORK/High         [sns_attribute_service.c    584] Sensor : registry, suid_populated : 1, available : 1
    [ 122/   2]   MSG    18:47:22.925000     SNS FRAMEWORK/High         [sns_attribute_service.c    594] Avail:    B2926130  registry
    [ 123/   2]   MSG    18:47:22.925000     SNS PLATFORM/High          [sns_registry_sensor.c    284] Successfully initialized registry
    [ 122/   1]   MSG    18:47:22.925000     SNS FRAMEWORK/Medium       [sns_stream_service.c    150] Created data stream to Sensor 'registry' (b2926130) from Sensor 'suid' (b2922018): b296fd28
    [ 122/   1]   MSG    18:47:22.925000     SNS FRAMEWORK/Medium       [sns_stream_service.c    686] Add request b296fdc0 on stream b296fd28 (length 20; ID 512)
    [ 122/   0]   MSG    18:47:22.926250     SNS FRAMEWORK/Low          [sns_stream_service.c    548] Process request for Sensor b2926130 on b296fd28
    [ 122/   0]   MSG    18:47:22.926250     SNS FRAMEWORK/Low          [   sns_suid_sensor.c   1050] send_suid_event dt=registry, default=1
    [ 123/   2]   MSG    18:47:22.926250     SNS PLATFORM/High          [         sns_q6_pm.c    365] Deregister_client: B2927B30
    [ 123/   2]   MSG    18:47:22.926250     SNS PLATFORM/High          [sns_registry_sensor.c    366] Processed : SSCRPCD UP Signal
    [ 122/   0]   MSG    18:47:22.926250     SNS FRAMEWORK/Low          [   sns_suid_sensor.c   1050] send_suid_event dt=registry, default=1
    [ 122/   1]   MSG    18:47:22.926250     SNS FRAMEWORK/Medium       [   sns_data_stream.c    551] sns_data_stream_deinit b29231d0 removing=0
    [ 122/   1]   MSG    18:47:22.926250     SNS FRAMEWORK/Medium       [sns_stream_service.c    686] Add request b2927b30 on stream b29231d0 (length 0; ID 120)
    [ 122/   0]   MSG    18:47:22.926250     SNS FRAMEWORK/Low          [   sns_suid_sensor.c   1050] send_suid_event dt=registry, default=1
    [ 123/   2]   MSG    18:47:22.926250     SNS PLATFORM/High          [   sns_gdsc_island.c    109] gdsc_client_cnt(2), sns_gdsc_mode(1)
    [ 122/   1]   MSG    18:47:22.926250     SNS FRAMEWORK/Medium       [sns_stream_service.c    150] Created data stream to Sensor 'timer' (b2118e08) from Sensor 'power_sensor' (b2922c78): b2931c48
    [ 122/   0]   MSG    18:47:22.926250     SNS FRAMEWORK/Low          [   sns_suid_sensor.c   1050] send_suid_event dt=registry, default=1
    [ 122/   1]   MSG    18:47:22.926250     SNS FRAMEWORK/Medium       [sns_stream_service.c    686] Add request b2123580 on stream b2931c48 (length 16; ID 512)
    [ 122/   0]   MSG    18:47:22.926250     SNS FRAMEWORK/Low          [sns_stream_service.c    548] Process request for Sensor b2118e08 on b2931c48
    [ 122/   0]   MSG    18:47:22.926250     SNS FRAMEWORK/Low          [   sns_suid_sensor.c   1050] send_suid_event dt=registry, default=1
    Copy to clipboard

有关单个传感器电平验证的更多信息，请参阅[工具](https://docs.qualcomm.com/doc/80-70018-7SC/topic/test_troubleshoot.html#test-tools)。

## 在平台上测试传感器

要使用传感器测试应用程序，请参阅[在平台上测试传感器](https://docs.qualcomm.com/doc/80-70018-7SC/topic/platform.html#test-sensors)。

## 排除传感器故障

以下资源描述了一些常见问题以及可用于分析和解决这些问题的技术。

Note

`<registry_path>` 应被视为设备上的现有路径之一：`/etc/sensors/registry/registry/` 或 `/var/cache/sensors/registry/registry/`。

### `ssc_sensor_info` 工具无法列出传感器

此错误表示解析传感器注册表失败，导致传感器无法使用 `ssc_sensor_info` 工具列出。执行以下操作来解决此错误：

> 
> 
> Note
> 
> 
> 验证用户模式下是否启用了文件的读写权限，组和其他模式下是否启用了只读权限。确保用户和组模式名称为 `system system`。
> 
> 1. 确保 `/etc/sensors/sns_reg_config` 和 `/etc/sensors/config/json.lst` 文件具有所需的权限，如以下示例所示：
> 
> 
> 
> 
> > 
> > 
> > root@qcm6490:~# ls -l /etc/sensors/sns_reg_config
> >     -rw-r--r--. 1 system system 226 Mar  9  2018 /etc/sensors/sns_reg_config
> >     Copy to clipboard
> > 
> > 
> > root@qcm6490:~# ls -l /etc/sensors/config/json.lst
> >     -rw-r--r--. 1 system system 1452 Mar 9  2018 /etc/sensors/config/json.lst
> >     Copy to clipboard
> 
> 
> 2. 确保 `/etc/sensors/config/` 目录包含具有所需权限的传感器 JSON 文件。
> 
> 
> 
> 
> > 
> > 
> > root@qcm6490:/etc/sensors/config# ls -l
> >     total 548
> >     -rw-r--r--. 1 system system 1452 Mar 9  2018 json.lst
> >     -rw-r--r--. 1 system system 5638 Mar 9  2018 kodiak_ak991x_0.json
> >     -rw-r--r--. 1 system system 2837 Mar 9  2018 kodiak_bu52053nvx_0.json
> >     -rw-r--r--. 1 system system 5480 Mar 9  2018 kodiak_default_sensors.json
> >     -rw-r--r--. 1 system system  293 Mar 9  2018 kodiak_dynamic_sensors.json
> >     -rw-r--r--. 1 system system  392 Mar 9  2018 kodiak_idp_ak991x_0.json
> >     -rw-r--r--. 1 system system  384 Mar 9  2018 kodiak_idp_lsm6dst_0.json
> >     -rw-r--r--. 1 system system  384 Mar 9  2018 kodiak_idp_lsm6dst_1.json
> >     ..
> >     -rw-r--r--. 1 system system  302 Mar 9  2018 qcm6490_power_0.json
> >     -rw-r--r--. 1 system system 7952 Mar 9  2018 qcm6490_rbx_icm4x6xx_0.json
> >     -rw-r--r--. 1 system system 5922 Mar 9  2018 qcm6490_rbx_navmez_ak991x_0.json
> >     -rw-r--r--. 1 system system 7957 Mar 9  2018 qcm6490_rbx_navmez_icm4x6xx_0.json
> >     -rw-r--r--. 1 system system 7957 Mar 9  2018 qcm6490_rbx_navmez_rev2_icm4x6xx_0.json
> >     -rw-r--r--. 1 system system 3688 Mar 9  2018 qcm6490_rbx_navmezz_icp101xx_0.json
> >     Copy to clipboard
> 
> 
> 3. 确保 `<registry_path>` 目录可访问并且包含相应的已解析文件。
> 
> 
> 
> 
> > 
> > 
> > root@qcm6490:/var/cache/sensors/registry/registry# ls -l
> >     total 524
> >     -rw-r--r--. 1 system system    3 Jan  1 00:00 DIR
> >     -rw-r--r--. 1 system system  902 Apr 28  2022 qcm6490_default_sensors.json.default_sensors
> >     -rw-r--r--. 1 system system   86 Apr 28  2022 qcm6490_default_sensors.json.default_sensors.accel
> >     -rw-r--r--. 1 system system  133 Apr 28  2022 qcm6490_default_sensors.json.default_sensors.accel.attr_0
> >     -rw-r--r--. 1 system system   90 Apr 28  2022 qcm6490_default_sensors.json.default_sensors.accel_cal
> >     ..
> >     -rw-r--r--. 1 system system   84 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.temp
> >     -rw-r--r--. 1 system system  232 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.temp.config
> >     -rw-r--r--. 1 system system  346 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform
> >     -rw-r--r--. 1 system system   95 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel
> >     -rw-r--r--. 1 system system  146 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel.fac_cal
> >     -rw-r--r--. 1 system system  183 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel.fac_cal.bias
> >     -rw-r--r--. 1 system system  445 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel.fac_cal.corr_mat
> >     -rw-r--r--. 1 system system  863 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.config
> >     Copy to clipboard

### SUID 查找失败

此错误表示检索指定传感器的 SUID 时自定义代码失败。执行以下操作来解决此错误：

> 
> 
> 1. 运行 `ssc_sensor_info` 工具检查指定的传感器是否可用。
> 
> 
> 
> 
> > 
> > 
> > - 如果传感器列表为空，请参见 [ssc\_sensor\_info 工具无法列出传感器](https://docs.qualcomm.com/doc/80-70018-7SC/topic/test_troubleshoot.html#troubleshooting-ssc-sensor-info)中描述的第一种调试方法。
> > - 如果仅指定的传感器不可用，请继续进行以下检查：
> > 
> > 
> > 
> > 
> > > 
> > > 
> > > 1. 确保传感器在 `/etc/sensors/config/json.lst` 文件中列出，如下例所示：
> > > 
> > > 
> > > 
> > > 
> > > > 
> > > > 
> > > > root@qcm6490:~# cat /etc/sensors/config/json.lst
> > > >     kodiak_ak991x_0.json
> > > >     qcm6490_default_sensors.json
> > > >     qcm6490_power_0.json
> > > >     qcm6490_rbx_icm4x6xx_0.json
> > > >     qcm6490_rbx_navmez_icm4x6xx_0.json
> > > >     qcm6490_rbx_navmezz_icp101xx_0.json
> > > >     qcm6490_rbx_navmez_ak991x_0.json
> > > >     Copy to clipboard
> > > 
> > > 
> > > 2. 验证指定传感器的配置文件是否已解析并存在于 `parsed_file_list.csv` 文件中，如以下示例所示：
> > > 
> > > 
> > > 
> > > 
> > > > 
> > > > 
> > > > root@qcm6490:/var/cache/sensors/registry# cat parsed_file_list.csv
> > > >     qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.config
> > > >     qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.orient
> > > >     qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.gyro.fac_cal.corr_mat
> > > >     qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.gyro.fac_cal.bias
> > > >     qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.gyro.fac_cal
> > > >     qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.gyro
> > > >     qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel.fac_cal.corr_mat
> > > >     qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel.fac_cal.bias
> > > >     qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel.fac_cal
> > > >     qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel
> > > >     Copy to clipboard
> > > 
> > > 
> > > 3. 验证指定传感器的配置文件是否已解析并存在于 `<registry_path>` 目录中，如下例所示：
> > > 
> > > 
> > > 
> > > 
> > > > 
> > > > 
> > > > root@qcm6490:/var/cache/sensors/registry/registry# ls -l
> > > >     total 524
> > > >     -rw-r--r--. 1 system system  248 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0
> > > >     -rw-r--r--. 1 system system   85 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.accel
> > > >     -rw-r--r--. 1 system system  233 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.accel.config
> > > >     -rw-r--r--. 1 system system   88 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.freefall
> > > >     -rw-r--r--. 1 system system  236 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.freefall.config
> > > >     -rw-r--r--. 1 system system   84 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.gyro
> > > >     -rw-r--r--. 1 system system  232 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.gyro.config
> > > >     -rw-r--r--. 1 system system   82 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.md
> > > >     -rw-r--r--. 1 system system  230 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.md.config
> > > >     -rw-r--r--. 1 system system   84 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.temp
> > > >     -rw-r--r--. 1 system system  232 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0.temp.config
> > > >     -rw-r--r--. 1 system system  346 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform
> > > >     -rw-r--r--. 1 system system   95 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel
> > > >     -rw-r--r--. 1 system system  146 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel.fac_cal
> > > >     -rw-r--r--. 1 system system  183 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel.fac_cal.bias
> > > >     -rw-r--r--. 1 system system  445 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.accel.fac_cal.corr_mat
> > > >     -rw-r--r--. 1 system system  863 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.config
> > > >     -rw-r--r--. 1 system system   94 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.gyro
> > > >     -rw-r--r--. 1 system system  145 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.gyro.fac_cal
> > > >     -rw-r--r--. 1 system system  182 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.gyro.fac_cal.bias
> > > >     -rw-r--r--. 1 system system  444 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.gyro.fac_cal.corr_mat
> > > >     -rw-r--r--. 1 system system   91 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.md
> > > >     -rw-r--r--. 1 system system  192 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.md.config
> > > >     -rw-r--r--. 1 system system  174 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.orient
> > > >     -rw-r--r--. 1 system system  536 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.placement
> > > >     -rw-r--r--. 1 system system   94 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.temp
> > > >     -rw-r--r--. 1 system system  142 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.temp.fac_cal
> > > >     -rw-r--r--. 1 system system  102 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.temp.fac_cal.bias
> > > >     -rw-r--r--. 1 system system  103 Apr 28  2022 qcm6490_rbx_navmez_icm4x6xx_0.json.icm4x6xx_0_platform.temp.fac_cal.scale
> > > >     Copy to clipboard
> 
> 
> 2. 如果前面的验证没有导致任何异常，则您自己的使用 QSH 客户端 API 的应用程序端自定义代码实现可能存在问题。

### 传感器已列出但无法接收传感器数据

此错误表示示例代码或自定义代码失败，请使用以下传感器工具接收指定传感器的事件。

> 
> 
> - 运行以下命令对指定传感器进行流传输：
>     - `see_workhorse [-sensor=][-sample_rate=] [-batch_period=] [-calibrated=<0 | 1>] [-wakeup=<0 | 1>]` 例如，`see_workhorse -sensor=accel -sample_rate=max -duration=30 -display_events=1`

如果上述工具能够接收到传感器事件，则可能是您自己的应用端自定义代码实现中使用 QSH 客户端 API 时出现了问题。

有关更多信息，请参阅[工具](https://docs.qualcomm.com/doc/80-70018-7SC/topic/test_troubleshoot.html#test-tools)。

Last Published: Apr 26, 2025

[Previous Topic
开发传感器](https://docs.qualcomm.com/bundle/publicresource/80-70018-7SC/topics/develop_sensors.md) [Next Topic
参考资料](https://docs.qualcomm.com/bundle/publicresource/80-70018-7SC/topics/references.md)