nut icon indicating copy to clipboard operation
nut copied to clipboard

`apcmicrolink`: trouble starting for SMX1500RM2U

Open jimklimov opened this issue 3 months ago • 53 comments

Reflecting from "Apcupsd-users" mailing list: https://sourceforge.net/p/apcupsd/mailman/message/59379626/ discussion. Notable part about experiments with the new driver (it may well be that this is not the correct one for this device, but it got pretty far in the attempt to connect - so IMHO worth following up to investigate if this recently developed driver can indeed talk to that device after a few fixes here and there):

root@SERVER4:/mnt/user/logs/apc-source# /usr/local/ups/bin/apcmicrolink -s test -x port=auto -u root -D -D -D -D

   0.000000     [D3] setproctag: starting first tagging as 'apcmicrolink'...
   0.000029     [D3] getprocname: /proc is an accessible directory, investigating
   0.000043     [D3] getprocname: located symlink for PID 42160 at: /proc/42160/exe
   0.000055     [D1] getprocname: determined process name for PID 42160: /usr/local/ups/bin/apcmicrolink
Network UPS Tools 2.8.5.1051-1051+g0d949e373 (development iteration after 2.8.5) - APC Microlink protocol driver 0.02
Warning: This is an experimental driver.
Some features may not function correctly.

   0.000095     [D1:apcmicrolink] Using USB implementation: libusb-1.0.30 (API: 0x0100010C)
   0.000101     [D3:apcmicrolink] main_arg: var='port' val='auto'
   0.000104     [D1:apcmicrolink] Built-in default or configured user for drivers 'nut' was ignored due to 'root' specified on command line

   0.000111     [D1] Network UPS Tools version 2.8.5.1051-1051+g0d949e373 (development iteration after 2.8.5), 64-bit build for x86_64, built with gcc (GCC) 15.3.0 and configured with flags: --prefix=/usr/local/ups --with-usb=libusb-1.0 --without-snmp

   0.000118     [D1:test] debug level is '4'
   0.001021     [D1:test] Succeeded to become_user(root): now UID=0 GID=0
   0.001039     [D1:test] Signalling UPS [test]: driver.exit (quietly, no fuss if no driver is running or responding)
   0.001048     Can't open /var/state/ups/apcmicrolink-test: No such file or directory
   0.001053     [D1:test] Request for other driver to exit returned code -1
   0.001057     [D1:test] Socket dialog with the other driver instance (may be absent) failed: Success

   0.002289     [D2:test] Checking device 1 of 9 (8087/8000)
   0.002308     [D2:test] - VendorID: 8087
   0.002311     [D2:test] - ProductID: 8000
   0.002313     [D2:test] - Manufacturer: unknown
   0.002316     [D2:test] - Product: unknown
   0.002317     [D2:test] - Serial Number: unknown
   0.002320     [D2:test] - Bus: 001
   0.002321     [D2:test] - Bus Port: 001
   0.002324     [D2:test] - Device: 002
   0.002327     [D2:test] - Device release number: 0005
   0.002329     [D2:test] Trying to match device
   0.002332     [D3:test] match_function_regex: matching a device...
   0.002336     [D3:test] is_usb_device_supported: checking if this driver can support USB device VID:PID 0x8087:0x8000
   0.002339     [D4:test] is_usb_device_supported: checking table entry for VID:PID 0x051D:0x0003 (custom init handler is NOT available)
   0.002344     [D4:test] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.002346     [D2:test] Device does not match - skipping

   0.002355     [D2:test] Checking device 2 of 9 (1D6B/0002)
   0.002362     [D1:test] nut_libusb_open: invalid libusb bus number 0
   0.002456     [D2:test] - VendorID: 1d6b
   0.002460     [D2:test] - ProductID: 0002
   0.002462     [D2:test] - Manufacturer: Linux 6.18.38-Unraid ehci_hcd
   0.002465     [D2:test] - Product: EHCI Host Controller
   0.002468     [D2:test] - Serial Number: 0000:00:1d.0
   0.002470     [D2:test] - Bus: 001
   0.002473     [D2:test] - Bus Port: unknown
   0.002475     [D2:test] - Device: 001
   0.002477     [D2:test] - Device release number: 0618
   0.002480     [D2:test] Trying to match device
   0.002483     [D3:test] match_function_regex: matching a device...
   0.002486     [D3:test] is_usb_device_supported: checking if this driver can support USB device VID:PID 0x1D6B:0x0002
   0.002489     [D4:test] is_usb_device_supported: checking table entry for VID:PID 0x051D:0x0003 (custom init handler is NOT available)
   0.002493     [D4:test] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.002496     [D2:test] Device does not match - skipping

   0.002503     [D2:test] Checking device 3 of 9 (8087/8008)
   0.002512     [D2:test] - VendorID: 8087
   0.002514     [D2:test] - ProductID: 8008
   0.002517     [D2:test] - Manufacturer: unknown
   0.002519     [D2:test] - Product: unknown
   0.002522     [D2:test] - Serial Number: unknown
   0.002524     [D2:test] - Bus: 003
   0.002527     [D2:test] - Bus Port: 001
   0.002529     [D2:test] - Device: 002
   0.002531     [D2:test] - Device release number: 0005

(repeats)

# FINDS THE APC DEVICE AND ALMOST MAKES IT:

   0.002770     [D2:test] Checking device 6 of 9 (051D/0003)
   0.003553     [D2:test] - VendorID: 051d
   0.003560     [D2:test] - ProductID: 0003
   0.003562     [D2:test] - Manufacturer: American Power Conversion
   0.003565     [D2:test] - Product: Smart-UPS X 1500 FW:COM 03.8 / UPS 03.8
   0.003568     [D2:test] - Serial Number: AS1119121977
   0.003571     [D2:test] - Bus: 002
   0.003573     [D2:test] - Bus Port: 009
   0.003576     [D2:test] - Device: 003
   0.003580     [D2:test] - Device release number: 0106
   0.003582     [D2:test] Trying to match device
   0.003585     [D3:test] match_function_regex: matching a device...
   0.003588     [D3:test] is_usb_device_supported: checking if this driver can support USB device VID:PID 0x051D:0x0003
   0.003591     [D4:test] is_usb_device_supported: checking table entry for VID:PID 0x051D:0x0003 (custom init handler is NOT available)
   0.003596     [D4:test] is_usb_device_supported: POSSIBLY_SUPPORTED: known vendor ID at least
   0.003599     [D4:test] is_usb_device_supported: SUPPORTED: known vendor and product IDs
   0.003602     [D2:test] Device matches

   0.003604     [D2:test] Reading configuration descriptor 1 of 1
   0.003610     [D3:test] libusb_kernel_driver_active() returned 0: Success
   0.003624     [D2:test] Claimed interface 0 successfully
   0.003627     [D3:test] nut_libusb_set_altinterface: skipped libusb_set_interface_alt_setting(udev, 0, 0)

   0.003736     [D2:test] Retrieved HID descriptor (expected 9, got 9)
   0.003745     [D3:test] HID descriptor, method 1: (9 bytes) => 09 21 00 01 21 01 22 a9 01
   0.003748     [D3:test] HID descriptor length (method 1) 425
   0.003750     [D4:test] i=0, extra[i]=09, extra[i+1]=21
   0.003753     [D3:test] HID descriptor, method 2: (9 bytes) => 09 21 00 01 21 01 22 a9 01
   0.003756     [D3:test] HID descriptor length (method 2) 425
   0.003758     [D2:test] Trying HID descriptor length 425

   0.004555     [D1:test] microlink_usb: HID PDC status fallback available (PresentStatus on Report 0x07)
   0.004560     [D1:test] microlink_usb: found HID tunnel: Output Report 0x90, Input Report 0x89
   0.004563     [D2:test] Report descriptor retrieved (Reportlen = 425)

   0.004566     [D2:test] Found HID device

   0.004569     [D3:test] Using default, detected or customized USB HID numbers: usb_config_index=0 usb_hid_rep_index=0 usb_hid_desc_index=0 usb_hid_ep_in=1 usb_hid_ep_out=1

   0.004579     [D1:test] microlink_usb: opened American Power Conversion /Smart-UPS X 1500 FW:COM 03.8 / UPS 03.8 (USB 051d:0003)

   0.024874     [D2:test] nut_libusb_get_interrupt: Connection timed out

   0.024907     [D2:test] microlink TX ctrl: (1 bytes) => fd
   0.036884     [D2:test] microlink RX record: (19 bytes) => 00 0a 10 9a 00 0b 05 09 00 01 00 48 00
   0.036919     [D2:test]  f8 02 fe 04 29 c1
   0.036929     [D2:test] microlink: page0 version=10 width=16 pages=154 flags=0x09
   0.036939     [D2:test] microlink TX ctrl: (1 bytes) => fe
   0.069042     [D2:test] microlink: skipped 44 stray byte(s) before record 0x00
   0.069079     [D2:test] microlink RX record: (19 bytes) => 00 0a 10 9a 00 0b 05 09 00 01 00 48 00
   0.069088     [D2:test]  f8 02 fe 04 29 c1
   0.069096     [D2:test] microlink: page0 version=10 width=16 pages=154 flags=0x09
   0.069105     [D2:test] microlink TX ctrl: (1 bytes) => fe
   0.085037     [D2:test] microlink: skipped 44 stray byte(s) before record 0x01
   0.085075     [D2:test] microlink RX record: (19 bytes) => 01 fe 08 3e fc 02 fb 00 41 f8 03 31 fc
   0.085084     [D2:test]  02 fb 00 1f 35 01
   0.085093     [D2:test] microlink TX ctrl: (1 bytes) => fe
   0.101039     [D2:test] microlink: skipped 44 stray byte(s) before record 0x02
   0.101077     [D2:test] microlink RX record: (19 bytes) => 02 ff 02 ff fe 05 48 19 f8 03 2e fa 0e
   0.101085     [D2:test]  42 ff ff f9 5a cc
   0.101094     [D2:test] microlink TX ctrl: (1 bytes) => fe
   0.117036     [D2:test] microlink: skipped 44 stray byte(s) before record 0x03
   0.117073     [D2:test] microlink RX record: (19 bytes) => 03 06 6b ff f8 03 2c fa 02 da ff ff f9
   0.117082     [D2:test]  00 b7 ff f8 9a 46
   0.117090     [D2:test] microlink TX ctrl: (1 bytes) => fe
   0.133038     [D2:test] microlink: skipped 44 stray byte(s) before record 0x04
   0.133075     [D2:test] microlink RX record: (19 bytes) => 04 03 2d fa 01 6d ff ff f9 00 0e ff ff
   0.133084     [D2:test]  f8 04 fe 0e 26 2a

