---------- Forwarded message ----------

And the show goes on...

I found the reason for familiy/type properties not being able to be read.
Not for the crashes, but making after applying the attached patch to
'ow_read_external.c', it no longer crashed for me.

I found another mistake in the sources: the write script is never being
used, instead the read script is being called - find the patch in
'ow_write_external.c'.

Further observations: the last property parameter (called "other") seems
never to be used. For everyone to test in real life, I created an example
config (just append to your owfs.conf) and a bash script to deliver some
memory and disk statistics.
It is working for me with debian version "2.8p15", because of the trainling
comma in the configuration. Writing is not implemented yet.

BUT be careful - owserver often crashes without any (obvious) reason. It
worked stable before adding the external script, so I will probably remove
it again.


So what's next?
How could I debug those memory access errors that lead to the crash?
I tried DDD without success so far :(

Sven


2014-11-28 20:02 GMT+01:00 Sven Giermann <sven.gierm...@gmail.com>:

> Hi Paul,
>
> thanks for these hints. I have to add, that is is sufficient to have a
> line 'external' in the configuration file, which removes the need for an
> additional argument (easier with preconfigured start scripts).
>
> I figured out some errors in handling external sensors:
>
> 1. parsing the parameters does not trim new-line and tab characters,
> resulting in the last parameter ending with a new-line and probably a
> quote, when quoted (the starting quote is being removed) - find my patch
> attached.
> WORKAROUND for existing binary installations: just add another comma at
> the end of your sensor and script definitions.
>
> 2. owserver crashes when configuring an external sensor with a well-formed
> 1-Wire ID (i.e. "17.FEEDDEADBEAF") while the same ID with non-hex
> characters is working ("17.FILLDEADBEEF"). Seems as if the external sensors
> are only handled by aliasing?
> WORKAROUND: Do not use valid IDs for external sensors!
>
> 3. owserver crashes when reading the type/family properties of external
> sensors.
> WORKAROUND: Do not read these, do not open path to external sensors with
> owhttpd.
> But apart from that, I have multiple crashes for unknown reasons. I always
> get an "memory access error" :-(
>
>
> I will continue testing on another system, since owfs (without external
> sensors) is running stable for some days there.
> Until then I don't have a clue where to look for those crashes on reading
> family and type properties on external sensors...
>
> Sven
>
> 2014-11-27 12:45 GMT+01:00 Paul Alfille <paul.alfi...@gmail.com>:
>
>> Svan,
>>
>> I'm busy with guests today, but a quick perusal of the code suggests:
>>
>> 1. add --external to the command line arguments of owserver
>> 2. Add the SENSOR: and PROPERTY lines to the configuration file
>>
>> See if it works at all.
>>
>> Paul
>>
>> On Thu, Nov 27, 2014 at 5:21 AM, Sven Giermann <sven.gierm...@gmail.com>
>> wrote:
>>
>>> Paul, thanks for the quick reply!
>>>
>>>
>>> 2014-11-27 1:08 GMT+01:00 Paul Alfille <paul.alfi...@gmail.com>:
>>>
>>>> owexternal is actually already built into owserver. It isn't well
>>>> tested since I had no actual use case, so your help will be very
>>>> appreciated.
>>>>
>>>> This is the documentation:
>>>> http://owfs.org/index.php?page=external-sensor-design
>>>>
>>>
>>> I read this, but it's exactly what I don't understand... I don't have
>>> any 'owexternal' binary, maybe I have to compile it from source with
>>> "--enable-owexternal"?
>>> But even after this - where do I put those configuration options
>>> mentioned in the "example syntax"?
>>> Are those 2 separate text files, one for sensors, one for families?
>>> Or do I simply include those lines in owfs.conf, maybe without the need
>>> of an additional owexternal binary?
>>>
>>> And what is the fourth sensor field (/dev/ttyUSB0), the actual parameter
>>> to the read/write scripts?
>>>
>>> To give a general use case, I could simply write a bash script to
>>> display the current memory usage, disk free space and so on.
>>> If one has a LED or beeper in its system, there would also be a use case
>>> for write operations...
>>>
>>>
>>>
>>>
>>> On Wed, Nov 26, 2014 at 3:25 PM, Sven Giermann <sven.gierm...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I just thought about writing my own "owserver" to support a simple
>>>>> relay card with a serial connection. I already have a binary to read and
>>>>> set relay states but need a way to access it from other software.
>>>>> Now the idea was to clone owserver by providing the same interface to
>>>>> allow use of every owfs capable client. While starting to read the code I
>>>>> stunbled across "owexternal" and found some threads in this list.
>>>>>
>>>>> But nothing I could really understand to try it on my own.
>>>>> So I wanted to ask: what is the current development status of
>>>>> "owexternal"?
>>>>>
>>>>> Even if it's still unstable/untested I would be interested in
>>>>> contributing to it - but I need a starting point. What needs to be
>>>>> configured and where?
>>>>> What does the (Perl?) script need to support?
>>>>>
>>>>> Any ideas where to start?
>>>>>
>>>>> Thx, Sven.
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>>>>> from Actuate! Instantly Supercharge Your Business Reports and
>>>>> Dashboards
>>>>> with Interactivity, Sharing, Native Excel Exports, App Integration &
>>>>> more
>>>>> Get technology previously reserved for billion-dollar corporations,
>>>>> FREE
>>>>>
>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
>>>>> _______________________________________________
>>>>> Owfs-developers mailing list
>>>>> Owfs-developers@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>>>>>
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>>>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>>>> with Interactivity, Sharing, Native Excel Exports, App Integration &
>>>> more
>>>> Get technology previously reserved for billion-dollar corporations, FREE
>>>>
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
>>>> _______________________________________________
>>>> Owfs-developers mailing list
>>>> Owfs-developers@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>>> Get technology previously reserved for billion-dollar corporations, FREE
>>>
>>> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Owfs-developers mailing list
>>> Owfs-developers@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>>>
>>>
>>
>
--- owfs-2.9p8/module/owlib/src/c/ow_parse_external.c   Mo  1. Sep 00:33:23 2014
+++ owfs-2.9p8/module/owlib/src/c/ow_parse_external.c   Fr 28. Nov 18:14:16 2014
@@ -40,7 +40,7 @@
 void * family_tree = NULL ;
 void * sensor_tree = NULL ;
 
-// ForAddSensor and AddProperty
+// For AddSensor and AddProperty
 // uses the various tools to get a string into s_name (name is given)
 // start_pointer (a char *) is used and updated.
 #define GetQuotedString( name ) do {                               \
@@ -53,6 +53,10 @@
        s_##name = unquote_parse( trim_parse( s_##name ) ) ;          \
 } while (0) ;
 
+// For trim_parse
+#define IsNonSpaceChar( c ) \
+       ( c != ' ' && c != '\n' && c != '\r' && c != '\t' )
+
 // Look through text_string, ignore backslash and match quoting varibles
 // allocates a new string with the token
 static char * string_parse( char * text_string, char delim, char ** last_char )
@@ -134,7 +138,7 @@
        char * end_position ;
        char * return_string ;
        for ( start_position = raw_string ; start_position[0] ; ++ 
start_position ) {
-               if ( start_position[0] != ' ' ) {
+               if ( IsNonSpaceChar( start_position[0] ) ) {
                        break ;
                }
        }
@@ -144,7 +148,7 @@
        for ( end_position = return_string + strlen( return_string ) ; 
end_position >= return_string ; -- end_position ) {
                if ( end_position[0] == '\0' ) {
                        continue ;
-               } else if ( end_position[0] != ' ' ) {
+               } else if ( IsNonSpaceChar( end_position[0] ) ) {
                        break ;
                } else {
                        end_position[0] = '\0' ;
--- owfs-2.9p8/module/owlib/src/c/ow_read_external.c    Mo  1. Sep 04:28:05 2014
+++ owfs-2.9p8/module/owlib/src/c/ow_read_external.c    Fr 28. Nov 21:00:57 2014
@@ -67,7 +67,7 @@
                                case et_none:
                                        return 0 ;
                                case et_internal:
-                                       return -ENOTSUP ;
+                                       return 
OWQ_format_output_offset_and_size_z( property_n->data, owq ) ;
                                case et_script:
                                        return OW_read_external_script( 
sense_n, property_n, owq ) ;
                                default:
--- owfs-2.9p8/module/owlib/src/c/ow_write_external.c   Mo  1. Sep 04:25:50 2014
+++ owfs-2.9p8/module/owlib/src/c/ow_write_external.c   Fr 28. Nov 22:22:24 2014
@@ -92,7 +92,7 @@
                // not a text sparse name
                snp_return =
                snprintf( cmd, PATH_MAX+1, "%s %s %s %d %s %d %d %s %s",
-                       property_n->read, // command
+                       property_n->write, // command
                        sensor_n->name, // sensor name
                        property_n->property, // property,
                        pn->extension, // extension
@@ -105,7 +105,7 @@
        } else {
                snp_return =
                snprintf( cmd, PATH_MAX+1, "%s %s %s %s %s %d %d %s %s",
-                       property_n->read, // command
+                       property_n->write, // command
                        sensor_n->name, // sensor name
                        property_n->property, // property,
                        pn->sparse_name, // extension

Attachment: owexternal-test.conf
Description: Binary data

Attachment: owexternal.sh
Description: Bourne shell script

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to