ALT Linux Bugzilla
– Attachment 2185 Details for
Bug 12718
[FR] add BNT1200AP support to 'powercom' driver
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
add BNT1200AP support
nut-2.0.4-my-powercom.patch (text/plain), 4.25 KB, created by
Michael Shigorin
on 2007-09-08 02:18:23 MSD
(
hide
)
Description:
add BNT1200AP support
Filename:
MIME Type:
Creator:
Michael Shigorin
Created:
2007-09-08 02:18:23 MSD
Size:
4.25 KB
patch
obsolete
>--- nut-2.0.4.old/drivers/powercom.h 2005-02-28 12:14:07 +0300 >+++ nut-2.0.4/drivers/powercom.h 2006-04-26 09:34:45 +0400 >@@ -43,7 +43,8 @@ > enum commands { > SEND_DATA = '\x01', > BATTERY_TEST = '\x03', >- SHUTDOWN = '\xbc' >+ SHUTDOWN = '\xbc', >+ SHUTDOWN0 ='\xb9' > }; > > /* location of data in received string */ >--- nut-2.0.4.old/drivers/powercom.c 2006-07-10 16:33:14 +0400 >+++ nut-2.0.4/drivers/powercom.c 2007-01-09 14:54:58 +0300 >@@ -117,6 +117,17 @@ > { 5.0000, 0.3268, -825.00, 0.46511, 0 }, > { 1.9216, -0.0977, 0.82857, 0.0000 }, > }, >+ { >+ "BNT1200AP", >+ 16, >+ { "no_flow_control", no_flow_control }, >+ { { 7U, 0U }, { 8U, 0U }, { 8U, 0U } }, >+ { { 2U, 0U }, 'y' }, >+ { 0.00020997, 0.0 }, >+ { 6.1343, -0.3808, 1.075, 0.1811 }, >+ { 5.0000, 0.3268, -825.00, 0.46511, 0 }, >+ { 1.9216, -0.0977, 0.82857, 0.0000 }, >+ }, > }; > > >@@ -124,18 +135,29 @@ > * local used functions > */ > >-static void nut_shutdown(void) >+static void shutdown(void) >+{ >+//printf ("Initiating UPS shutdown!\n"); >+ ser_send_char (upsfd, SHUTDOWN); >+ if (types[type].shutdown_arguments.minutesShouldBeUsed != 'n') >+ ser_send_char (upsfd, '\x00'); >+ ser_send_char (upsfd, '\x10'); >+ upslogx(LOG_INFO, "Shutdown (stayoff) initiated."); >+ exit (0); >+} >+static void shutdown_ret(void) > { >- printf ("Initiating UPS shutdown!\n"); >- >+// printf ("Initiating UPS shutdown!\n"); >+ ser_send_char (upsfd, SHUTDOWN0); > ser_send_char (upsfd, SHUTDOWN); > if (types[type].shutdown_arguments.minutesShouldBeUsed != 'n') >- ser_send_char (upsfd, types[type].shutdown_arguments.delay[0]); >- ser_send_char (upsfd, types[type].shutdown_arguments.delay[1]); >- >+ ser_send_char (upsfd, '\x00'); >+ ser_send_char (upsfd, '\x10'); >+ upslogx(LOG_INFO, "Shutdown (return) initiated."); > exit (0); > } > >+ > /* registered instant commands */ > static int instcmd (const char *cmdname, const char *extra) > { >@@ -143,6 +165,16 @@ > ser_send_char (upsfd, BATTERY_TEST); > return STAT_INSTCMD_HANDLED; > } >+// if (types[type].name=="BNT1200AP"){ >+ if (!strcasecmp(cmdname, "shutdown.return")) { >+ shutdown_ret(); >+ return STAT_INSTCMD_HANDLED; >+ } >+ if (!strcasecmp(cmdname, "shutdown.stayoff")) { >+ shutdown(); >+ return STAT_INSTCMD_HANDLED; >+ } >+// } > > upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); > return STAT_INSTCMD_UNKNOWN; >@@ -353,8 +385,8 @@ > void upsdrv_shutdown(void) > { > /* power down the attached load immediately */ >- printf("Forced UPS shutdown triggered, do it...\n"); >- nut_shutdown(); >+// printf("Forced UPS shutdown (and wait for power)...\n"); >+ shutdown_ret(); > } > > /* initialize UPS */ >@@ -533,6 +565,15 @@ > > /* setup flow control */ > types[type].flowControl.setup_flow_control(); >+ >+ /* tested only for BNT1200AP! */ >+ if (types[type].name=="BNT1200AP"){ >+ if (ser_send_char(upsfd,BATTERY_TEST)!=1){ >+ upslogx(LOG_NOTICE, "writing error"); >+ dstate_datastale(); >+ return; >+ } >+ }; > } > > /* display help */ >@@ -562,6 +603,8 @@ > > /* now add the instant commands */ > dstate_addcmd ("test.battery.start"); >+ dstate_addcmd ("shutdown.return"); >+ dstate_addcmd ("shutdown.stayoff"); > upsh.instcmd = instcmd; > } > >@@ -572,7 +615,7 @@ > addvar(VAR_VALUE, "linevoltage", "Specify line voltage (110-120 or 220-240 V), because it cannot detect automagically (default: 230 V)"); > addvar(VAR_VALUE, "modelname", "Specify model name, because it cannot detect automagically (default: Unknown)"); > addvar(VAR_VALUE, "serialnumber", "Specify serial number, because it cannot detect automagically (default: Unknown)"); >- addvar(VAR_VALUE, "type", "Type of UPS like 'Trust', 'KP625AP', 'KIN2200AP', 'Egys', 'KIN525AP' or 'KIN1500AP' (default: 'Trust')"); >+ addvar(VAR_VALUE, "type", "Type of UPS like 'Trust', 'KP625AP', 'KIN2200AP', 'Egys', 'KIN525AP' or 'KIN1500AP' or 'BNT1200AP' (default: 'Trust')"); > addvar(VAR_VALUE, "numOfBytesFromUPS", "The number of bytes in a UPS frame"); > addvar(VAR_VALUE, "voltage", "A quad to convert the raw data to human readable voltage"); > addvar(VAR_VALUE, "methodOfFlowControl", "The flow control method engaged by the UPS");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 12718
: 2185