[Nut-upsdev] upsdrv_print_ups_list and afferant reflections

Charles Lepple clepple at gmail.com
Thu Aug 3 12:34:34 UTC 2006


On 8/3/06, Jonathan Dion <dion.jonathan at gmail.com> wrote:
> Would something like  :
>
> List of supported UPSs
> ===
> VendorID: 0x1234
> ProductID: 0x5678
> ===
> VendorID: 0x9012
> ProductID: 0x3456
> ProductInfo : All UPS of XX vendor
> ===
> .
> .
> .

That's what I meant for the key-value idea. It looks suspiciously like
the output of upsc :-)

> I though again about using my new parser and format for that. It would
> become something like :
>
> #List of supported UPSs
> supported_ups (
>       mge-hid1 (
>             VendorID = "0x1234"
>             ProductID = "0x5678"
>       )
>       mge-hid2 (
>             VendorID = "0x9012"
>             ProductID = "0x3456"
>             ProductInfo = "All UPS of XX vendor"
>       )
>       belkin-hid1 (
>             VendorID = "0x1234"
>             ProductID = "0x5678"
>       )
>       ...
> )
>
> The advantage is that the parser exist (I just have to create a
> entrance point that parse stdin and not a file, it is easy and quick),
> and that it make a tree structure that is easy to manipulate. (and you
> can add any information you want, it is absolutly expandable) We also
> have information about which subdriver supporte which product.
>
> What do you think of it ?

As far as I am concerned, either one is OK. I think it really depends
on where the information is going to be used.

(If I were to write the code, I would probably just write a perl
script or something to parse it, but there are definite advantages to
reusing the same parser to reduce the number of different syntaxes we
have floating around.)

-- 
- Charles Lepple



More information about the Nut-upsdev mailing list