求助:LD-350雷电探测器USB连接仅短时间输出详细数据
问题:LD-350雷电探测器无法持续输出详细数据(无需物理上电)
问题描述
在Ubuntu 20.04上通过USB连接LD-350雷电探测器开发时,遇到以下问题:
- 仅在物理拔插设备电源线后,才能读取到完整的详细有效数据;单独拔插USB线无效果。
- 尝试通过代码发送
RESET命令重置设备,但未生效。 - 设备持续连接时,多数情况下仅发送
[49, 96]这类简单重复的数据数组;重新上电后会输出所需的复杂详细数据,但该状态仅能维持一段时间,之后又恢复为简单输出。
典型输出(非期望)
Data read from device: array('B', [49, 96]) array('B', [49, 96]) array('B', [49, 96])
期望输出(设备重新上电后立即输出)
Data read from device: array('B', [49, 96, 58, 82, 69, 83, 69, 84, 13, 10, 58, 86, 69, 82, 32, 76, 68, 51, 53, 48, 45, 86, 49, 46, 49, 51, 13, 10]) array('B', [49, 96, 58, 76, 84, 83, 51, 32, 48, 13, 10]) array('B', [49, 96, 58, 87, 73, 77, 76, 73, 44, 50, 53, 52, 44, 52, 49, 55, 44, 49, 50, 52, 46, 53, 42, 53, 66, 13, 10])
环境配置
OS: Ubuntu 20.04 Language: Python 3.8 Libraries: PyUSB
已尝试的操作
- 通过USB发送
RESET和RAW 1命令,模拟重新连接初始化; - 使用
dmesg监控设备状态,仅能看到设备被识别,无数据处理细节; - 用Wireshark捕获USB数据包,但不确定需排查哪些内容。
现有代码
import usb.core import usb.util import sys import time # Setup and find the device dev = usb.core.find(idVendor=0x0403, idProduct=0xf241) if dev is None: print('Device not found') sys.exit(1) if dev.is_kernel_driver_active(0): dev.detach_kernel_driver(0) dev.set_configuration() # Send RESET and RAW commands dev.write(1, 'RESET\r'.encode()) dev.write(1, 'RAW 1\r'.encode()) # Read data from the device endpoint = dev[0][(0,0)][0] while True: try: data = dev.read(endpoint.bEndpointAddress, endpoint.wMaxPacketSize) print('Data read from device:', data) except usb.core.USBError as e: print('Error:', e)
求助
如何让设备无需物理重新上电,就能持续输出详细数据?这类USB设备是否有我遗漏的特定设置或初始化序列?
内容的提问来源于stack exchange,提问作者Shyam BHAGAT
相关产品推荐
相关产品推荐

