New config option help

9 views
Skip to first unread message

hojo

unread,
Sep 17, 2013, 10:33:25 AM9/17/13
to barnyar...@googlegroups.com
I'll admit that my C skill is holding me back here.

I've added a new command line option, updated the valid_options, added the case statement that sets bc->skip_payload = 1 and added the member to Barnyard2Config in barnyard2.h.  It all complies happily and I've verified that when passing -k, the case fires.   Over in spo_database.c, however, I can't get the data.  I see that the module is using barnyard2_conf in places like:

data->sensor_name = GetUniqueName(PRINT_INTERFACE(barnyard2_conf->interface));

When I try to check 

if (barnyard2_conf->skip_payload) 

it's always 0.  Do I need to pass the config data to spo_database in a different way?

Thanks,
-hojo

beenph

unread,
Sep 17, 2013, 10:59:16 AM9/17/13
to barnyar...@googlegroups.com
Hi Hojo,
 
In barnyard2.c take a look at MergeBarnyard2Confs(Barnyard2Config *cmd_line, Barnyard2Config *config_file).
 
Its where you want to set your value for the final configuration if its a cmd_line arg vs a configuration file option.
 
Hope this helps.
 
-elz

 


--
 
---
You received this message because you are subscribed to the Google Groups "barnyard2-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to barnyard2-dev...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

hojo

unread,
Sep 17, 2013, 11:44:08 AM9/17/13
to barnyar...@googlegroups.com


On Tuesday, September 17, 2013 8:59:16 AM UTC-6, Eric Lauzon wrote:
Hi Hojo,
 
In barnyard2.c take a look at MergeBarnyard2Confs(Barnyard2Config *cmd_line, Barnyard2Config *config_file).
 
Its where you want to set your value for the final configuration if its a cmd_line arg vs a configuration file option.

That did the trick.  Thanks!

 
 
Hope this helps.
 

Dave Hajoglou

unread,
Sep 17, 2013, 12:03:51 PM9/17/13
to barnyar...@googlegroups.com
On a side note, is it considered good form to call barnyard2_conf or to write a static function to get config params?


beenph

unread,
Sep 17, 2013, 12:27:22 PM9/17/13
to barnyar...@googlegroups.com
On Tue, Sep 17, 2013 at 12:03 PM, Dave Hajoglou <dhaj...@gmail.com> wrote:
>
> On a side note, is it considered good form to call barnyard2_conf or to write a static function to get config params?
>

Obviously if you implement SET and GET wrapper its less error prone in
the long run. It allways depend on your needs.
Reply all
Reply to author
Forward
0 new messages