(repeats last)

   9.165295     [D2:test] microlink TX ctrl: (1 bytes) => fe
  10.173224     [D2:test] nut_libusb_get_interrupt: Connection timed out
  10.173260     [D2:test] microlink TX ctrl: (1 bytes) => fe
  11.181270     [D2:test] nut_libusb_get_interrupt: Connection timed out
  11.181299     apcmicrolink: failed to start Microlink session on auto (no standard-HID fallback available on this device either)
  11.181545     [D3:test] procname_cleanup: starting for: myProcName=[/usr/local/ups/bin/apcmicrolink] myProcBaseName=[apcmicrolink] proctag=[test] proctag_lib=[(null)]
  11.181571     [D3:test] proctag_cleanup:  starting for: myProcName=[/usr/local/ups/bin/apcmicrolink] myProcBaseName=[apcmicrolink] proctag=[test] proctag_lib=[(null)]
  11.181588     [D2:test] a apcmicrolink sub-process (test) is exiting now
  11.181605     [D1] upsnotify: failed to notify about state NOTIFY_STATE_STOPPING: no notification tech defined, will not spam more about it
  11.181621     [D1] On systems without service units, consider `export NUT_QUIET_INIT_UPSNOTIFY=true`
  11.181633     [D1] sock_close: starting...
  11.181638     [D1] sock_close: finished
  11.181649     [D1] exit_cleanup: finished, exiting

The original poster is okay with custom-building NUT to make this work.

CC @libschmudie-so as author of PR #3406 introducing the driver CC @nmbro as author of PR #3579 adding USB HID fallback

jimklimov avatar Aug 26 '26 17:08 jimklimov

I have seen the same behavior - it seems that my testing was a combination of super lucky, and unlucky in regards to the usb packet timings

I'm working on a more stable usb tunnel mechanism - but I'm stilling falling into either a lock-out, or lock-up or some sort of oddity in the state machine of the firmware; since the usb device will stop responding to the microlink requests flat out, and the only reset is to unplug the usb cable, and plug it back in again

nmbro avatar Aug 26 '26 19:08 nmbro

I did notice apcmicrolink: failed to start Microlink session on auto (no standard-HID fallback available on this device either)

which could very well indicate that this device exposes one of those usb-to-serial/uart chips internally, that would check out why it would try a HID tunnel, since usb-to-serial would still be a HID

I might want to add some error handling for that, since I'm pretty sure that if it's a serial or usb-serial device, then the apcmicrolink-usb driver will not work at least.

nmbro avatar Aug 26 '26 19:08 nmbro

I'm the OP from that maillist thread, I was way over my head trying but I got close it felt like. Using ChatGPT was the only way I coudl have done it. It is an older UPS but still works fine, I just needed some more control over how the UPS is shut down. Was trying to use NUT and MicroLink ot ge tthat control. I managed to hack Powerchute and install it on an (non RPM based) Unraid (Slackware) server, and I could tell from PowerChute's own logs that it was communicating via MicroLink. After an ongoing a few days as a masochist? I decided I hadn' thad enough and decided to try to sniff it. I compiled a custom kernel to enable MODUSB, and I captured the USB data from a sequence: Powerchute daemon startup, web UI login, UI check info, and then stopped the capture. If anyone wants that capture let me know. About 700+ lines that look like this. There's some issue about 44 bytes that aren't matching the stream or something. I had finally had enough and gave up.

ffff8881043a1240 709576254 S Bo:2:002:2 -115 31 = 55534243 87320000 00000000 00000600 00000000 00000000 00000000 000000
ffff8881043a1240 709576323 C Bo:2:002:2 0 31 >
ffff8881043a1240 709576361 S Bi:2:002:1 -115 13 <
ffff8881043a1240 709576430 C Bi:2:002:1 0 13 = 55534253 87320000 00000000 00
ffff8881043a1240 711624232 S Bo:2:002:2 -115 31 = 55534243 88320000 00000000 00000600 00000000 00000000 00000000 000000
ffff8881043a1240 711624288 C Bo:2:002:2 0 31 >
ffff8881043a1240 711624308 S Bi:2:002:1 -115 13 <
ffff8881043a1240 711624412 C Bi:2:002:1 0 13 = 55534253 88320000 00000000 00
ffff8881043a1240 713672266 S Bo:2:002:2 -115 31 = 55534243 89320000 00000000 00000600 00000000 00000000 00000000 000000
ffff8881043a1240 713672363 C Bo:2:002:2 0 31 >
ffff8881043a1240 713672425 S Bi:2:002:1 -115 13 <
ffff8881043a1240 713672502 C Bi:2:002:1 0 13 = 55534253 89320000 00000000 00
ffff8881043a1240 715720247 S Bo:2:002:2 -115 31 = 55534243 8a320000 00000000 00000600 00000000 00000000 00000000 000000
ffff8881043a1240 715720331 C Bo:2:002:2 0 31 >
ffff8881043a1240 715720394 S Bi:2:002:1 -115 13 <
ffff8881043a1240 715720462 C Bi:2:002:1 0 13 = 55534253 8a320000 00000000 00
ffff8881043a1240 717768293 S Bo:2:002:2 -115 31 = 55534243 8b320000 00000000 00000600 00000000 00000000 00000000 000000
ffff8881043a1240 717768359 C Bo:2:002:2 0 31 >
ffff8881043a1240 717768384 S Bi:2:002:1 -115 13 <
ffff8881043a1240 717768500 C Bi:2:002:1 0 13 = 55534253 8b320000 00000000 00
ffff8881043a1240 719816242 S Bo:2:002:2 -115 31 = 55534243 8c320000 00000000 00000600 00000000 00000000 00000000 000000
ffff8881043a1240 719816296 C Bo:2:002:2 0 31 >
ffff8881043a1240 719816327 S Bi:2:002:1 -115 13 <
ffff8881043a1240 719816427 C Bi:2:002:1 0 13 = 55534253 8c320000 00000000 00
ffff8881043a1240 721864292 S Bo:2:002:2 -115 31 = 55534243 8d320000 00000000 00000600 00000000 00000000 00000000 000000
ffff8881043a1240 721864374 C Bo:2:002:2 0 31 >
ffff8881043a1240 721864436 S Bi:2:002:1 -115 13 <
ffff8881043a1240 721864504 C Bi:2:002:1 0 13 = 55534253 8d320000 00000000 00
ffff8881043a1240 723912078 S Bo:2:002:2 -115 31 = 55534243 8e320000 00000000 00000600 00000000 00000000 00000000 000000
ffff8881043a1240 723912111 C Bo:2:002:2 0 31 >
ffff8881043a1240 723912116 S Bi:2:002:1 -115 13 <
ffff8881043a1240 723912226 C Bi:2:002:1 0 13 = 55534253 8e320000 00000000 00
ffff888105202240 724116125 S Ii:2:003:1 -115:8 64 <
ffff8881052023c0 724167134 S Ci:2:003:0 s a1 01 010c 0000 0040 64 <

getgray avatar Aug 27 '26 00:08 getgray

That data there is not microlink data at all

but yeah the initial data you posted before, that's microlink data.

The reason it's failing is because the usb-timing is off; I have had the same issue with my ups

I'm working on a fix for that, it's available on my fork here: https://github.com/nmbro/nut/tree/apcmicrolink-usb I will merge it when I have tested the stability and cleaned up my changes

so far that iteration is looking a lot more stable

nmbro avatar Aug 27 '26 13:08 nmbro

Nicolai, thank you. Fingers crossed you can work it out.

Meanwhile, FWIW, that capture data I posted was just the start of it. I gathered later that maybe the whole file represents:

USB / HID Device Setup APC-Specific Pre-MicroLink Communication / Possible Session Initialization MicroLink HID Tunnel MicroLink Initial Request (0xFD) MicroLink Page Retrieval (0xFE → Records 0x00–0x99)

Maybe this is some of the microlink, starting near the end of the 7344 lines, @7188

