Oliver Wilcock
2007-Apr-06 04:56 UTC
[Nut-upsdev] questions re. patching bcmxcp.c and choosing variable names
I've patched bcmxcp.c such that it can power cycle the outlet load segments independently on a Powerware PW5125 UPS. I presume that it will work for any XCP protocol UPS with 2 load segments. Should these instant commands be called outlet.1.shutdown.return outlet.2.shutdown.return ? Where do the descriptions displayed by upscmd -l come from? Presently it shows outlet.1.shutdown.return - Unavailable outlet.2.shutdown.return - Unavailable And just in case there is someone out there who has documentation of the XCP protocol. What is the 4th byte of the 0x8A command for? I tinkered with values until it worked, but it would be nice to know if sending 0x00 means something unpleasant that hasn't yet become apparent... And since I'm so green that I don't know what a patch in diff -u format means, would someone be kind enough to explain how to submit this patch (or point me to a succinct description).
Arjen de Korte
2007-Apr-06 08:09 UTC
[Nut-upsdev] questions re. patching bcmxcp.c and choosing variable names
Hi Oliver!> I've patched bcmxcp.c such that it can power cycle the outlet load > segments independently on a Powerware PW5125 UPS. I presume that it will > work for any XCP protocol UPS with 2 load segments.Just to make sure I understand what this does, would this do the same as sending load.off load.on for just one output?> Should these instant commands be called > outlet.1.shutdown.return > outlet.2.shutdown.return > ?Preferably not. This naming convention is too similar to 'shutdown.return' which is totally different. I would prefer something like 'load.n.off', 'load.n.on' and 'load.n.cycle', assuming that you would also be able to switch off one output.> Where do the descriptions displayed by upscmd -l come from? Presently it > shows > outlet.1.shutdown.return - Unavailable > outlet.2.shutdown.return - UnavailableThis is described in docs/new-names.txt (which tells you that this is in data/cmdvartab), which you really should have read first, before making up new variables. It also tells you to contact the Development Team, which you have done now.> And just in case there is someone out there who has documentation of the > XCP protocol. What is the 4th byte of the 0x8A command for? I tinkered > with values until it worked, but it would be nice to know if sending 0x00 > means something unpleasant that hasn't yet become apparent... > > And since I'm so green that I don't know what a patch in diff -u format > means, would someone be kind enough to explain how to submit this patch > (or point me to a succinct description).Usually, a 'diff -uN orignalfile.c modifiedfile.c' would yield something useable. For other options, you may want to look at 'man diff'. Best regards, Arjen -- Eindhoven - The Netherlands Key fingerprint - 66 4E 03 2C 9D B5 CB 9B 7A FE 7E C1 EE 88 BC 57
Kjell Claesson
2007-Apr-06 09:33 UTC
[Nut-upsdev] questions re. patching bcmxcp.c and choosing variable names
Hi Oliver, fre 2007-04-06 klockan 00:39 -0400 skrev Oliver Wilcock:> I've patched bcmxcp.c such that it can power cycle the outlet load > segments independently on a Powerware PW5125 UPS. I presume that it will > work for any XCP protocol UPS with 2 load segments.No only after rev A. And it is overkill on ups'es with one load segment. This can be handled by asking the ups for the commands it can handle, put this in a struct a use this to build the right numbers of instant commands. For the moment i have a more intricate problem in the driver to solve. This would not be any problem if i only have to support one rev of the firmware.> > Should these instant commands be called > outlet.1.shutdown.return > outlet.2.shutdown.return > ? > > Where do the descriptions displayed by upscmd -l come from? Presently it > shows > outlet.1.shutdown.return - Unavailable > outlet.2.shutdown.return - Unavailable >Look at the mail from Arjen about the naming. The command is not a load-off command. It is 'Delayed Load Power Off & Restart Command'. So it going to shut down the outlet in t time and restart the outlet: 1. When the Utility Input is within an acceptable range, AND 2. After the Utility Stabilization delay (from the Extended Limits block), AND 3. After a UPS-dependent internal start-up delay> And just in case there is someone out there who has documentation of the > XCP protocol. What is the 4th byte of the 0x8A command for? I tinkered > with values until it worked, but it would be nice to know if sending 0x00 > means something unpleasant that hasn't yet become apparent... >Then command used in the driver is. 0xAB (start) 0x02 (lenght) 0x8A (cmnd) 0xXX (time) 0xXX (Csum) You may set a longer delay by entering one more field: 0xAB (start) 0x03 (lenght) 0x8A (cmnd) 0xXX (time) 0xXX (time) 0xXX (Csum) (sorry for the linebreak) This give you up to 65,534 seconds delay instead of 255 seconds.Then you may set it on a outlet 0xAB (start) 0x04 (lenght) 0x8A (cmnd) 0xXX (time) 0xXX (time) 0xXX (outlet) 0xXX (Csum) Where outlet is 1-64 or you may set it to 255 to shut off all outlet. Observe the time is in 2 bytes (0 - 65535 seconds). So the command should handle the input of time and outlet to control It would be better to use the 0x91 (on) 0x93 (off) command with the length of 0x04. Referred to 'PW_UPS_ON_TIME' and 'PW_UPS_OFF_TIME' in the bcmxcp.h This is more a Load.n.off Load.n.on and it looks like this. (off) 0xAB (start) 0x04 (lenght) 0x93 (cmnd) 0xXX (time) 0xXX (time) 0xXX (outlet) 0xXX (Csum) (on) 0xAB (start) 0x04 (lenght) 0x91 (cmnd) 0xXX (time) 0xXX (time) 0xXX (outlet) 0xXX (Csum) But the time is in Minutes and LS byte first.> And since I'm so green that I don't know what a patch in diff -u format > means, would someone be kind enough to explain how to submit this patch > (or point me to a succinct description). >You can send me the patch, I check it out and if I like it it goes into the driver. Regards Kjell
Charles Lepple
2007-Apr-06 11:45 UTC
[Nut-upsdev] questions re. patching bcmxcp.c and choosing variable names
On 4/6/07, Oliver Wilcock <oliver@owch.ca> wrote:> And since I'm so green that I don't know what a patch in diff -u format > means, would someone be kind enough to explain how to submit this patch > (or point me to a succinct description).As Arjen explained, "diff" is the command name that compares the two files, and usually you want to pass it "-uN" for comparing individual files. If you make a copy of the entire directory before you start, you can run "diff -Naur nut-2.x.y-orig nut-2.x.y" and it will recurse through the directory ("-r") looking for changed files as well as newly added files ("-a"). Also, if you check out the source from SVN, running "svn diff" is equivalent to running "diff -Naur" between the source checked out of SVN, and your local modifications. This is probably the easiest way to stay in sync, because you can always run "svn update" if someone makes a change before your patch gets checked in. -- - Charles Lepple