[Nut-upsdev] Liebert ESP II driver

Arjen de Korte nut+devel at de-korte.org
Fri Jul 30 14:31:38 UTC 2010


Citeren Robert Jobbagy <jobbagy.robert op gmail.com>:

> This is my shutdown function:
>
> void upsdrv_shutdown(void)
> {
>     int ret;
>
>     fprintf(stderr,"SHUTDOWN 1");

This doesn't work. The driver backgrounds before it reaches this  
point, so you can't use fprintf at this point anymore.

>     ret = ser_send_buf(upsfd, cmd_UPSShutdown0, SHUTDOWN_CMD_LEN);
>     if (ret < 0) {
>         upsdebug_with_errno(2, "send");
>         return -1;
>     }
>     else if (ret < 6) {
>         upsdebug_hex(2, "send: truncated", cmd_UPSShutdown0, ret);
>         return -1;
>     }

A void function can't return a value. Does the above actually compile  
without errors? If it does, change the compiler flags so that it  
doesn't. Also make sure that you're running your freshly compiled  
driver.

[...]

> These commands works other way , but in this function didnt work
>
> And I cant found the "SHUTDOWN 1,2,3" test texts in debug.log, so I think
> dont sent these commands to UPS.

See above.

Best regards, Arjen
-- 
Please keep list traffic on the list




More information about the Nut-upsdev mailing list