From: Thomas <t-g...@ve...> - 2007-09-30 14:16:17
|
Hi everybody, I try to get data from different OW sources (tty, usb, and a NSLUG running owserver) using the perl module 0W.pm (version from owfs-2.6p6) If I use OW.pm to select one of the ow-sources, everything works fine. But if I use: ============= snip ================ foreach my $OWSource (@OWSources) {OW::init($OWSource); $log->debug("OWInit von OWSource => $OWSource"); my $BusData = OW::get("/") or return ; $log->debug("Busdaten: $BusData"); OW::finish(); $log->debug(" OWFinish "); sleep 2; } ============= snap ================ I get: Compilation segmentation fault and in the log-file: 2007/09/30 16:03:10 DEBUG> segfaulttest.pl:151 main:: - OWFS-Sources => 192.168.0.22:3002 u0 2007/09/30 16:03:10 DEBUG> segfaulttest.pl:168 main:: - OWInit von OWSource => 192.168.0.22:3002 2007/09/30 16:03:11 DEBUG> segfaulttest.pl:171 main:: - Busdaten: structure/,bus.0/,uncached/,settings/,system/,statistics/,10.CCFD24010800/,10.A20425010800/,10.019125010800/,10.717A25010800/,10.E99225010800/,10.E78925010800/,10.177125010800/,10.77FE24010800/,10.8FB950000800/,10.1F232C000800/,10.5F2525010800/,81.D64928000000/,alarm/,simultaneous/ 2007/09/30 16:03:11 DEBUG> segfaulttest.pl:175 main:: - OWFinish 2007/09/30 16:03:13 DEBUG> segfaulttest.pl:168 main:: - OWInit von OWSource => u0 So it crashes when it tries to initialise OW::init($OWSource) with the second ow-source. Did I misunderstand the use ow OW.pm ? Is it possible to give OW.pm a list of sources to initialise ? (tried it, but no avail) Help very welcome ! Thomas |
From: Christian M. <ma...@ma...> - 2007-09-30 18:53:47
|
The main problem is in ow_opt.c: int owopt_packed(const char *params) Where getopt_long() is called with first object in OWSources (192.168.0.22:3002) first time... and second time getopt_long() is = called with second object in OWSources (u0). Getopt() are not meant to be used like that... (eg change the argument list), but this is what happens here. Argc and argv is normally not changing. Paul, Do you know if it's possible to reset the state of the getopt() functions? I tried to add this initialization before the while-loop, but it didn't help.. optarg =3D NULL; optind =3D 0; opterr =3D 1; optopt =3D '?'; /Christian > -----Original Message----- > From: owf...@li... [mailto:owfs-cvs- > bo...@li...] On Behalf Of Thomas Gr=FCnberg > Sent: den 30 september 2007 16:16 > To: owf...@li... > Subject: [Owfs-cvs] Using OW.pm in a loop fails with : Compilation > segmentation fault >=20 > Hi everybody, >=20 > I try to get data from different OW sources (tty, usb, and a NSLUG > running > owserver) using the perl module 0W.pm (version from owfs-2.6p6) >=20 > If I use OW.pm to select one of the ow-sources, everything works fine. >=20 > But if I use: >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D snip = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > foreach my $OWSource (@OWSources) > {OW::init($OWSource); > $log->debug("OWInit von OWSource =3D> $OWSource"); >=20 > my $BusData =3D OW::get("/") or return ; > $log->debug("Busdaten: $BusData"); >=20 > OW::finish(); > $log->debug(" OWFinish "); > sleep 2; > } > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D snap = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > I get: Compilation segmentation fault >=20 > and in the log-file: >=20 > 2007/09/30 16:03:10 DEBUG> segfaulttest.pl:151 main:: - OWFS-Sources = =3D> > 192.168.0.22:3002 u0 > 2007/09/30 16:03:10 DEBUG> segfaulttest.pl:168 main:: - OWInit von > OWSource =3D> > 192.168.0.22:3002 > 2007/09/30 16:03:11 DEBUG> segfaulttest.pl:171 main:: - Busdaten: > = structure/,bus.0/,uncached/,settings/,system/,statistics/,10.CCFD240108 > = 00/,10.A20425010800/,10.019125010800/,10.717A25010800/,10.E99225010800/ > = ,10.E78925010800/,10.177125010800/,10.77FE24010800/,10.8FB950000800/,10 > .1F232C000800/,10.5F2525010800/,81.D64928000000/,alarm/,simultaneous/ > 2007/09/30 16:03:11 DEBUG> segfaulttest.pl:175 main:: - OWFinish > 2007/09/30 16:03:13 DEBUG> segfaulttest.pl:168 main:: - OWInit von > OWSource =3D> > u0 >=20 > So it crashes when it tries to initialise OW::init($OWSource) with the > second > ow-source. >=20 > Did I misunderstand the use ow OW.pm ? Is it possible to give OW.pm a > list of > sources to initialise ? (tried it, but no avail) >=20 > Help very welcome ! > Thomas >=20 >=20 > = ----------------------------------------------------------------------- > -- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Owfs-cvs mailing list > Owf...@li... > https://lists.sourceforge.net/lists/listinfo/owfs-cvs |
From: Christian M. <ma...@ma...> - 2007-10-01 07:19:42
|
It's fixed in the cvs now. We might need to change the swig-api a bit, = but I want to hear some more comments from the other developers. -------------------- This script works now. #!/usr/bin/perl use OW ; OW::init("u"); print "Init done\n"; my $BusData =3D OW::get("/"); print "Busdaten: $BusData\n"; OW::finish(); print " OWFinish\n"; sleep 2; OW::init("192.168.3.1:3002"); print "Init done\n"; my $BusData =3D OW::get("/"); print "Busdaten: $BusData\n"; OW::finish(); print " OWFinish\n"; sleep 2; OW::init("--fake 10"); print "Init done\n"; my $BusData =3D OW::get("/"); print "Busdaten: $BusData\n"; OW::finish(); print " OWFinish\n"; sleep 2; OW::init("u"); print "Init done\n"; my $BusData =3D OW::get("/"); print "Busdaten: $BusData\n"; OW::finish(); print " OWFinish\n"; sleep 2; ------------------------- > -----Original Message----- > From: owf...@li... [mailto:owfs-cvs- > bo...@li...] On Behalf Of Thomas Gr=FCnberg > Sent: den 30 september 2007 16:16 > To: owf...@li... > Subject: [Owfs-cvs] Using OW.pm in a loop fails with : Compilation > segmentation fault >=20 > Hi everybody, >=20 > I try to get data from different OW sources (tty, usb, and a NSLUG > running > owserver) using the perl module 0W.pm (version from owfs-2.6p6) >=20 > If I use OW.pm to select one of the ow-sources, everything works fine. >=20 > But if I use: >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D snip = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > foreach my $OWSource (@OWSources) > {OW::init($OWSource); > $log->debug("OWInit von OWSource =3D> $OWSource"); >=20 > my $BusData =3D OW::get("/") or return ; > $log->debug("Busdaten: $BusData"); >=20 > OW::finish(); > $log->debug(" OWFinish "); > sleep 2; > } > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D snap = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > I get: Compilation segmentation fault >=20 > and in the log-file: >=20 > 2007/09/30 16:03:10 DEBUG> segfaulttest.pl:151 main:: - OWFS-Sources = =3D> > 192.168.0.22:3002 u0 > 2007/09/30 16:03:10 DEBUG> segfaulttest.pl:168 main:: - OWInit von > OWSource =3D> > 192.168.0.22:3002 > 2007/09/30 16:03:11 DEBUG> segfaulttest.pl:171 main:: - Busdaten: > = structure/,bus.0/,uncached/,settings/,system/,statistics/,10.CCFD240108 > = 00/,10.A20425010800/,10.019125010800/,10.717A25010800/,10.E99225010800/ > = ,10.E78925010800/,10.177125010800/,10.77FE24010800/,10.8FB950000800/,10 > .1F232C000800/,10.5F2525010800/,81.D64928000000/,alarm/,simultaneous/ > 2007/09/30 16:03:11 DEBUG> segfaulttest.pl:175 main:: - OWFinish > 2007/09/30 16:03:13 DEBUG> segfaulttest.pl:168 main:: - OWInit von > OWSource =3D> > u0 >=20 > So it crashes when it tries to initialise OW::init($OWSource) with the > second > ow-source. >=20 > Did I misunderstand the use ow OW.pm ? Is it possible to give OW.pm a > list of > sources to initialise ? (tried it, but no avail) >=20 > Help very welcome ! > Thomas >=20 >=20 > = ----------------------------------------------------------------------- > -- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Owfs-cvs mailing list > Owf...@li... > https://lists.sourceforge.net/lists/listinfo/owfs-cvs |
From: Christian M. <ma...@ma...> - 2007-10-01 08:30:12
|
Please ignore my last post... I have updated the swig-api again, and I added a new function closeconnection(). This could be called if you want to call init() multiple times. The name of the function may change if we find a better name for it... just wanted to warn you about it.... :) OW::finish() should only be called once in the end to free up all memory. #!/usr/bin/perl use OW ; OW::init("u"); print "Init done\n"; my $BusData = OW::get("/"); print "Busdaten: $BusData\n"; OW::closeconnection(); print " closeconnection\n"; sleep 2; OW::init("--fake 10"); print "Init done\n"; my $BusData = OW::get("/"); print "Busdaten: $BusData\n"; OW::closeconnection(); print " closeconnection\n"; sleep 2; OW::init("192.168.3.1:3002"); print "Init done\n"; my $BusData = OW::get("/"); print "Busdaten: $BusData\n"; OW::closeconnection(); sleep 2; OW::finish(); print " OWFinish\n"; |
From: Christian M. <ma...@ma...> - 2007-10-01 12:35:36
|
I should perhaps tell you that it has always been able to open multiple connections at the same time. OW::init("-u -s 192.168.3.1:3001 --fake 10") This will result into /bus.0 /bus.1 /bus.2 directories where you can = address each connection if you like. The root-directory will show ALL devices found from all connection. /Christian > -----Original Message----- > From: owf...@li... [mailto:owfs-cvs- > bo...@li...] On Behalf Of Thomas Gr=FCnberg > Sent: den 30 september 2007 16:16 > To: owf...@li... > Subject: [Owfs-cvs] Using OW.pm in a loop fails with : Compilation > segmentation fault >=20 > Hi everybody, >=20 > I try to get data from different OW sources (tty, usb, and a NSLUG > running > owserver) using the perl module 0W.pm (version from owfs-2.6p6) >=20 > If I use OW.pm to select one of the ow-sources, everything works fine. >=20 > But if I use: >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D snip = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > foreach my $OWSource (@OWSources) > {OW::init($OWSource); > $log->debug("OWInit von OWSource =3D> $OWSource"); >=20 > my $BusData =3D OW::get("/") or return ; > $log->debug("Busdaten: $BusData"); >=20 > OW::finish(); > $log->debug(" OWFinish "); > sleep 2; > } > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D snap = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > I get: Compilation segmentation fault >=20 > and in the log-file: >=20 > 2007/09/30 16:03:10 DEBUG> segfaulttest.pl:151 main:: - OWFS-Sources = =3D> > 192.168.0.22:3002 u0 > 2007/09/30 16:03:10 DEBUG> segfaulttest.pl:168 main:: - OWInit von > OWSource =3D> > 192.168.0.22:3002 > 2007/09/30 16:03:11 DEBUG> segfaulttest.pl:171 main:: - Busdaten: > = structure/,bus.0/,uncached/,settings/,system/,statistics/,10.CCFD240108 > = 00/,10.A20425010800/,10.019125010800/,10.717A25010800/,10.E99225010800/ > = ,10.E78925010800/,10.177125010800/,10.77FE24010800/,10.8FB950000800/,10 > .1F232C000800/,10.5F2525010800/,81.D64928000000/,alarm/,simultaneous/ > 2007/09/30 16:03:11 DEBUG> segfaulttest.pl:175 main:: - OWFinish > 2007/09/30 16:03:13 DEBUG> segfaulttest.pl:168 main:: - OWInit von > OWSource =3D> > u0 >=20 > So it crashes when it tries to initialise OW::init($OWSource) with the > second > ow-source. >=20 > Did I misunderstand the use ow OW.pm ? Is it possible to give OW.pm a > list of > sources to initialise ? (tried it, but no avail) >=20 > Help very welcome ! > Thomas >=20 >=20 > = ----------------------------------------------------------------------- > -- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Owfs-cvs mailing list > Owf...@li... > https://lists.sourceforge.net/lists/listinfo/owfs-cvs |