为何已接入的LS2208扫码枪未出现在PosExplorer.GetDevices()列表中
LS2208扫码枪接入异常记录
已完成的配置验证
- 已将LS2208扫码枪通过USB接入电脑,对照手册扫描对应配置条码切换工作模式
- 已验证的可正常工作的模式:
USB HID KeyboardOPOS (IBM Hand-held with Full Disable)
以上两种模式下,扫码枪可正常将条码内容输入到文本文档
- 扫码枪支持的全量配置模式列表:
USB HID KeyboardIMB Table Top USBIBM Hand-Held USBOPOS (IBM Hand-held with Full Disable)Simple COM Port Emulation
异常1:POS框架无法枚举到实体扫码枪
枚举扫描设备的代码逻辑:
explorer = new PosExplorer(); scannerList = new ArrayList(explorer.GetDevices("Scanner"));
代码执行后返回的设备列表存在固定特征:即便未接入任何外接扫码硬件,列表也始终仅存在两款虚拟扫码设备,无实体设备枚举记录:
// 第一款虚拟设备 Service Object Name: Microsoft Scanner Simulator Description: Simulated service object for scanner Manufacturer: Microsoft Corporation Type: Scanner Service Object Version: 1.14.1.0 UPOS Version: 1.14 Compatibility: CompatibilityLevel1 Hardware Description: Hardware Id: Hardware Path: Default: False
// 第二款虚拟设备 Service Object Name: Example Scanner Logical Names: Description: Service object for Example scanner Manufacturer: Microsoft Corporation Type: Scanner Service Object Version: 1.14.1.0 UPOS Version: 1.14 Compatibility: CompatibilityLevel1 Hardware Description: Hardware Id: Hardware Path: Default: False
尝试连接上述任意一款虚拟设备时,会抛出异常:
调用
Open()方法前,必须由服务对象定义DevicePath属性的值
异常2:COM口模拟模式未生成对应系统串口
原本预期Simple COM Port Emulation模式会将扫码枪模拟为标准系统串口输入设备,但切换到该模式后,系统串口列表中未出现对应设备。
枚举系统串口的代码逻辑:
System.IO.Ports.SerialPort.GetPortNames();
内容的提问来源于stack exchange,提问作者KalAnd
相关产品推荐
相关产品推荐

