I just want to add that I too am thankful to have found this post. I would also add that I DID NOT have to actually connect the APC UPS through an xHCI USB 3 port in order to see the issue fixed. Just adding the virtual xHCI controller to the VM while the APC Back-UPS was still connected through the USB 2.0 controller was sufficient. And what a difference! Prior to adding the xHCI controller syslog (on the CentOS 6 VM the APC was mapped to) was logging a boatload of these errors whenever I issued "apcaccess status":
kernel: drivers/hid/usbhid/hid-core.c: usb_submit_urb(ctrl) failed
kernel: generic-usb 0003:051D:0002.0003: timeout initializing reports
And it sometimes took five to eight seconds to get a result (often with timeouts).
After adding the xHCI controller to the VM "apcaccess status" immediately returns a result -- every time. And no more USB errors in syslog. Absolutely Night-and-Day!
I can also have the CentOS VM shutdown ESXi (which is configured to suspend all VM's as the shutdown action) and the apcupsd daemon works correctly when the VM resumes (i.e. if utility power is still out, apccontrol will issue another doshutdown or if power has returned, apccontrol will issue a mainsback). Absolutely perfect!
To have a Linux VM actually shutdown ESXi (and suspend all guests -- provided that's the shutdown action), all you need is a shell script in /etc/apcupsd named doshutdown that looks similar to this:
#!/bin/sh
/usr/bin/sshpass -p myrootpassword /usr/bin/ssh -x -l root 172.16.x.x "/sbin/shutdown.sh && /sbin/poweroff"
exit 99 #keep apccontrol from doing it's own shutdown
(Change "myrootpassword" appropriately, change "172.16.x.x" to the IP of ESXi, install sshpass, make sure ESXi has ssh enabled (maintenance mode), and ssh at least once to ESXi from the VM in order to accept the ssh signature.) Of course you also have to configure /etc/apcupsd/apcupsd.conf as needed/desired.
Regards,
David G. Frailey, MCSE
Williamstown, WV