ffff888105202300 767083729 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767089123 C Io:2:003:1 0:8 64 >
ffff888105202240 767097122 C Ii:2:003:1 0:8 64 = 8994ffff ffffffff ffffffff ffffffff ffff8ddd 00000000 00000000 00000000
ffff888105202240 767097171 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767107822 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767113123 C Io:2:003:1 0:8 64 >
ffff888105202240 767121120 C Ii:2:003:1 0:8 64 = 8995ffff ffffffff ffff0000 00000000 00007bee 00000000 00000000 00000000
ffff888105202240 767121169 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767131781 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767137124 C Io:2:003:1 0:8 64 >
ffff888105202240 767145115 C Ii:2:003:1 0:8 64 = 89960000 00000000 00000000 00000000 000069ff 00000000 00000000 00000000
ffff888105202240 767145160 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767155770 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767161118 C Io:2:003:1 0:8 64 >
ffff888105202240 767169121 C Ii:2:003:1 0:8 64 = 89970000 00000000 00000000 00000000 00005711 00000000 00000000 00000000
ffff888105202240 767169170 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767179818 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767185124 C Io:2:003:1 0:8 64 >
ffff888105202240 767193122 C Ii:2:003:1 0:8 64 = 8998a5a3 00000000 00000000 00000000 0012e625 00000000 00000000 00000000
ffff888105202240 767193171 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767203797 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767209124 C Io:2:003:1 0:8 64 >
ffff888105202240 767217120 C Ii:2:003:1 0:8 64 = 8999002a 00000000 00070016 00010001 aba34588 00000000 00000000 00000000
ffff888105202240 767217171 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767227759 S Io:2:003:1 0:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767233119 C Io:2:003:1 0:8 64 >
ffff888105202240 767241122 C Ii:2:003:1 0:8 64 = 89790067 00c26a08 8270006d 00c269a3 c948099e 00000000 00000000 00000000
ffff888105202240 767241172 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767251767 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767257076 C Io:2:003:1 0:8 64 >
ffff888105202240 767265123 C Ii:2:003:1 0:8 64 = 89840000 20020008 00000000 00041008 0000c76d 00000000 00000000 00000000
ffff888105202240 767265171 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767275789 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767281120 C Io:2:003:1 0:8 64 >
ffff888105202240 767289117 C Ii:2:003:1 0:8 64 = 898531c8 f1850001 1e581e00 2a00021e 80f85a55 00000000 00000000 00000000
ffff888105202240 767289161 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767299778 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767305125 C Io:2:003:1 0:8 64 >
ffff888105202240 767313123 C Ii:2:003:1 0:8 64 = 89860011 1e00049d 067006c3 c800157f 1e523f5b 00000000 00000000 00000000
ffff888105202240 767313171 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767323844 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767329125 C Io:2:003:1 0:8 64 >
ffff888105202240 767337123 C Ii:2:003:1 0:8 64 = 89870fb5 00000001 00000004 00000000 0000f0bd 00000000 00000000 00000000
ffff888105202240 767337171 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767347744 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767353122 C Io:2:003:1 0:8 64 >
ffff888105202240 767361124 C Ii:2:003:1 0:8 64 = 8988ffff 00000000 00000000 00000002 00005e17 00000000 00000000 00000000
ffff888105202240 767361197 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767371779 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767377120 C Io:2:003:1 0:8 64 >
ffff888105202240 767385124 C Ii:2:003:1 0:8 64 = 89890000 00000000 41530000 00000000 0000459c 00000000 00000000 00000000
ffff888105202240 767385172 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767395799 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767401125 C Io:2:003:1 0:8 64 >
ffff888105202240 767409126 C Ii:2:003:1 0:8 64 = 898a0000 01720000 00201620 06b91cc0 0000d33b 00000000 00000000 00000000
ffff888105202240 767409174 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767419808 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767425052 C Io:2:003:1 0:8 64 >
ffff888105202240 767433098 C Ii:2:003:1 0:8 64 = 898b0000 00000056 7ff20000 00000000 00002c7f 00000000 00000000 00000000
ffff888105202240 767433125 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767443541 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767449101 C Io:2:003:1 0:8 64 >
ffff888105202240 767457098 C Ii:2:003:1 0:8 64 = 898c0052 fb060000 00000000 00000000 0000e03e 00000000 00000000 00000000
ffff888105202240 767457125 S Ii:2:003:1 -115:8 64 <
ffff888105202300 767467540 S Io:2:003:1 -115:8 64 = 90fe0404 8f959a53 6cdf0000 00000000 00000000 00000000 00000000 00000000
ffff888105202300 767473101 C Io:2:003:1 0:8 64 >
ffff888105202240 767481100 C Ii:2:003:1 0:8 64 = 898d0000 00000000 abcd0000 00000000 0000a157 00000000 00000000 00000000
ffff888105202240 767481129 S Ii:2:003:1 -115:8 64 <

getgray avatar Aug 27 '26 15:08 getgray

I tried Nikolai's fork, just in case it worked as is. Got a few different responses, but still didn't make it:

root@SERVER4# /usr/local/ups/bin/apcmicrolink -s test -x port=auto -u root -D -D -D -D
0.000000 [D3] setproctag: starting first tagging as 'apcmicrolink'...
0.000030 [D3] getprocname: /proc is an accessible directory, investigating
0.000049 [D3] getprocname: located symlink for PID 201011 at: /proc/201011/exe
0.000067 [D1] getprocname: determined process name for PID 201011: /usr/local/ups/bin/apcmicrolink
Network UPS Tools 2.8.5.1-0+ge1bb723c7 (development iteration after 2.8.5) - APC Microlink protocol driver 0.02
Warning: This is an experimental driver.
Some features may not function correctly.

