You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu下Node.js用USB库连打印机遇LIBUSB_ERROR_BUSY问题求助

Node.js USB库连接打印机报错LIBUSB_ERROR_BUSY求助

我在Ubuntu 22.04.4 LTS系统上,尝试用Node.js的USB库连接Pantum M6550NW系列打印机(USB ID 232b:5e20)打印条形码,但始终遇到错误:
Error: claimInterface error: Error: LIBUSB_ERROR_BUSY

无论是使用WebUSB设备还是普通USB设备,都会触发这个错误。调用isKernalDriverActive()返回false,但libusb依然提示设备正忙,我找不到解决方向。

之前遇到过LIBUSB_ERROR_ACCESS错误,已经自行解决。但现在如果调用deviceInterface.detachKernelDriver()后再调用deviceInterface.attachKernelDriver(),会抛出新错误:LIBUSB_ERROR_NOT_FOUND。

相关代码如下:

const usb = require('usb');

(async () => {
    const device = usb.findByIds(0x232b, 0x5e20);
    
    const webDevice = await usb.WebUSBDevice.createInstance(device);

    if (webDevice) {
        console.log(webDevice); // WebUSB device
    }

    await webDevice.open();
    await webDevice.selectConfiguration(1);
    await webDevice.claimInterface(0)
})();

终端执行lsusb命令输出:

Bus 002 Device 002: ID 174c:3074 ASMedia Technology Inc. ASM1074 SuperSpeed hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 174c:2074 ASMedia Technology Inc. ASM1074 High-Speed hub
Bus 001 Device 005: ID 320f:5055 Evision RGB Keyboard
Bus 001 Device 003: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 001 Device 013: ID 232b:5e20 Pantum Ltd. M6550NW series
Bus 001 Device 002: ID 1ea7:0064 SHARKOON Technologies GmbH 2.4GHz Wireless rechargeable vertical mouse [More&Better]
Bus 001 Device 007: ID 8087:0026 Intel Corp. AX201 Bluetooth
Bus 001 Device 006: ID 0b05:19af ASUSTek Computer, Inc. AURA LED Controller
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

内容的提问来源于stack exchange,提问作者Ramazan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 13:53:27