[Nut-upsdev] R: Small fixes needed for Riello driver

Elio Parisi E.Parisi at riello-ups.com
Tue Apr 9 15:46:06 UTC 2013


Hi Charles,

attached there are the patch that fixed all the three points.

Let me know if all is ok.

Regards,





Elio Parisi

Centro Ricerche
RPS SpA
Viale Europa, 7
37045 Legnago VR
Tel. +39 0442 635811 Fax. +39 0442 635934
Skype Id:  - Voip:
E-mail: E.Parisi at riello-ups.com
Web: www.riello-ups.com
--------------------------------------------------------------------------
Per favore non stampare questo messaggio se proprio non è
necessario
Please consider the environment before printing this e-mail
--------------------------------------------------------------------------

Chi riceve il presente  messaggio e` tenuto a
verificare se lo stesso non gli sia pervenuto per  errore.  In tal
caso e` pregato di avvisare immediatamente il mittente  e,
tenuto  conto  delle  responsabilita` connesse  all'indebito
utilizzo e/o  divulgazione  del  messaggio  e/o
delle  informazioni  in esso contenute,  voglia
cancellare  l'originale  e distruggere  le varie copie  o
stampe.

The receiver  of this message is required to check
if  he/she has received it erroneously.  If  so,  the
receiver  is  requested to immediately inform the sender and - in
consideration of the responsibilities  arising from undue use and/or
disclosure of the message  and/or  the information contained therein -
destroy the original message and any copy or printout thereof.



-----Messaggio originale-----
Da: Charles Lepple [mailto:clepple at gmail.com]
Inviato: martedì 9 aprile 2013 14.38
A: Elio Parisi
Cc: nut-upsdev list
Oggetto: Small fixes needed for Riello driver

Elio,

1) The comment block in drivers/riello.h points to the Megatec protocol documentation. Are the links in drivers/riello.c correct? If so, we can change the .h file to match the .c file.

2) clang caught this bug:

drivers/riello.c:984:28: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]

As a result, memset() will only clear the first 4 or 8 bytes of the buffer.

This is in Git master (12d6e76).

I would recommend creating a typedef for the buffer which includes the size (e.g. BYTE[128] rather than BYTE*), or using a #define and changing the sizeof() to reference that definition.

Also, is there a particular need for the BYTE/WORD/DWORD typedefs? It is useful to have consistency across all the drivers, and in this case, I would use the stdint.h definitions to make the size and signed-ness explicit (e.g. uint16_t instead of WORD).

--
Charles Lepple
clepple at gmail



-------------- next part --------------
A non-text attachment was scrubbed...
Name: riello.diff.gz
Type: application/x-gzip
Size: 57 bytes
Desc: riello.diff.gz
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20130409/d8fedb22/attachment.bin>


More information about the Nut-upsdev mailing list