Skip to content

huawei-ups2000: USB and serial ports work on Linux but not on Windows (file locking) #3244

@Jason-2048

Description

@Jason-2048

Summary

I am reporting a reproducible issue with the huawei-ups2000 driver on Windows.

The same UPS (Huawei UPS2000-A-1KTTS) and NUT version (2.8.4 development) work correctly on Linux (kernel >= 5.12),
but communication consistently fails on Windows when using the USB interface based on XR21V1410 (USB-to-UART).

This appears to be related to Modbus RTU timing / serial backend behavior on Windows.


Environment

UPS model:

  • Huawei UPS2000-A-1KTTS

NUT version:

  • 2.8.4 development (2.8.4.1059-1059+g8989fdaa2)

Connection:

  • USB interface (XR21V1410 USB UART)
  • Windows 10 x64

Driver:

  • huawei-ups2000 (libmodbus-based)

Linux (WORKING)

  • Kernel: Linux 5.12+
  • Device: /dev/ttyUSB0
  • Configuration:
[huawei]
driver = huawei-ups2000
port = /dev/ttyUSB0

Command:
upsc huawei
Result:

battery.capacity: 9
battery.charge: 100.0
battery.charger.status: charging
battery.packs: 2
battery.runtime: 2524
battery.voltage: 27.3
device.mfr: Huawei
device.model: UPS2000A
device.serial: /
device.type: ups
driver.debug: 0
driver.flag.allow_killpower: 0
driver.name: huawei-ups2000
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/ttyUSB0
driver.parameter.synchronous: auto
driver.state: quiet
driver.version: 2.8.2
driver.version.internal: 0.06
input.bypass.frequency: 50.0
input.bypass.voltage: 236.7
input.frequency: 50.0
input.voltage: 236.7
output.current: 0.7
output.frequency: 50.0
output.power: 100.0
output.realpower: 100.0
output.voltage: 220.0
ups.beeper.status: enabled
ups.delay.reboot: 60
ups.delay.shutdown: 60
ups.delay.start: 60
ups.firmware: V2R1C1SPC50
ups.firmware.aux: P1.0-D1.0
ups.load: 18.0
ups.mfr: Huawei
ups.model: UPS2000A
ups.power.nominal: 1000
ups.serial: /
ups.status: OL CHRG
ups.temperature: 19.8
ups.timer.reboot: -1
ups.timer.shutdown: -1
ups.timer.start: -1
ups.type: online

Windows (NOT WORKING)

  • COM port detected correctly in Device Manager as COM4
  • NUT executables (upsdrvctl, upsd, upsc) installed under C:\Software\nut\mingw64\bin

Behavior:

upsdrvctl.exe -DDDD start
...
w32_serial_open (\.\COM4)
setting initial state on \.\COM4
modbus_connect: unable to connect: No error
Driver failed to start (exit status=1)
  • Driver fails to connect via Modbus RTU
  • upsc reports:
upscli_tryconnect: Connection to host timed out: '::1'
Error: Connection failure: Unknown error

Analysis:

  • Driver can open COM4, but Modbus RTU communication fails
  • Linux works thanks to kernel USB-serial handling (xr_serial / tty layer)
  • Windows serial backend cannot satisfy Modbus RTU timing requirements (frame spacing / half-duplex)
  • This prevents the driver from starting, so upsd is never running, causing upsc to timeout

Reference documentation:


Request

Could the NUT project consider:

  1. Adding a clear note in documentation about XR21V1410 / Windows limitation?
  2. Exploring a possible Windows-specific workaround for Modbus RTU timing?
  3. Or suggesting alternative approaches (like SNMP or Linux master) to monitor Huawei UPS2000?

I am willing to provide additional debug logs or help test any patches.


Additional notes:

  • The problem is not configuration-related; basic dummy-ups driver works fine on Windows
  • The issue only appears with XR21V1410 USB-serial + huawei-ups2000 driver

Note: This issue template was prepared with guidance from ChatGPT.

Metadata

Metadata

Assignees

No one assigned

    Labels

    USBWindows-not-on-par-with-POSIXAspect of Windows builds known to be dysfunctional compared to POSIX builds; fix needed to be on parimpacts-release-2.8.4Issues reported against NUT release 2.8.4 (maybe vanilla or with minor packaging tweaks)modbusportabilityWe want NUT to build and run everywhere possibleserial port

    Type

    No type

    Projects

    Status

    Done

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions