[Nut-upsdev] Dynamix 650 VA USB - broken, have rough fix
Brian R. Smith
bsmith at furbium.com
Fri Sep 24 03:57:59 UTC 2010
Like Glen Ogilvie, I got a newer Dynamix 650 VA with USB connection, and was having trouble getting NUT to communicate with it.
This appears to be the UPS that megatec_usb was built for - Vendor: 0x0001, Product: 0x0000, uses Megatec's software, has USB chip attached to internal serial lines, and has terrible USB implementation with fake HID tables. But megatec_usb would consistently fail.
After spending a week (hey, I'm unemployed) reading USB docs and poking at it from various directions, I now understand what's wrong, though not necessarily the best place to fix it.
megatec_usb communicates primarily with the UPS via libusb 0.1's usb_get_string_simple. usb_get_string_simple begins by requesting supported LANGIDs from the UPS -- which fails, ending communication. (Megatec's USB implementation is not a good effort.) If you skip that step and go directly to usb_get_string with some arbitrary LANGID (I tried 0x0409 and 0x0000, both worked), the UPS happily responds.
I got it working for now by hacking away at libusb.c/libusb_get_string and switching it to usb_get_string. I expect this isn't the best long-term solution, because it may change the behavior of some other USB UPSs.
Should megatec_usb.c/set_data_krauler just skip the "usb" subdriver function table and go straight for usb_get_string? Or should the usb subdriver be extended with a call that doesn't go through usb_get_string_simple?
--
Brian R. Smith
bsmith at furbium.com
More information about the Nut-upsdev
mailing list