On 20/12/13 21:22, Charles Lepple wrote:> > Maybe Dan, the maintainer of the nutdrv_qx driver, has better insight on this, but my uneducated guess is that I don't think it is Megatec/Qx. The logs don't show any commands going down to the UPS, just Interrupt Read requests to EP1IN. > > It definitely won't be covered by stock usbhid-ups either, although it does implement the bare minimum of the USB HID protocol. (The usbhid-ups driver expects USB HID PDC.)I did try both blazer_usb and usb hid, neither one worked.> > What might be interesting is whether any of the bits vary when the UPS goes on battery, or when the battery gets low. You may want to plug in a dummy load, and power the computer from another UPS or the wall outlet, in order to fully characterize the protocol.Ok, I did this, here is how it went (approximately): t=0 power on the UPS, with some load. t=2 min unplug the UPS from mains, alarm goes off. t=33 min low battery alarm goes off. t=35 min ups powers down. As I was doing the test, I added load, to speed up the battery drain, but from the dumps I don't thing that's reported. The win software tells very little about the status of the UPS. This time, I added another capture point, a software running inside the vm (usbsniff), in case for some reason commands sent to the ups where missing. Here are the results (the list would hold large messages): http://www.ariwainer.com.ar/varios/ups/2013-12-21-usbmon-fullcycle.log http://www.ariwainer.com.ar/varios/ups/2013-12-21-usbsniff-fullcycle.log http://www.ariwainer.com.ar/varios/ups/2013-12-21-wireshark-fullcycle.pcapng> Also important are the settings in the UPS monitoring software, such as timeouts, or behavior options for when the power returns. Those will probably show up as magic numbers later on. >I have this: Shutdown delay on AC fail: 15 minutes. Shutdown delay on low battery: 1 minute. Warning message interval: 15 seconds. Let me know if further tests or more info are needed. Kind regards. Ari.
On 21/12/13 21:31, Ariel Wainer wrote:> > Ok, I did this, here is how it went (approximately): > t=0 power on the UPS, with some load. > t=2 min unplug the UPS from mains, alarm goes off. > t=33 min low battery alarm goes off. > t=35 min ups powers down. >Ok, trying to make sense of the capture (again: it's all guessing, I have no experience with usb protocol): Up until packet #255/131 seconds in the pcap file, the payload is 0x03, then it changes to 0x01 , and then it changes again to 0x02 at packet #3975/2081 seconds. It seems like: 0x01 = AC failed 0x02 = Battery low. 0x03 = AC is ok It looks simillar to the UPS implementation example from http://www.usb.org/developers/devclass_docs/pdcv10.pdf
On Dec 21, 2013, at 11:36 PM, Ariel Wainer wrote:> On 21/12/13 21:31, Ariel Wainer wrote: >> >> Ok, I did this, here is how it went (approximately): >> t=0 power on the UPS, with some load. >> t=2 min unplug the UPS from mains, alarm goes off. >> t=33 min low battery alarm goes off. >> t=35 min ups powers down. >> > > Ok, trying to make sense of the capture (again: it's all guessing, I > have no experience with usb protocol): > > Up until packet #255/131 seconds in the pcap file, the payload is 0x03, > then it changes to 0x01 , and then it changes again to 0x02 at packet > #3975/2081 seconds. > > It seems like: > 0x01 = AC failed > 0x02 = Battery low. > 0x03 = AC is okAlso, there is an Interrupt Out transfer at #4115/2154 (repeated at #4117) that sends a 0x01 down to the UPS. I assume it turns off at that point, or shortly thereafter?> It looks simillar to the UPS implementation example from > http://www.usb.org/developers/devclass_docs/pdcv10.pdfWell... the first few pages of Appendix A are boilerplate USB descriptors. The report descriptor (A.6) is where things start to differ. Your UPS doesn't have Usage Page 0x84, 0x85 or 0x86 in its report descriptor - it only has 0xFFA0, which is in the vendor-specific range, and the two Usage fields are just 8-byte unstructured buffers (also with vendor-specific IDs). It might be possible to tell usbhid-ups to match on the 0xFFA0 usage page, and ignore all of the other HID PDC definitions. I'll poke around the code. -- Charles Lepple clepple at gmail