Ken Olum
2018-Jan-11 20:14 UTC
[Nut-upsuser] Tripp-Lite BCPERS450 shutdown/restart problems
Thanks again for your help, Charles. I was able to install the Tripp Lite software on my Ubuntu machine, and it sort of works. It does something which continually changes the USB device ID of the UPS, and prints voluminous error messages in the log. However, one of the things that it can do is to schedule a UPS shutdown, which Nut does not know how to do. So I monitored the USB port with wireshark (an interesting endeavor since I didn't start out with any knowledge of USB protocols). But I have managed to discover that when I ask Tripp Lite's poweralert software to schedule a UPS shutdown, it does it by using the SET_REPORT function of the USB HID protocol with ReportType "Feature", ReportID 21 (0x15), and 3 bytes of data which are 0x15 followed by the number of seconds to wait before shutting down in two bytes, LSB first. Below I include wireshark packet dissections for two such commands. The difference is in the "data fragment". In the first case it is 150500, representing a shutdown in 5 seconds, and the second 153701, representing a shutdown in 311 = 0x0137 seconds. Is this helpful? Ken 27738 174.290305 host 1.44.0 USBHID 67 SET_REPORT Request Frame 27738: 67 bytes on wire (536 bits), 67 bytes captured (536 bits) on interface 0 USB URB [Source: host] [Destination: 1.44.0] URB id: 0xffff964d9a2f8540 URB type: URB_SUBMIT ('S') URB transfer type: URB_CONTROL (0x02) Endpoint: 0x00, Direction: OUT Device: 44 URB bus id: 1 Device setup request: relevant (0) Data: present (0) URB sec: 1515699253 URB usec: 785764 URB status: Operation now in progress (-EINPROGRESS) (-115) URB length [bytes]: 3 Data length [bytes]: 3 [Response in: 27739] Interval: 0 Start frame: 0 Copy of Transfer Flags: 0x00000000 Number of ISO descriptors: 0 [bInterfaceClass: HID (0x03)] URB setup bmRequestType: 0x21 bRequest: 9 wValue: 0x0315 wIndex: 0 (0x0000) wLength: 3 Data Fragment: 150500 bRequest: SET_REPORT (0x09) wValue: 0x0315 ReportID: 21 ReportType: Feature (3) wIndex: 0 wLength: 3 66224 1042.041242 host 1.48.0 USBHID 67 SET_REPORT Request Frame 66224: 67 bytes on wire (536 bits), 67 bytes captured (536 bits) on interface 0 USB URB [Source: host] [Destination: 1.48.0] URB id: 0xffff964c9246bd80 URB type: URB_SUBMIT ('S') URB transfer type: URB_CONTROL (0x02) Endpoint: 0x00, Direction: OUT Device: 48 URB bus id: 1 Device setup request: relevant (0) Data: present (0) URB sec: 1515700121 URB usec: 536701 URB status: Operation now in progress (-EINPROGRESS) (-115) URB length [bytes]: 3 Data length [bytes]: 3 [Response in: 66225] Interval: 0 Start frame: 0 Copy of Transfer Flags: 0x00000000 Number of ISO descriptors: 0 [bInterfaceClass: HID (0x03)] URB setup bmRequestType: 0x21 bRequest: 9 wValue: 0x0315 wIndex: 0 (0x0000) wLength: 3 Data Fragment: 153701 bRequest: SET_REPORT (0x09) wValue: 0x0315 ReportID: 21 ReportType: Feature (3) wIndex: 0 wLength: 3
Charles Lepple
2018-Jan-12 03:31 UTC
[Nut-upsuser] Tripp-Lite BCPERS450 shutdown/restart problems
On Jan 11, 2018, at 3:14 PM, Ken Olum wrote:> > So I monitored the USB port with wireshark (an interesting endeavor > since I didn't start out with any knowledge of USB protocols). But I > have managed to discover that when I ask Tripp Lite's poweralert > software to schedule a UPS shutdown, it does it by using the SET_REPORT > function of the USB HID protocol with ReportType "Feature", ReportID 21 > (0x15), and 3 bytes of data which are 0x15 followed by the number of > seconds to wait before shutting down in two bytes, LSB first. > > Below I include wireshark packet dissections for two such commands. The > difference is in the "data fragment". In the first case it is 150500, > representing a shutdown in 5 seconds, and the second 153701, > representing a shutdown in 311 = 0x0137 seconds. > > Is this helpful?Definitely. (The trick will be adding support for this without breaking other models.) Here's the debug output describing ReportID 0x15: 0.070916 Path: UPS.OutletSystem.Outlet.DelayBeforeShutdown, Type: Feature, ReportID: 0x15, Offset: 0, Size: 16, Value: 65535 (In case you are interested, this mapping between the "Path" and the report ID is in the HID Report Descriptor which should be early in the Wireshark capture.) Other HID UPS models tend to provide both DelayBeforeShutdown and DelayBeforeStartup, so I will need to reacquaint myself with how that is handled in the code, since your UPS only seems to need one of those (and this command is an exception to the usual 1:1 mapping of HID Usage IDs to NUT variables). That might not happen until the weekend. For completeness, would you mind sending the output of "upsrw" and "upscmd -l"? I would like to verify some of the other mappings, and also publish that here: http://networkupstools.org/ddl/Tripp_Lite/index.html
Ken Olum
2018-Jan-12 16:59 UTC
[Nut-upsuser] Tripp-Lite BCPERS450 shutdown/restart problems
From: Charles Lepple <clepple at gmail.com> Date: Thu, 11 Jan 2018 22:31:54 -0500 The trick will be adding support for this without breaking other models. For whatever it's worth, Tripp lite's software does not display the model number anywhere, so it may be treating all models the same. In case you are interested, this mapping between the "Path" and the report ID is in the HID Report Descriptor which should be early in the Wireshark capture. I see something called GET DESCRIPTOR Response HID Report which lists the report IDs, but I don't say where it gives information to map it to the path. Other HID UPS models tend to provide both DelayBeforeShutdown and DelayBeforeStartup There is something called Path: UPS.OutletSystem.Outlet.DelayBeforeReboot, ReportID: 0x17. This is sent by the "Immediate Device Reboot" action of the Tripp lite software. Its function seems to be to turn off the load immediately and turn it back on after the given number of seconds. I'm not sure why this would be useful. For completeness, would you mind sending the output of "upsrw" and "upscmd -l"? Below. Thanks again for your help. I will be away until Monday afternoon, so please forgive delay in answering e-mails. Ken % upsrw bcpers450 at localhost [ups.delay.shutdown] Interval to wait after shutdown with delay command (seconds) Type: STRING Maximum length: 10 Value: 200 % upscmd -l bcpers450 at localhost Instant commands supported on UPS [bcpers450]: beeper.disable - Disable the UPS beeper beeper.enable - Enable the UPS beeper beeper.mute - Temporarily mute the UPS beeper beeper.off - Obsolete (use beeper.disable or beeper.mute) beeper.on - Obsolete (use beeper.enable) load.off - Turn off the load immediately load.off.delay - Turn off the load with a delay (seconds) reset.watchdog - Reset watchdog timer shutdown.reboot - Shut down the load briefly while rebooting the UPS shutdown.stop - Stop a shutdown in progress test.battery.start.deep - Start a deep battery test test.battery.start.quick - Start a quick battery test test.battery.stop - Stop the battery test