0.000131 [D1] Using USB implementation: libusb-1.0.30 (API: 0x0100010C)
0.000140 [D3] main_arg: var='port' val='auto'
0.000147 [D1] Built-in default or configured user for drivers 'nut' was ignored due to 'root' specified on command line
0.000153 [D1] Network UPS Tools version 2.8.5.1-0+ge1bb723c7 (development iteration after 2.8.5), 64-bit build for x86_64, built with gcc (GCC) 15.3.0 and configured with flags: --prefix=/usr/local/ups --with-usb=libusb-1.0 --without-snmp
0.000164 [D1] debug level is '4'
0.000427 [D1] Succeeded to become_user(root): now UID=0 GID=0
0.000443 [D1] Signalling UPS [test]: driver.exit (quietly, no fuss if no driver is running or responding)
0.000455 Can't open /var/state/ups/apcmicrolink-test: No such file or directory
0.000460 [D1] Request for other driver to exit returned code -1
0.000466 [D1] Socket dialog with the other driver instance (may be absent) failed: Success
0.001780 [D2] Checking device 1 of 9 (8087/8000)
0.001802 [D2] - VendorID: 8087
0.001807 [D2] - ProductID: 8000
0.001811 [D2] - Manufacturer: unknown
0.001815 [D2] - Product: unknown
0.001819 [D2] - Serial Number: unknown
0.001823 [D2] - Bus: 001
0.001827 [D2] - Bus Port: 001
0.001831 [D2] - Device: 002
0.001837 [D2] - Device release number: 0005
0.001841 [D2] Trying to match device
0.001847 [D3] match_function_regex: matching a device...
0.001853 [D3] is_usb_device_supported: checking if this driver can support USB device VID 0x8087:0x8000
0.001859 [D4] is_usb_device_supported: checking table entry for VID 0x051D:0x0003 (custom init handler is NOT available)
0.001867 [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
0.001872 [D2] Device does not match - skipping
0.001888 [D2] Checking device 2 of 9 (1D6B/0002)
0.001902 [D1] nut_libusb_open: invalid libusb bus number 0
0.002009 [D2] - VendorID: 1d6b
0.002016 [D2] - ProductID: 0002
0.002019 [D2] - Manufacturer: Linux 6.18.38-Unraid ehci_hcd
0.002023 [D2] - Product: EHCI Host Controller
0.002026 [D2] - Serial Number: 0000:00:1d.0
0.002029 [D2] - Bus: 001
0.002032 [D2] - Bus Port: unknown
0.002034 [D2] - Device: 001
0.002037 [D2] - Device release number: 0618
0.002041 [D2] Trying to match device
0.002045 [D3] match_function_regex: matching a device...
0.002050 [D3] is_usb_device_supported: checking if this driver can support USB device VID 0x1D6B:0x0002
0.002055 [D4] is_usb_device_supported: checking table entry for VID 0x051D:0x0003 (custom init handler is NOT available)
0.002064 [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
0.002073 [D2] Device does not match - skipping
0.002084 [D2] Checking device 3 of 9 (8087/8008)
0.002100 [D2] - VendorID: 8087
0.002106 [D2] - ProductID: 8008
0.002110 [D2] - Manufacturer: unknown
0.002114 [D2] - Product: unknown
0.002118 [D2] - Serial Number: unknown
0.002122 [D2] - Bus: 003
0.002126 [D2] - Bus Port: 001
0.002130 [D2] - Device: 002
0.002135 [D2] - Device release number: 0005
0.002139 [D2] Trying to match device
0.002144 [D3] match_function_regex: matching a device...
0.002149 [D3] is_usb_device_supported: checking if this driver can support USB device VID 0x8087:0x8008
0.002155 [D4] is_usb_device_supported: checking table entry for VID 0x051D:0x0003 (custom init handler is NOT available)
0.002164 [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
0.002168 [D2] Device does not match - skipping
0.002178 [D2] Checking device 4 of 9 (1D6B/0002)
0.002191 [D1] nut_libusb_open: invalid libusb bus number 0
0.002288 [D2] - VendorID: 1d6b
0.002293 [D2] - ProductID: 0002
0.002297 [D2] - Manufacturer: Linux 6.18.38-Unraid ehci_hcd
0.002301 [D2] - Product: EHCI Host Controller
0.002304 [D2] - Serial Number: 0000:00:1a.0
0.002307 [D2] - Bus: 003
0.002311 [D2] - Bus Port: unknown
0.002314 [D2] - Device: 001
0.002318 [D2] - Device release number: 0618
0.002321 [D2] Trying to match device
0.002325 [D3] match_function_regex: matching a device...
0.002329 [D3] is_usb_device_supported: checking if this driver can support USB device VID 0x1D6B:0x0002
0.002334 [D4] is_usb_device_supported: checking table entry for VID 0x051D:0x0003 (custom init handler is NOT available)
0.002339 [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
0.002345 [D2] Device does not match - skipping
0.002355 [D2] Checking device 5 of 9 (1D6B/0003)
0.002367 [D1] nut_libusb_open: invalid libusb bus number 0
0.002483 [D2] - VendorID: 1d6b
0.002487 [D2] - ProductID: 0003
0.002489 [D2] - Manufacturer: Linux 6.18.38-Unraid xhci-hcd
0.002500 [D2] - Product: xHCI Host Controller
0.002502 [D2] - Serial Number: 0000:00:14.0
0.002504 [D2] - Bus: 004
0.002507 [D2] - Bus Port: unknown
0.002510 [D2] - Device: 001
0.002514 [D2] - Device release number: 0618
0.002529 [D2] Trying to match device
0.002532 [D3] match_function_regex: matching a device...
0.002536 [D3] is_usb_device_supported: checking if this driver can support USB device VID 0x1D6B:0x0003
0.002541 [D4] is_usb_device_supported: checking table entry for VID 0x051D:0x0003 (custom init handler is NOT available)
0.002558 [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
0.002564 [D2] Device does not match - skipping
0.002572 [D2] Checking device 6 of 9 (413C/2003)
0.005962 [D2] - VendorID: 413c
0.005980 [D2] - ProductID: 2003
0.005985 [D2] - Manufacturer: Dell
0.005989 [D2] - Product: Dell USB Keyboard
0.005994 [D2] - Serial Number: unknown
0.005998 [D2] - Bus: 002
0.006002 [D2] - Bus Port: 009
0.006007 [D2] - Device: 003
0.006011 [D2] - Device release number: 0307
0.006015 [D2] Trying to match device
0.006020 [D3] match_function_regex: matching a device...
0.006028 [D3] is_usb_device_supported: checking if this driver can support USB device VID 0x413C:0x2003
0.006039 [D4] is_usb_device_supported: checking table entry for VID 0x051D:0x0003 (custom init handler is NOT available)
0.006056 [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
0.006072 [D2] Device does not match - skipping
0.006103 [D2] Checking device 7 of 9 (0781/CFCB)
0.008536 [D2] - VendorID: 0781
0.008552 [D2] - ProductID: cfcb
0.008556 [D2] - Manufacturer: SanDisk
0.008561 [D2] - Product: SDDR-B531
0.008566 [D2] - Serial Number: 0718250000014335
0.008570 [D2] - Bus: 002
0.008574 [D2] - Bus Port: 005
0.008578 [D2] - Device: 002
0.008583 [D2] - Device release number: 2920
0.008587 [D2] Trying to match device
0.008592 [D3] match_function_regex: matching a device...
0.008598 [D3] is_usb_device_supported: checking if this driver can support USB device VID 0x0781:0xCFCB
0.008606 [D4] is_usb_device_supported: checking table entry for VID 0x051D:0x0003 (custom init handler is NOT available)
0.008622 [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
0.008635 [D2] Device does not match - skipping

**0.008660 [D2] Checking device 8 of 9 (051D/0003)
0.009776 [D2] - VendorID: 051d
0.009790 [D2] - ProductID: 0003
0.009794 [D2] - Manufacturer: American Power Conversion
0.009799 [D2] - Product: Smart-UPS X 1500 FW 03.8 / UPS 03.8
0.009804 [D2] - Serial Number: AS1119121977
0.009808 [D2] - Bus: 002
0.009812 [D2] - Bus Port: 010
0.009816 [D2] - Device: 004
0.009821 [D2] - Device release number: 0106
0.009825 [D2] Trying to match device
0.009832 [D3] match_function_regex: matching a device...

0**.009845 [D3] is_usb_device_supported: checking if this driver can support USB device VID 0x051D:0x0003
0.009856 [D4] is_usb_device_supported: checking table entry for VID 0x051D:0x0003 (custom init handler is NOT available)
0.009872 [D4] is_usb_device_supported: POSSIBLY_SUPPORTED: known vendor ID at least
0.009883 [D4] is_usb_device_supported: SUPPORTED: known vendor and product IDs
0.009893 [D2] Device matches
0.009903 [D2] Reading configuration descriptor 1 of 1
0.009923 [D3] libusb_kernel_driver_active() returned 1 (driver active)
0.009934 [D2] successfully set kernel driver auto-detach flag
0.010334 [D2] Claimed interface 0 successfully
0.010348 [D3] nut_libusb_set_altinterface: skipped libusb_set_interface_alt_setting(udev, 0, 0)
0.010487 [D2] Retrieved HID descriptor (expected 9, got 9)
0.010509 [D3] HID descriptor, method 1: (9 bytes) => 09 21 00 01 21 01 22 a9 01
0.010521 [D3] HID descriptor length (method 1) 425
0.010539 [D4] i=0, extra[i]=09, extra[i+1]=21
0.010553 [D3] HID descriptor, method 2: (9 bytes) => 09 21 00 01 21 01 22 a9 01
0.010566 [D3] HID descriptor length (method 2) 425
0.010576 [D2] Trying HID descriptor length 425
0.011396 [D1] microlink_usb: HID PDC status fallback available (PresentStatus on Report 0x07)
0.011416 [D1] microlink_usb: found HID tunnel: Output Report 0x90, Input Report 0x89
0.011425 [D2] Report descriptor retrieved (Reportlen = 425)
0.011435 [D2] Found HID device
0.011442 [D3] Using default, detected or customized USB HID numbers: usb_config_index=0 usb_hid_rep_index=0 usb_hid_desc_index=0 usb_hid_ep_in=1 usb_hid_ep_out=1
0.011458 [D1] microlink_usb: opened American Power Conversion /Smart-UPS X 1500 FW 03.8 / UPS 03.8 (USB 051d:0003)
0.011520 [D2] microlink_usb: continuous async interrupt-IN listener started
0.011607 [D2] microlink TX ctrl: (1 bytes) => f7
0.014622 [D2] microlink TX ctrl: (1 bytes) => fd
0.030912 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.031031 [D2] microlink RX record: (19 bytes) => 00 0a 10 9a 00 0b 05 09 00 01 00 48 00
0.031060 [D2] f8 02 fe 04 29 c1
0.031068 [D2] microlink: page0 version=10 width=16 pages=154 flags=0x09
0.031077 [D1] microlink: STABILITY session_established attempt=1
0.031086 [D2] microlink TX ctrl: (1 bytes) => fe
0.046841 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.047077 [D2] microlink: skipped 44 stray byte(s) before record 0x00
0.047115 [D2] microlink RX record: (19 bytes) => 00 0a 10 9a 00 0b 05 09 00 01 00 48 00
0.047129 [D2] f8 02 fe 04 29 c1
0.047138 [D2] microlink: page0 version=10 width=16 pages=154 flags=0x09
0.047147 [D2] microlink TX ctrl: (1 bytes) => fe
0.078864 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.079135 [D2] microlink: skipped 44 stray byte(s) before record 0x01
0.079178 [D2] microlink RX record: (19 bytes) => 01 fe 08 3e fc 02 fb 00 41 f8 03 31 fc
0.079195 [D2] 02 fb 00 1f 35 01
0.079211 [D2] microlink TX ctrl: (1 bytes) => fe
0.094809 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.095007 [D2] microlink: skipped 44 stray byte(s) before record 0x02
0.095037 [D2] microlink RX record: (19 bytes) => 02 ff 02 ff fe 05 48 19 f8 03 2e fa 0e
0.095047 [D2] 42 ff ff f9 5a cc
0.095058 [D2] microlink TX ctrl: (1 bytes) => fe
0.110818 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.111050 [D2] microlink: skipped 44 stray byte(s) before record 0x03
0.111080 [D2] microlink RX record: (19 bytes) => 03 06 6b ff f8 03 2c fa 02 da ff ff f9
0.111095 [D2] 00 b7 ff f8 9a 46
0.111109 [D2] microlink TX ctrl: (1 bytes) => fe
0.126852 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.127161 [D2] microlink: skipped 44 stray byte(s) before record 0x04
0.127226 [D2] microlink RX record: (19 bytes) => 04 03 2d fa 01 6d ff ff f9 00 0e ff ff
0.127239 [D2] f8 04 fe 0e 26 2a
0.127250 [D2] microlink TX ctrl: (1 bytes) => fe
0.142843 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.143074 [D2] microlink: skipped 44 stray byte(s) before record 0x05
0.143113 [D2] microlink RX record: (19 bytes) => 05 fe 0b 22 fc 10 21 fc 10 16 fc 10 fd
0.143123 [D2] 09 03 15 fc cc 87
0.143132 [D2] microlink TX ctrl: (1 bytes) => fe
0.158846 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.159079 [D2] microlink: skipped 44 stray byte(s) before record 0x06
0.159117 [D2] microlink RX record: (19 bytes) => 06 10 ff 14 ff fe 08 fd 0a 03 17 fc 04
0.159127 [D2] ff ff fe 0b c9 d7
0.159135 [D2] microlink TX ctrl: (1 bytes) => fe
0.174847 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.175079 [D2] microlink: skipped 44 stray byte(s) before record 0x07
0.175117 [D2] microlink RX record: (19 bytes) => 07 1f fc 02 fb ff ff 03 fc 08 ff fe 08
0.175129 [D2] 1b fc 02 fb cc ec
0.175138 [D2] microlink TX ctrl: (1 bytes) => fe
0.190851 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.191112 [D2] microlink: skipped 44 stray byte(s) before record 0x08
0.191157 [D2] microlink RX record: (19 bytes) => 08 ff ff f9 00 10 19 fc 06 ff 32 fc 10
0.191170 [D2] fd 0c 02 1a 73 f8
0.191180 [D2] microlink TX ctrl: (1 bytes) => fe
0.206632 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.206723 [D2] microlink: skipped 44 stray byte(s) before record 0x09
0.206739 [D2] microlink RX record: (19 bytes) => 09 fc 10 ff ff ff fe 08 03 fc 10 ff f8
0.206744 [D2] 04 fe 0d fe b4 16
0.206749 [D2] microlink TX ctrl: (1 bytes) => fe
0.222611 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.222686 [D2] microlink: skipped 44 stray byte(s) before record 0x0A
0.222695 [D2] microlink RX record: (19 bytes) => 0a 0b 1c fc 10 10 fc 10 23 fc 10 25 fc
0.222699 [D2] 08 11 03 fc 96 a2
0.222703 [D2] microlink TX ctrl: (1 bytes) => fe
0.238793 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.239026 [D2] microlink: skipped 44 stray byte(s) before record 0x0B
0.239062 [D2] microlink RX record: (19 bytes) => 0b 06 26 fc 10 13 fc 10 ff 32 fc 10 ff
0.239071 [D2] ff fe 09 f8 13 48
0.239079 [D2] microlink TX ctrl: (1 bytes) => fe
0.254814 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.255030 [D2] microlink: skipped 44 stray byte(s) before record 0x0C
0.255063 [D2] microlink RX record: (19 bytes) => 0c 03 fd 10 04 f8 02 4a fc 08 ff ff ff
0.255071 [D2] ff fe 05 fe c9 c7
0.255079 [D2] microlink TX ctrl: (1 bytes) => fe
0.270864 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.271128 [D2] microlink: skipped 44 stray byte(s) before record 0x0D
0.271177 [D2] microlink RX record: (19 bytes) => 0d 0f f8 03 fd 11 03 02 02 ff ff ff 02
0.271189 [D2] 74 fc 02 fb 04 5c
0.271199 [D2] microlink TX ctrl: (1 bytes) => fe
0.286862 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.287162 [D2] microlink: skipped 44 stray byte(s) before record 0x0E
0.287198 [D2] microlink RX record: (19 bytes) => 0e 00 07 ff fe 09 03 fc 30 ff 03 fc 10
0.287210 [D2] fd 3d 03 b9 7b 2f
0.287224 [D2] microlink TX ctrl: (1 bytes) => fe
0.302880 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.303162 [D2] microlink: skipped 44 stray byte(s) before record 0x0F
0.303198 [D2] microlink RX record: (19 bytes) => 0f fa 07 08 00 00 f9 00 00 b8 fa 07 08
0.303208 [D2] 00 00 f9 00 ff 30
0.303218 [D2] microlink TX ctrl: (1 bytes) => fe
0.318828 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.319080 [D2] microlink: skipped 44 stray byte(s) before record 0x10
0.319110 [D2] microlink RX record: (19 bytes) => 10 5a b7 fc 04 fa 00 00 01 2c 00 00 00
0.319123 [D2] 04 f9 00 00 06 b0
0.319135 [D2] microlink TX ctrl: (1 bytes) => fe
0.334859 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.335144 [D2] microlink: skipped 44 stray byte(s) before record 0x11
0.335190 [D2] microlink RX record: (19 bytes) => 11 00 08 30 fa 0e 10 00 00 f9 00 00 f8
0.335200 [D2] 03 21 fc 02 1a 6d
0.335209 [D2] microlink TX ctrl: (1 bytes) => fe
0.350877 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.351186 [D2] microlink: skipped 44 stray byte(s) before record 0x12
0.351246 [D2] microlink RX record: (19 bytes) => 12 fb 00 3b f9 00 00 ff f8 03 20 fa 07
0.351259 [D2] 08 00 00 f9 e1 ba
0.351270 [D2] microlink TX ctrl: (1 bytes) => fe
0.366883 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.367180 [D2] microlink: skipped 44 stray byte(s) before record 0x13
0.367221 [D2] microlink RX record: (19 bytes) => 13 00 78 ff f8 03 1f fa 07 08 00 05 f9
0.367237 [D2] 07 08 ff ff 4d f3
0.367253 [D2] microlink TX ctrl: (1 bytes) => fe
0.382861 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.383142 [D2] microlink: skipped 44 stray byte(s) before record 0x14
0.383193 [D2] microlink RX record: (19 bytes) => 14 fe 09 40 fc 0e 19 44 fc 10 03 fc 10
0.383207 [D2] 42 fc 10 03 5f 6c
0.383217 [D2] microlink TX ctrl: (1 bytes) => fe
0.398881 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.399180 [D2] microlink: skipped 44 stray byte(s) before record 0x15
0.399215 [D2] microlink RX record: (19 bytes) => 15 fc 04 1c 1b 1a 48 03 fc 04 03 fc 10
0.399226 [D2] ff 82 fc 10 f3 b8
0.399237 [D2] microlink TX ctrl: (1 bytes) => fe
0.414864 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.415138 [D2] microlink: skipped 44 stray byte(s) before record 0x16
0.415171 [D2] microlink RX record: (19 bytes) => 16 f8 03 15 fc 02 fb 00 02 f9 00 02 ff
0.415185 [D2] fe 09 03 fc af 28
0.415198 [D2] microlink TX ctrl: (1 bytes) => fe
0.430716 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.430812 [D2] microlink: skipped 44 stray byte(s) before record 0x17
0.430823 [D2] microlink RX record: (19 bytes) => 17 16 ff f8 03 27 fc 02 fb 00 0f f9 00
0.430825 [D2] 02 ff fe 09 f9 a7
0.430828 [D2] microlink TX ctrl: (1 bytes) => fe
0.446621 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.446734 [D2] microlink: skipped 44 stray byte(s) before record 0x18
0.446743 [D2] microlink RX record: (19 bytes) => 18 02 ff fe 0b f8 03 2b fc 02 fb 00 1f
0.446747 [D2] f9 00 01 ff 89 16
0.446764 [D2] microlink TX ctrl: (1 bytes) => fe
0.462598 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.462679 [D2] microlink: skipped 44 stray byte(s) before record 0x19
0.462690 [D2] microlink RX record: (19 bytes) => 19 3a fc 02 fb 00 3f f9 00 05 ff fe 05
0.462695 [D2] 03 fc 06 18 6a e6
0.462700 [D2] microlink TX ctrl: (1 bytes) => fe
0.478638 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.478744 [D2] microlink: skipped 44 stray byte(s) before record 0x1A
0.478765 [D2] microlink RX record: (19 bytes) => 1a fc 02 fb 00 3f f9 00 20 03 fc 06 31
0.478770 [D2] fa 07 08 00 da 75
0.478773 [D2] microlink TX ctrl: (1 bytes) => fe
0.494782 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.495054 [D2] microlink: skipped 44 stray byte(s) before record 0x1B
0.495098 [D2] microlink RX record: (19 bytes) => 1b 78 f9 00 96 fe 42 42 fc 10 ff fe 2a
0.495111 [D2] 42 fc 10 ff 7d 55
0.495131 [D2] microlink TX ctrl: (1 bytes) => fe
0.510806 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.511093 [D2] microlink: skipped 44 stray byte(s) before record 0x1C
0.511123 [D2] microlink RX record: (19 bytes) => 1c ff fe 40 fd 25 0a f8 03 18 ff 7b fc
0.511132 [D2] 06 ff ff fe fe e6
0.511140 [D2] microlink TX ctrl: (1 bytes) => fe
0.526749 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.527055 [D2] microlink: skipped 44 stray byte(s) before record 0x1D
0.527085 [D2] microlink RX record: (19 bytes) => 1d 41 fd 25 0a f8 03 18 ff 7b fc 06 ff
0.527094 [D2] ff fe 07 0d 9e 30
0.527102 [D2] microlink TX ctrl: (1 bytes) => fe
0.542742 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.542971 [D2] microlink: skipped 44 stray byte(s) before record 0x1E
0.542994 [D2] microlink RX record: (19 bytes) => 1e fa 00 88 00 7f f9 00 7f 0e fa 00 6a
0.543011 [D2] 00 61 f9 00 c2 d3
0.543024 [D2] microlink TX ctrl: (1 bytes) => fe
0.558731 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.558987 [D2] microlink: skipped 44 stray byte(s) before record 0x1F
0.559020 [D2] microlink RX record: (19 bytes) => 1f 6a f8 03 25 fc 02 fb 00 07 f9 00 01
0.559029 [D2] ff 03 fc 04 15 3f
0.559038 [D2] microlink TX ctrl: (1 bytes) => fe
0.574801 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.575059 [D2] microlink: skipped 44 stray byte(s) before record 0x20
0.575092 [D2] microlink RX record: (19 bytes) => 20 2b 2a 2c fc 02 fb 00 02 f9 00 02 ff
0.575101 [D2] 03 fc 10 fd cb 8b
0.575110 [D2] microlink TX ctrl: (1 bytes) => fe
0.590788 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.591008 [D2] microlink: skipped 44 stray byte(s) before record 0x21
0.591043 [D2] microlink RX record: (19 bytes) => 21 3d 03 82 fc 10 ff fe 09 03 fc 10 ff
0.591051 [D2] 03 fc 08 f8 4e a7
0.591059 [D2] microlink TX ctrl: (1 bytes) => fe
0.606819 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.607148 [D2] microlink: skipped 44 stray byte(s) before record 0x22
0.607201 [D2] microlink RX record: (19 bytes) => 22 03 1a fc 02 fb 00 1e f9 00 10 ff fe
0.607225 [D2] 09 02 02 02 41 4e
0.607256 [D2] microlink TX ctrl: (1 bytes) => fe
0.622847 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.623130 [D2] microlink: skipped 44 stray byte(s) before record 0x23
0.623185 [D2] microlink RX record: (19 bytes) => 23 ff fe 08 03 fc 08 ff fe 09 ff fe 08
0.623205 [D2] 02 02 02 01 31 86
0.623222 [D2] microlink TX ctrl: (1 bytes) => fe
0.638806 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.639073 [D2] microlink: skipped 44 stray byte(s) before record 0x24
0.639107 [D2] microlink RX record: (19 bytes) => 24 fc 01 15 fc 01 ff 14 fc 02 fb 02 08
0.639116 [D2] 0a fc 02 fb 66 46
0.639129 [D2] microlink TX ctrl: (1 bytes) => fe
0.654787 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.655053 [D2] microlink: skipped 44 stray byte(s) before record 0x25
0.655083 [D2] microlink RX record: (19 bytes) => 25 23 f7 0b fe 09 ff fe 08 03 fc 0a ff
0.655091 [D2] 93 fc 04 fe 13 f4
0.655099 [D2] microlink TX ctrl: (1 bytes) => fe
0.670748 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.671025 [D2] microlink: skipped 44 stray byte(s) before record 0x26
0.671066 [D2] microlink RX record: (19 bytes) => 26 06 16 fc 02 fb 03 ff 25 27 f8 03 17
0.671085 [D2] ff ff fe 07 64 f5
0.671109 [D2] microlink TX ctrl: (1 bytes) => fe
0.686783 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.687038 [D2] microlink: skipped 44 stray byte(s) before record 0x27
0.687081 [D2] microlink RX record: (19 bytes) => 27 f8 03 26 fc 04 ff 26 27 49 28 ff fe
0.687101 [D2] 05 21 20 24 ff 8d
0.687123 [D2] microlink TX ctrl: (1 bytes) => fe
0.702746 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.702996 [D2] microlink: skipped 44 stray byte(s) before record 0x28
0.703023 [D2] microlink RX record: (19 bytes) => 28 ff fe 07 25 ff fe 05 22 1f fa 00 0a
0.703031 [D2] 00 00 1e fa ce 7a
0.703041 [D2] microlink TX ctrl: (1 bytes) => fe
0.718786 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.719057 [D2] microlink: skipped 44 stray byte(s) before record 0x29
0.719113 [D2] microlink RX record: (19 bytes) => 29 00 01 00 00 f9 00 01 10 fc 02 fb 00
0.719127 [D2] 01 11 fc 02 90 2e
0.719140 [D2] microlink TX ctrl: (1 bytes) => fe
0.734807 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.735078 [D2] microlink: skipped 44 stray byte(s) before record 0x2A
0.735111 [D2] microlink RX record: (19 bytes) => 2a fb 0f ff 12 fc 02 fb 00 03 13 fc 02
0.735120 [D2] fb 7f ff 23 bf 4a
0.735130 [D2] microlink TX ctrl: (1 bytes) => fe
0.750826 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.751121 [D2] microlink: skipped 44 stray byte(s) before record 0x2B
0.751161 [D2] microlink RX record: (19 bytes) => 2b ff fe 07 32 ff fe 0b 3b fc 02 fb 00
0.751172 [D2] 0f 3f fc 02 05 0a
0.751186 [D2] microlink TX ctrl: (1 bytes) => fe
0.766789 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.767046 [D2] microlink: skipped 44 stray byte(s) before record 0x2C
0.767085 [D2] microlink RX record: (19 bytes) => 2c fb 00 07 ff 36 fc 02 fb 31 73 02 34
0.767095 [D2] fc 02 fb 00 aa 1f
0.767104 [D2] microlink TX ctrl: (1 bytes) => fe
0.782694 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.782799 [D2] microlink: skipped 44 stray byte(s) before record 0x2D
0.782809 [D2] microlink RX record: (19 bytes) => 2d 3f 04 02 fe 09 03 fc 10 03 fc 20 ff
0.782815 [D2] fe 0f 69 fc e4 fb
0.782820 [D2] microlink TX ctrl: (1 bytes) => fe
0.798695 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.798802 [D2] microlink: skipped 44 stray byte(s) before record 0x2E
0.798812 [D2] microlink RX record: (19 bytes) => 2e 04 03 fc 0c 02 ff fe 09 ff fe 08 03
0.798818 [D2] fc 1e ff f8 c9 cf
0.798823 [D2] microlink TX ctrl: (1 bytes) => fe
0.814790 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.815080 [D2] microlink: skipped 44 stray byte(s) before record 0x2F
0.815129 [D2] microlink RX record: (19 bytes) => 2f 04 fe 0e 28 fa 00 06 00 01 fd 0c 02
0.815153 [D2] 1e fa 00 03 92 da
0.815184 [D2] microlink TX ctrl: (1 bytes) => fe
0.830809 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.831073 [D2] microlink: skipped 44 stray byte(s) before record 0x30
0.831106 [D2] microlink RX record: (19 bytes) => 30 00 00 27 20 12 fc 02 fb 7f ff 28 fa
0.831115 [D2] 00 06 00 01 4a 87
0.831125 [D2] microlink TX ctrl: (1 bytes) => fe
0.846707 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.846968 [D2] microlink: skipped 44 stray byte(s) before record 0x31
0.847001 [D2] microlink RX record: (19 bytes) => 31 ff ff ff f8 04 fe 0d 28 fa 00 06 00
0.847009 [D2] 01 ff ff fe a3 f8
0.847017 [D2] microlink TX ctrl: (1 bytes) => fe
0.862787 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.863068 [D2] microlink: skipped 44 stray byte(s) before record 0x32
0.863101 [D2] microlink RX record: (19 bytes) => 32 09 ff 03 fc 0a 38 fc 02 fb 00 11 fe
0.863111 [D2] 09 02 02 02 37 31
0.863121 [D2] microlink TX ctrl: (1 bytes) => fe
0.878824 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.879104 [D2] microlink: skipped 44 stray byte(s) before record 0x33
0.879143 [D2] microlink RX record: (19 bytes) => 33 ff 03 fc 06 b5 fc 02 fb fe ff 03 fc
0.879153 [D2] 04 fd 3d 03 47 8d
0.879163 [D2] microlink TX ctrl: (1 bytes) => fe
0.894789 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.895060 [D2] microlink: skipped 44 stray byte(s) before record 0x34
0.895093 [D2] microlink RX record: (19 bytes) => 34 b6 fc 02 fb 1f 9f 84 ff 03 fc 0c 02
0.895102 [D2] fd 3d 03 2d 09 54
0.895111 [D2] microlink TX ctrl: (1 bytes) => fe
0.910850 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.911157 [D2] microlink: skipped 44 stray byte(s) before record 0x35
0.911198 [D2] microlink RX record: (19 bytes) => 35 fa 07 08 ff ff ad fa 07 08 ff ff 2e
0.911219 [D2] fc 04 fa 00 2c b2
0.911238 [D2] microlink TX ctrl: (1 bytes) => fe
0.926784 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.927024 [D2] microlink: skipped 44 stray byte(s) before record 0x36
0.927069 [D2] microlink RX record: (19 bytes) => 36 12 75 00 ff ff ff ff ff 03 fc 08 fe
0.927081 [D2] 07 03 fc 14 22 fd
0.927091 [D2] microlink TX ctrl: (1 bytes) => fe
0.942792 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.943053 [D2] microlink: skipped 44 stray byte(s) before record 0x37
0.943087 [D2] microlink RX record: (19 bytes) => 37 ff fe 08 3c fc 02 fb 00 03 3d fc 02
0.943114 [D2] fb 3f ff 08 b0 57
0.943130 [D2] microlink TX ctrl: (1 bytes) => fe
0.958791 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.959042 [D2] microlink: skipped 44 stray byte(s) before record 0x38
0.959077 [D2] microlink RX record: (19 bytes) => 38 fc 02 fb 00 07 07 fc 02 fb 00 03 03
0.959087 [D2] fc 04 06 fc a8 11
0.959099 [D2] microlink TX ctrl: (1 bytes) => fe
0.974820 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.975170 [D2] microlink: skipped 44 stray byte(s) before record 0x39
0.975219 [D2] microlink RX record: (19 bytes) => 39 04 05 fc 04 03 fc 06 f8 03 30 fc 02
0.975239 [D2] fb 00 1f ff 7e f1
0.975262 [D2] microlink TX ctrl: (1 bytes) => fe
0.990807 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
0.991095 [D2] microlink: skipped 44 stray byte(s) before record 0x3A
0.991139 [D2] microlink RX record: (19 bytes) => 3a f8 03 1d ff f8 03 1e ff f8 03 22 ff
0.991163 [D2] f8 03 1c ff 61 fa
0.991180 [D2] microlink TX ctrl: (1 bytes) => fe
1.006793 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
1.007079 [D2] microlink: skipped 44 stray byte(s) before record 0x3B
1.007124 [D2] microlink RX record: (19 bytes) => 3b f8 03 24 ff 09 fc 02 fb 00 03 f8 03
1.007140 [D2] 16 fc 04 ff 58 32
1.007154 [D2] microlink TX ctrl: (1 bytes) => fe
1.022746 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
1.023091 [D2] microlink: skipped 44 stray byte(s) before record 0x3C
1.023145 [D2] microlink RX record: (19 bytes) => 3c ff ff ff f6 f7 f7 f7 f7 f7 f7 f7 f7
1.023167 [D2] f7 f7 f7 f7 15 18
1.023183 [D2] microlink TX ctrl: (1 bytes) => fe
1.038739 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
1.038994 [D2] microlink: skipped 44 stray byte(s) before record 0x3D
1.039031 [D2] microlink RX record: (19 bytes) => 3d f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
1.039046 [D2] f7 f7 f7 f7 76 cc
1.039055 [D2] microlink TX ctrl: (1 bytes) => fe
1.054773 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
1.054998 [D2] microlink: skipped 44 stray byte(s) before record 0x3E
1.055034 [D2] microlink RX record: (19 bytes) => 3e f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
1.055049 [D2] f7 f7 f7 f7 64 dd
1.055063 [D2] microlink TX ctrl: (1 bytes) => fe
1.070771 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
1.070995 [D2] microlink: skipped 44 stray byte(s) before record 0x3F
1.071030 [D2] microlink RX record: (19 bytes) => 3f f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
1.071045 [D2] f7 f7 f7 f7 52 ee
1.071056 [D2] microlink TX ctrl: (1 bytes) => fe
1.086816 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
1.087073 [D2] microlink: skipped 43 stray byte(s) before record 0x00
1.087121 [D2] microlink RX record: (19 bytes) => 00 40 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
1.087140 [D2] f7 f7 f7 f7 f7 40
1.087159 [D2] microlink: page0 version=64 width=247 pages=247 flags=0xF7
1.087179 [D2] microlink TX ctrl: (1 bytes) => fe
1.102793 [D4] microlink_usb: async transfer completed: report 0x89, 64 bytes
2.103209 [D2] microlink TX ctrl: (1 bytes) => fe
3.111104 [D2] microlink TX ctrl: (1 bytes) => fe
4.119107 [D2] microlink TX ctrl: (1 bytes) => fe
5.127110 [D2] microlink TX ctrl: (1 bytes) => fe
6.135218 [D2] microlink TX ctrl: (1 bytes) => fe
7.143178 [D2] microlink TX ctrl: (1 bytes) => fe
8.151217 [D2] microlink TX ctrl: (1 bytes) => fe
9.159321 [D2] microlink TX ctrl: (1 bytes) => fe
10.167254 [D2] microlink TX ctrl: (1 bytes) => fe
11.175298 apcmicrolink: failed to start Microlink session on auto (no standard-HID fallback available on this device either)
11.179288 [D3] procname_cleanup: starting for: myProcName=[/usr/local/ups/bin/apcmicrolink] myProcBaseName=[apcmicrolink] proctag=[test] proctag_lib=[(null)]
11.179326 [D3] proctag_cleanup: starting for: myProcName=[/usr/local/ups/bin/apcmicrolink] myProcBaseName=[apcmicrolink] proctag=[test] proctag_lib=[(null)]
11.179341 [D2] a apcmicrolink sub-process (test) is exiting now
11.179358 [D1] upsnotify: failed to notify about state NOTIFY_STATE_STOPPING: no notification tech defined, will not spam more about it
11.179373 [D1] On systems without service units, consider export NUT_QUIET_INIT_UPSNOTIFY=true
11.179390 [D1] sock_close: starting...
11.179398 [D1] sock_close: finished
11.179411 [D1] exit_cleanup: finished, exiting

getgray avatar Aug 28 '26 20:08 getgray

@getgray I might need to work with you and your device directly, since the device is doing something that my devices are not.

it's announcing it has 154 pages of microlink data, but stops reading after page 60 - that's highly unusual to say the least.

nmbro avatar Aug 29 '26 15:08 nmbro

@nmbro Happy to help any way I can. I did (only with help of AI) manage get it somewhat working yesterday. My code base was from a pull a few days ago (see below) when I first learned of your fork from @jimklimov . You have apparently made a lot of changes since then. Between feeding AI the MicroLink protocol info I had, my one time USPMON capture, your code base, and hours of testing and feeding debug logs with AI, I managed to get it to where it is talking. I used this code: git checkout e1bb723c71d5a29b944a4964497844bc87b2ab26

I'm not a pro programmer by any stretch, but can use vi and read code as long as it's not too over my head. Intermediate linux user, been a mailserver/DNS admin for years.

Anyway, it seems to be working, although this is just from today, and I have not tested anything other that pulling/polling info from the UPS via NUT and the driver I compiled, Happy to share my changes but I'm not a git person so have to post a diff or something. And you ar eso much ahead of me my code may not be of much help to you anyway.

At least I got to here so far:

root@SERVER4:/mnt/user/logs/UPS-dev/nut-apcmicrolink-usb# upsc [email protected]
battery.charge: 100
battery.date: 2024-01-15
battery.date.maintenance: 2027-10-18
battery.lifetime.status: LifeTimeStatusOK
battery.lowruntimewarning: 120
battery.temperature: 32.367188
battery.voltage: 54
device.mfr: APC
device.model: Smart-UPS X1500
device.serial: AS1119121977
device.type: ups
driver.debug: 0
driver.flag.allow_killpower: 0
driver.name: apcmicrolink
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: auto
driver.state: updateinfo
driver.version: 2.8.5.1-0+ge1bb723c7
driver.version.internal: 0.02
driver.version.usb: libusb-1.0.30 (API: 0x0100010C)
experimental.battery.test.result: Passed
experimental.device.sku: SMX1500RM2U
experimental.device.status: OL
experimental.hid_fallback.active: 0
experimental.outlet.group.1.status.cause: UPSStatusChange
experimental.outlet.group.2.status.cause: UPSStatusChange
experimental.outlet.group.3.status.cause: UPSStatusChange
experimental.output.energy: 35572262
experimental.output.voltage.setting: VAC120
experimental.statistics.ups.totaltime: 5697063
experimental.ups.calibration.result: None
input.frequency: 60.09375
input.quality: Acceptable
input.transfer.high: 127
input.transfer.low: 106
input.voltage: 119.59375
microlink.diag.slave_password_echo: 00000000
outlet.group.1.delay.reboot: 20
outlet.group.1.delay.shutdown: 140
outlet.group.1.delay.start: 30
outlet.group.1.minimumreturnruntime: 480
outlet.group.1.name: Server - Group 1
outlet.group.1.status: StateOn
outlet.group.1.timer.reboot: NotActive
outlet.group.1.timer.shutdown: NotActive
outlet.group.1.timer.start: NotActive
outlet.group.2.delay.reboot: 20
outlet.group.2.delay.shutdown: 145
outlet.group.2.delay.start: 15
outlet.group.2.minimumreturnruntime: 480
outlet.group.2.name: SAS Chassis - 2
outlet.group.2.status: StateOn
outlet.group.2.timer.reboot: NotActive
outlet.group.2.timer.shutdown: NotActive
outlet.group.2.timer.start: NotActive
outlet.group.3.delay.reboot: 20
outlet.group.3.delay.shutdown: 10
outlet.group.3.delay.start: 45
outlet.group.3.minimumreturnruntime: 463
outlet.group.3.name: Misc - 3
outlet.group.3.status: StateOn
outlet.group.3.timer.reboot: NotActive
outlet.group.3.timer.shutdown: NotActive
outlet.group.3.timer.start: NotActive
output.current: 2.1875
output.frequency: 60.09375
output.voltage: 119.59375
ups.display.language: en
ups.efficiency: 96
ups.id: Server SMX1500
ups.load: 2
ups.mfr: APC
ups.mfr.date: 2011-05-06
ups.model: Smart-UPS X1500
ups.power: 18.523438
ups.power.nominal: 1440
ups.productid: 0003
ups.realpower: 22.136719
ups.realpower.nominal: 1200
ups.serial: AS1119121977
ups.status: OL
ups.temperature: 32.367188
ups.test.interval: OnStartUpPlus7
ups.vendorid: 051d

Thank you, Scott

getgray avatar Aug 29 '26 19:08 getgray

Update, I tried some commands, not much is exposed. A front panel test initiation works, so it's taking at least that command. But apparently only one shutdown command is exposed:

upscmd -w -t 5 -u admin -p adminpass [email protected] shutdown.default

which caused the driver to shutdown but the UPS didn't do anything at all that I could see. Since the whole reason to be trying this is to be able get the UPS to shut down differently that what apcuspd does and do like Powerchute does, if the shutdown won't work it's all for naught . Maybe it's just somethign my code it's working right with...

COMMANDs:

UPS-dev# ./NUT-start.sh
Writing NUT configuration...
Updating permissions for NUT...
Checking if the NUT Runtime Statistics Module should be enabled...
Disabling the NUT Runtime Statistics Module...
Network UPS Tools upsdrvctl - UPS driver controller 2.8.5 release
Network UPS Tools 2.8.5.1-0+ge1bb723c7 (development iteration after 2.8.5) - APC Microlink protocol driver 0.02
Warning: This is an experimental driver.
Some features may not function correctly.

Listening on socket /var/state/ups/apcmicrolink-ups
Network UPS Tools upsd 2.8.5 release
listening on 0.0.0.0 port 3493
Connected to UPS [ups]: apcmicrolink-ups
Found 1 UPS defined in ups.conf
Network UPS Tools upsmon 2.8.5 release
UPS: [email protected] (primary) (power value 1)
Using power down flag file /etc/nut/killpower
   0.000153     [D1:27761:init] debug level is '1'
   0.000161     [D1:27761:init] will use a shutdown command (SHUTDOWNCMD): '/sbin/poweroff'
   0.000168     [D1:27761:init] will use custom notification command (NOTIFYCMD): '/usr/sbin/nut-notify'

Broadcast message from root@SERVER4 (somewhere) (Sat Aug 29 17:43:58 2026):

UPS [email protected]: has at least one unclassified status token: [WAIT]

Broadcast message from root@SERVER4 (somewhere) (Sat Aug 29 17:44:03 2026):

UPS [email protected] has no unclassified status tokens anymore


root@SERVER4:/mnt/user/logs/UPS-dev# upscmd -l [email protected]
Instant commands supported on UPS [ups]:

beeper.mute - Temporarily mute the UPS beeper
bypass.start - Put the UPS in Bypass mode
bypass.stop - Take the UPS out of Bypass mode
calibrate.start - Start run time calibration
calibrate.stop - Stop run time calibration
driver.killpower - Tell the driver daemon to initiate UPS shutdown; should be unlocked with driver.flag.allow_killpower option or variable setting
driver.reload - Reload running driver configuration from the file system (only works for changes in some options)
driver.reload-or-error - Reload running driver configuration from the file system (only works for changes in some options); return an error if something changed and could not be applied live (so the caller can restart it with new options)
driver.reload-or-exit - Reload running driver configuration from the file system (only works for changes in some options); exit the running driver if something changed and could not be applied live (so service management framework can restart it with new options)
shutdown.default - Run the driver-defined UPS shutdown sequence (as opposed to user-configured 'sdcommands')
test.battery.start - Start a battery test
test.battery.stop - Stop the battery test
test.panel.start - Start testing the UPS panel

getgray avatar Aug 29 '26 22:08 getgray

no worries - my driver exposes the same commands that powerchute has access to, so lets get that working, I have a more stable pull request open on #3591

Hopefully your ups just works, but if it doesn't then we might have to dig deeper into why.

nmbro avatar Aug 30 '26 01:08 nmbro

I've been trying to hack the code using ChatGPT (dont' have Claude at a level that's usable), for a week, made some progress but hit a roadblock it doesn't seem to be able to get through. I loaded your build clean and tried it to see if it worked; I thought if I could get yours working I might be able to get my C working and issue other commands. Also, no good so far. Results:

# cd /mnt/user/logs/UPS-dev/nut-try4/install

./bin/upscmd -l [email protected]
Instant commands supported on UPS [ups]:

beeper.mute - Temporarily mute the UPS beeper
bypass.start - Put the UPS in Bypass mode
bypass.stop - Take the UPS out of Bypass mode
calibrate.start - Start run time calibration
calibrate.stop - Stop run time calibration
driver.killpower - Tell the driver daemon to initiate UPS shutdown; should be unlocked with driver.flag.allow_killpower option or variable setting
driver.reload - Reload running driver configuration from the file system (only works for changes in some options)
driver.reload-or-error - Reload running driver configuration from the file system (only works for changes in some options); return an error if something changed and could not be applied live (so the caller can restart it with new options)
driver.reload-or-exit - Reload running driver configuration from the file system (only works for changes in some options); exit the running driver if something changed and could not be applied live (so service management framework can restart it with new options)
shutdown.default - Run the driver-defined UPS shutdown sequence (as opposed to user-configured 'sdcommands')
test.battery.start - Start a battery test
test.battery.stop - Stop the battery test
test.panel.start - Start testing the UPS panel

Of the available commands, I tried the beeper.mute, but polling the settings shown no change on UPS, if I looked at right thing. I tried the test.panel.start and that did cause a test panel test, it appeared. I tried the core shutdown.default, drives says "SUCCESS" but UPS does nothing. So only the one command had visible or checkable positive results.

If there is anything I can collect or provide to help get it working, please let me know. I've got USBPcap captures of Windows Powerchute sending a outlet off and on command that work, I've got strace data of Linux Powerchute sending a Off command that worked. If that helps.

And I have this:

APC MICROLINK — SOURCE-CHECKED COMMAND TABLE
=============================================

SESSION CONTROL COMMANDS
------------------------
ACK / READ       FE
NAK / INIT       FD
STOP             F7


OUTLET COMMANDS — PROVEN FROM PCBE SOURCE + WIRE CAPTURE
---------------------------------------------------------
SOG1 OFF         0x1204    92 00 02 12 04 4A 0B
SOG3 OFF         0x1804    92 00 02 18 04 38 17
SOG3 ON + COLD   0x1822    92 00 02 18 22 FB 35


OUTLET BIT DEFINITIONS
----------------------
OutputOn         0x0002
OutputOff        0x0004
OutputShutdown   0x0008
OutputReboot     0x0010
ColdBootAllowed  0x0020

SOG1             0x0200
SOG2             0x0400
SOG3             0x0800
USB              0x1000


MASTER UPS COMMAND — SOURCE-DEFINED, WIRE NOT YET PROVEN
---------------------------------------------------------
RequestShutdown  0x0001
SimpleSignalingCommand_BF / descriptor 2:16 bit 0

EXACT MICROLINK WIRE FRAME: NOT YET CAPTURED


HID OUTPUT FORM
---------------
HID report ID = 0x90

Example SOG3 OFF:
90 92 00 02 18 04 38 17
then zero-padded to the native 64-byte output report.


STATUS
------
FE / FD / F7       = source-confirmed
SOG1 OFF           = source + real PCBE wire confirmed
SOG3 OFF           = source + real PCBE wire confirmed
SOG3 ON + COLD     = source + real PCBE wire confirmed
RequestShutdown    = source-confirmed, exact wire still unresolved

getgray avatar Sep 04 '26 19:09 getgray

and that's with the pull request code? what does debug_min = 4 give you in the driver options?

nmbro avatar Sep 04 '26 19:09 nmbro

My attempt to answer well:

This is the PR code, commit 9ec01d93b9b6aa7e8a62e7e4e415b0b3f367ca52.

I set the debug level in the test ups.conf:

[ups]
driver = apcmicrolink
port = auto
cmdsrc = usb
debug_min = 4

The driver was then started with:

NUT_CONFPATH=/mnt/user/logs/UPS-dev/nut-try4/test/etc \
NUT_STATEPATH=/mnt/user/logs/UPS-dev/nut-try4/test/run \
LD_LIBRARY_PATH=/mnt/user/logs/UPS-dev/developer/openssl-3.5.8/lib64 \
./bin/apcmicrolink -a ups -DD -F 2>&1 | tee /mnt/user/logs/UPS-dev/nut-try4/test/window1.log

window1.log therefore contains the driver output. debug_min = 4 is confirmed by:

[D1:ups] debug level is '4'
1. test.panel.start
upscmd ... test.panel.start
test start = true

Result: The UPS physically performed the panel/LED test. This is confirmed working.

  1. beeper.mute
upscmd -u admin -p test -w [email protected] beeper.mute
SUCCESS

Relevant driver log:

entering main_instcmd(beeper.mute, (null))
shared main_instcmd() does not handle command beeper.mute, proceeding to driver-specific handler
Starting apcmicrolink.c::instcmd('beeper.mute', '(null)')
microlink: write 2:4.B.3B page=136 offset=2 size=2
microlink TX write: (7 bytes) => 88 02 02 00 04 b2 bc
microlink TX ctrl: (1 bytes) => fe

Result: Command reaches the driver and generates a Microlink write, but there was no observable change on the UPS; ups.beeper.status remained 9.

  1. shutdown.default
upscmd -u admin -p test -w [email protected] shutdown.default
SUCCESS
upscmd exit code: 0

Relevant driver log:

entering main_instcmd(shutdown.default, (null))
Starting apcmicrolink.c::instcmd('shutdown.return', '(null)')
instcmd: unknown command [shutdown.return] [(null)]
apcmicrolink: failed to issue shutdown.return
set_exit_flag: raising exit flag due to programmatic abort: EXIT_FAILURE
Signal -1: exiting
microlink TX ctrl: (1 bytes) => f7

Result: UPS physically remained on. Saw no microlink TX write for this command; only the f7 control transfer occurs while the driver exits.

getgray avatar Sep 04 '26 20:09 getgray

@getgray

Alright, then I need some captures of your powerchute sending the beeper mute command - and the other functionality that you hope this driver also has.

but basically what I have seen is that the old implementation of the beeper mute command that I'm staying compatible with, writes a very different register than the one my UPS uses from its powerchute.

But I'm unaware if the "beeper.mute" is more of a; the alarm is going off right now, please mute it. instead of a actually configure the UPS to be muted - but might be misunderstandings from English being my second language.

And from my investigation the configuration settings write command byte targets seems to be different from the previous UPS that the microlink driver was written for over serial; and I'm guessing that might be true for your UPS as well.

So I guess we need some way of figuring that out in a "smarter" way if possible ofc - but I need to know how different the structures of the pages are first.

I have written a guide for how to install and run my new dumpmicrolinkpages, which I have not added to the PR, since I'm not sure if it's actually helpful yet, so you will have to pull the source from a branch on my fork, just follow the guide.

I have attached my run log as well, for posterity in case anyone in the future wonder what the microlink byte output of Product: Smart-UPS 500 FW:UPS 15.6 / ID=1036 looks like

dumpmicrolinkpages-run.log

dumpmicrolinkpages.md

nmbro avatar Sep 04 '26 23:09 nmbro

to be clear, it was your utility I used to send the beeper command and my suspicions are what you thought about, that it was not a setting but a directive so no way to verify. The command I'm after is the proper shutdown command but I theorize, based on the details I've gleaned from decompiling the source is that if I can get the outlet group 3 on off to work, the rest will fall into place. That is doable now from Powerchute windows and linux, so clearly it is possible. I have that capture in both straces on linux (no USBMON avail) and from USBPmon on windows. I'll see if I can figure out how to use your tool. Thank you.

getgray avatar Sep 05 '26 01:09 getgray

Here's the dump from dumpmicrolinkpages

dump-target.log

getgray avatar Sep 06 '26 00:09 getgray

@getgray added a fix to #3591 so the group 0 should be switchable now, had some wrong assumptions since my UPS does not have a switchable group 0

Turns out that same bug is also why your outlet groups and shutdown command weren't showing up at all - it should all show up once you're on the updated code. Beeper status still needs that PowerChute capture whenever you get a chance.

nmbro avatar Sep 06 '26 10:09 nmbro

@getgray give the latest master a go when you have the chance!

nmbro avatar Sep 07 '26 12:09 nmbro

I have already. It is communicating but was still missing something. I made some progress but late last night I think I had a breakthrough and believe I found the solution. Hope to be able to test this evening. Will post details asap.

getgray avatar Sep 07 '26 12:09 getgray

re Beeper: Not sure this is what you wanted re the beeper command, excuse the AI writeup of my testing. I don't know that PCSS has a beeper mute command I can capture.

Tested PR #3591 on an APC Smart-UPS X 1500 (SMX1500RM2U) using a clean checkout of the PR head (58b70ccee), with no changes from our shutdown testing.

Beeper test results:

Baseline ups.beeper.status: enabled beeper.disable: NUT accepted the command. Driver log confirms it executed the new PR code and wrote 2:4.B.3A with value 2. The UPS immediately reported the same underlying value (0x0009), and ups.beeper.status remained enabled. beeper.enable: NUT accepted the command. ups.beeper.status remained enabled.

Conclusion: On this SMX1500RM2U, beeper.disable does not appear to have any effect. The command is accepted and the expected MicroLink write is transmitted, but the UPS does not change its reported beeper state.

beeper.enable was also tested, but since the UPS was already enabled, that test only confirms the command is accepted; it does not independently demonstrate that enabling works.

So for this UPS: beeper.disable = FAIL; beeper.enable = not independently verifiable from this test.

EDIT: I checked PCSS, there is one setting under a section named "Alarm settings", called "Audible Alarm" with options, Audible Alarm Enabled/Disabled. No other Alarm Settings.

getgray avatar Sep 08 '26 16:09 getgray