Hi,

The MS-TPD is a combined temperature/airflow 1-wire sensor from
ibuttonlink based on a DS2438 chip and a Omron D6F sensor.
http://www.ibuttonlink.com/mstpd.aspx

The airflow value can be computed from the VAD voltage value with linear
approximation from the D6F specs
<http://www.ibuttonlink.com/pdf/omronsensor.pdf>

While I can post-process the VAD value, I'm trying to add support for it into the ow_2438 owlib module (cf. attached patch).

I'd like to add the following file hierarchy :
/26.XXXXXXXXXXXX/D6F/
/26.XXXXXXXXXXXX/D6F/airflow

Unfortunately, when I mount my 1-wire system, connected through a
link-USB device, the D6F directory is present, but it is empty.

Trying to read the D6F/airflow file, I got a "No such file or directory"
error and the attached logs.

As I'm new to fuse development, odds are that I'm missing something pretty obvious, but I can't figure out what it is.

Tested on Debian (sqeeze and lenny), with owfs 2.8p13 and 2.8p14.

I would appreciate any hint you might suggest.


Simon.

--- ow_2438.c	2011-07-15 20:56:54.000000000 +0200
+++ ow_2438.d6f.c	2012-01-09 14:34:18.000000000 +0100
@@ -55,6 +55,7 @@
 READ_FUNCTION(FS_Humid_1735);
 READ_FUNCTION(FS_Humid_3600);
 READ_FUNCTION(FS_Humid_4000);
+READ_FUNCTION(FS_Air_Flow);
 READ_FUNCTION(FS_Humid_datanab);
 WRITE_FUNCTION(FS_reset_datanab);
 READ_FUNCTION(FS_Current);
@@ -166,6 +167,9 @@
 	{"S3-R1-A/current", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_S3R1A_current, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA,},
 	{"S3-R1-A/illuminance", PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_S3R1A_illuminance, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA,},
 	{"S3-R1-A/gain", PROPERTY_LENGTH_PRESSURE, NON_AGGREGATE, ft_float, fc_stable, FS_r_S3R1A_gain, FS_w_S3R1A_gain, VISIBLE, NO_FILETYPE_DATA,},
+
+	{"D6F",PROPERTY_LENGTH_SUBDIR, NON_AGGREGATE, ft_subdir, fc_subdir, NO_READ_FUNCTION, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA,},
+	{"DF6/airflow",PROPERTY_LENGTH_FLOAT, NON_AGGREGATE, ft_float, fc_volatile, FS_Air_Flow, NO_WRITE_FUNCTION, VISIBLE, NO_FILETYPE_DATA,},
 };
 
 DeviceEntryExtended(26, DS2438, DEV_temp | DEV_volt, NO_GENERIC_READ, NO_GENERIC_WRITE);
@@ -354,6 +358,51 @@
 	return 0;
 }
 
+/* D6F flow sensor (MS-TPD)
+*/
+static ZERO_OR_ERROR FS_Air_Flow (struct one_wire_query *owq)
+{
+        _FLOAT T, VAD, VDD;
+        _FLOAT airflow;
+
+        if (
+                FS_r_sibling_F( &VAD, "VAD", owq ) != 0
+             || FS_r_sibling_F( &VDD, "VDD", owq ) != 0
+        ) {
+                return -EINVAL ;
+        }
+        if ( VDD < .01 ) {
+                LEVEL_DEBUG("Low measured VDD %g",VDD);
+                return -EINVAL ;
+        }
+
+
+	if ( VAD < .45 ) {
+		LEVEL_DEBUG("Measured VAD %g out of bounds",VAD);
+		return -EINVAL ;
+	}
+	if (( VAD >= .45 ) && ( VAD < 1.60 )) {
+		airflow = 0 + (VAD - 0.5)*(0.25-0)/(1.60-0.5);
+	}
+	if (( VAD >= 1.60 ) && ( VAD < 2.10 )){
+		airflow = 0.25 + (VAD - 1.60)*(0.50-0.25)/(2.10-1.60);
+	}
+	if (( VAD >= 2.10 ) && ( VAD <= 2.31 )) {
+		airflow = 0.5 + (VAD - 2.10)*(0.75-0.5)/(2.31-2.10);
+	}
+	if (( VAD >= 2.31 ) && ( VAD <= 2.50 )) {
+		airflow = 0.75 + (VAD -2.31 )*(1.0-0.25)/(2.5-2.31);
+	}
+	if ( VAD > 2.50 ) {
+		LEVEL_DEBUG("Measured VAD %g out of bounds",VAD);
+		return -EINVAL ;
+        }
+
+	OWQ_F(owq) = airflow;
+        return 0;
+}
+
+
 /* The HIH-4010 and HIH-4020 are newer versions of the HIH-4000 */
 /* Used in the Hobbyboards humidity product */
 /* Formula from Honeywell datasheet (2007)


sudo  ~/usr/local/bin/owfs --link=/dev/ttyUSB0 --debug -m ~/mnt/owfs/
CONNECT: owfs.c:(100) fuse mount point: /home/simon/mnt/owfs/
   CALL: ow_parsename.c:(95) path=[]
  DEBUG: owlib.c:(79) Globals temp limits 0C 100C (for simulated adapters)
  DEBUG: ow_link.c:(233) Slurp in initial bytes
  DEBUG: ow_link.c:(294) Checking LINK version
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_tcp_read.c:(64) attempt 1 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 1 - 0 = 1
  DEBUG: ow_link.c:(152) Link version is unrecognized: LinkUSB V1.5 (but that's 
ok).
  DEBUG: fuse_line.c:(82) Added FUSE option 0 OWFS
  DEBUG: fuse_line.c:(82) Added FUSE option 1 /home/simon/mnt/owfs/
  DEBUG: fuse_line.c:(82) Added FUSE option 2 -o
  DEBUG: fuse_line.c:(82) Added FUSE option 3 direct_io
  DEBUG: fuse_line.c:(82) Added FUSE option 4 -f
  DEBUG: fuse_line.c:(82) Added FUSE option 5 -d
  DEBUG: owfs.c:(125) fuse_mnt_opt=[(null)]
  DEBUG: owfs.c:(127) fuse_open_opt=[(null)]
FUSE library version: 2.8.4
nullpath_ok: 0
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56
INIT: 7.15
flags=0x0000007b
max_readahead=0x00020000
   INIT: 7.12
   flags=0x00000011
   max_readahead=0x00020000
   max_write=0x00020000
   unique: 1, success, outsize: 40
unique: 2, opcode: GETATTR (3), nodeid: 1, insize: 56
getattr /
   CALL: ow_fstat.c:(22) path=/
   CALL: ow_parsename.c:(95) path=[/]
   CALL: ow_fstat.c:(39) ATTRIBUTES path=/
  DEBUG: ow_parsename.c:(59) /
   unique: 2, success, outsize: 120
unique: 3, opcode: OPENDIR (27), nodeid: 1, insize: 48
   unique: 3, success, outsize: 32
unique: 4, opcode: READDIR (28), nodeid: 1, insize: 80
getdir[0]
   CALL: ow_parsename.c:(95) path=[/]
   CALL: owfs_callback.c:(177) GETDIR path=/
  DEBUG: ow_dir.c:(63) path=/
   CALL: ow_dir.c:(98) path=/
  DEBUG: ow_cache.c:(868) Looking for directory 00 00 00 00 00 00 00 00
  DEBUG: ow_cache.c:(881) Get from cache sn 00 00 00 00 00 00 00 00 
pointer=0x7fd4a8a38fec extension=0
  DEBUG: ow_cache.c:(910) Dir not found in cache
  DEBUG: ow_search.c:(32) Start of directory path=/ device=00 00 00 00 00 00 00 
00
  DEBUG: ow_link.c:(514) Test to see if LINK supports the tF0 command
  DEBUG: ow_tcp_read.c:(64) attempt 4 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 4 - 0 = 4
  DEBUG: ow_tcp_read.c:(64) attempt 5 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 5 - 0 = 5
  DEBUG: ow_link.c:(562) LINK set for normal search
  DEBUG: ow_tcp_read.c:(64) attempt 3 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 3 - 0 = 3
  DEBUG: ow_tcp_read.c:(64) attempt 17 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 17 - 0 = 17
  DEBUG: ow_link.c:(648) SN found: 26 24 55 23 01 00 00 1F
  DEBUG: ow_tcp_read.c:(64) attempt 20 bytes Time: 5.000000 seconds
  DEBUG: ow_tcp_read.c:(114) read: 20 - 0 = 20
  DEBUG: ow_link.c:(648) SN found: 01 65 BC 73 14 00 00 8F
  DEBUG: ow_link.c:(471) Index 0
  DEBUG: ow_link.c:(475) SN found: 26 24 55 23 01 00 00 1F
  DEBUG: ow_search.c:(74) Device found: 26 24 55 23 01 00 00 1F
  DEBUG: ow_cache.c:(561) Adding device location 26 24 55 23 01 00 00 1F bus=0
  DEBUG: ow_cache.c:(650) Add to cache sn 26 24 55 23 01 00 00 1F 
pointer=0x7fd4a8a38fdc index=0 size=4
  DEBUG: ow_cache.c:(561) Adding device location 26 24 55 23 01 00 00 1F bus=0
  DEBUG: ow_cache.c:(650) Add to cache sn 26 24 55 23 01 00 00 1F 
pointer=0x7fd4a8a38fdc index=0 size=4
   CALL: ow_parsename.c:(95) path=[/26.245523010000]
  DEBUG: ow_cache.c:(927) Looking for device 26 24 55 23 01 00 00 1F
  DEBUG: ow_cache.c:(1083) Search in cache sn 26 24 55 23 01 00 00 1F 
pointer=0x7fd4a8a38fdc index=0 size=4
  DEBUG: ow_cache.c:(1099) Value found in cache. Remaining life: 120 seconds.
  DEBUG: ow_presence.c:(76) Found device on bus 0
  DEBUG: ow_parsename.c:(59) /26.245523010000
  DEBUG: ow_link.c:(471) Index 1
  DEBUG: ow_link.c:(475) SN found: 01 65 BC 73 14 00 00 8F
  DEBUG: ow_search.c:(74) Device found: 01 65 BC 73 14 00 00 8F
  DEBUG: ow_cache.c:(561) Adding device location 01 65 BC 73 14 00 00 8F bus=0
  DEBUG: ow_cache.c:(650) Add to cache sn 01 65 BC 73 14 00 00 8F 
pointer=0x7fd4a8a38fdc index=0 size=4
  DEBUG: ow_cache.c:(561) Adding device location 01 65 BC 73 14 00 00 8F bus=0
  DEBUG: ow_cache.c:(650) Add to cache sn 01 65 BC 73 14 00 00 8F 
pointer=0x7fd4a8a38fdc index=0 size=4
   CALL: ow_parsename.c:(95) path=[/01.65BC73140000]
  DEBUG: ow_cache.c:(927) Looking for device 01 65 BC 73 14 00 00 8F
  DEBUG: ow_cache.c:(1083) Search in cache sn 01 65 BC 73 14 00 00 8F 
pointer=0x7fd4a8a38fdc index=0 size=4
  DEBUG: ow_cache.c:(1099) Value found in cache. Remaining life: 120 seconds.
  DEBUG: ow_presence.c:(76) Found device on bus 0
  DEBUG: ow_parsename.c:(59) /01.65BC73140000
  DEBUG: ow_link.c:(471) Index 2
  DEBUG: ow_link.c:(480) SN finished
  DEBUG: ow_cache.c:(484) Adding directory for 00 00 00 00 00 00 00 00 
elements=2
  DEBUG: ow_cache.c:(650) Add to cache sn 00 00 00 00 00 00 00 00 
pointer=0x7fd4a8a38fec index=0 size=16
   CALL: ow_parsename.c:(95) path=[/bus.0]
  DEBUG: ow_parsename.c:(59) /bus.0
   CALL: ow_parsename.c:(95) path=[/uncached]
  DEBUG: ow_parsename.c:(59) /uncached
   CALL: ow_parsename.c:(95) path=[/settings]
  DEBUG: ow_parsename.c:(59) /settings
   CALL: ow_parsename.c:(95) path=[/system]
  DEBUG: ow_parsename.c:(59) /system
   CALL: ow_parsename.c:(95) path=[/statistics]
  DEBUG: ow_parsename.c:(59) /statistics
   CALL: ow_parsename.c:(95) path=[/structure]
  DEBUG: ow_parsename.c:(59) /structure
   CALL: ow_parsename.c:(95) path=[/simultaneous]
  DEBUG: ow_parsename.c:(374) TEST set simultaneous
  DEBUG: ow_parsename.c:(59) /simultaneous
  DEBUG: ow_dir.c:(193) ret=0
  DEBUG: ow_parsename.c:(59) /
   unique: 4, success, outsize: 408
unique: 5, opcode: READDIR (28), nodeid: 1, insize: 80
   unique: 5, success, outsize: 16
unique: 6, opcode: RELEASEDIR (29), nodeid: 1, insize: 64
   unique: 6, success, outsize: 16
unique: 7, opcode: LOOKUP (1), nodeid: 1, insize: 56
LOOKUP /26.245523010000
getattr /26.245523010000
   CALL: ow_fstat.c:(22) path=/26.245523010000
   CALL: ow_parsename.c:(95) path=[/26.245523010000]
  DEBUG: ow_cache.c:(927) Looking for device 26 24 55 23 01 00 00 1F
  DEBUG: ow_cache.c:(1083) Search in cache sn 26 24 55 23 01 00 00 1F 
pointer=0x7fd4a8a38fdc index=0 size=4
  DEBUG: ow_cache.c:(1099) Value found in cache. Remaining life: 113 seconds.
  DEBUG: ow_presence.c:(76) Found device on bus 0
   CALL: ow_fstat.c:(39) ATTRIBUTES path=/26.245523010000
  DEBUG: ow_parsename.c:(59) /26.245523010000
   NODEID: 2
   unique: 7, success, outsize: 144
unique: 8, opcode: LOOKUP (1), nodeid: 2, insize: 44
LOOKUP /26.245523010000/D6F
getattr /26.245523010000/D6F
   CALL: ow_fstat.c:(22) path=/26.245523010000/D6F
   CALL: ow_parsename.c:(95) path=[/26.245523010000/D6F]
  DEBUG: ow_cache.c:(927) Looking for device 26 24 55 23 01 00 00 1F
  DEBUG: ow_cache.c:(1083) Search in cache sn 26 24 55 23 01 00 00 1F 
pointer=0x7fd4a8a38fdc index=0 size=4
  DEBUG: ow_cache.c:(1099) Value found in cache. Remaining life: 113 seconds.
  DEBUG: ow_presence.c:(76) Found device on bus 0
   CALL: ow_fstat.c:(39) ATTRIBUTES path=/26.245523010000/D6F
  DEBUG: ow_parsename.c:(59) /26.245523010000/D6F
   NODEID: 3
   unique: 8, success, outsize: 144
unique: 9, opcode: OPENDIR (27), nodeid: 3, insize: 48
   unique: 9, success, outsize: 32
unique: 10, opcode: READDIR (28), nodeid: 3, insize: 80
getdir[0]
   CALL: ow_parsename.c:(95) path=[/26.245523010000/D6F]
  DEBUG: ow_cache.c:(927) Looking for device 26 24 55 23 01 00 00 1F
  DEBUG: ow_cache.c:(1083) Search in cache sn 26 24 55 23 01 00 00 1F 
pointer=0x7fd4a8a38fdc index=0 size=4
  DEBUG: ow_cache.c:(1099) Value found in cache. Remaining life: 113 seconds.
  DEBUG: ow_presence.c:(76) Found device on bus 0
   CALL: owfs_callback.c:(177) GETDIR path=/26.245523010000/D6F
  DEBUG: ow_dir.c:(63) path=/26.245523010000/D6F
   CALL: ow_dir.c:(98) path=/26.245523010000/D6F
  DEBUG: ow_dir.c:(193) ret=0
  DEBUG: ow_parsename.c:(59) /26.245523010000/D6F
   unique: 10, success, outsize: 80
unique: 11, opcode: READDIR (28), nodeid: 3, insize: 80
   unique: 11, success, outsize: 16
unique: 12, opcode: RELEASEDIR (29), nodeid: 3, insize: 64
   unique: 12, success, outsize: 16
unique: 13, opcode: LOOKUP (1), nodeid: 1, insize: 56
LOOKUP /26.245523010000
getattr /26.245523010000
   CALL: ow_fstat.c:(22) path=/26.245523010000
   CALL: ow_parsename.c:(95) path=[/26.245523010000]
  DEBUG: ow_cache.c:(927) Looking for device 26 24 55 23 01 00 00 1F
  DEBUG: ow_cache.c:(1083) Search in cache sn 26 24 55 23 01 00 00 1F 
pointer=0x7fd4a8a38fdc index=0 size=4
  DEBUG: ow_cache.c:(1099) Value found in cache. Remaining life: 106 seconds.
  DEBUG: ow_presence.c:(76) Found device on bus 0
   CALL: ow_fstat.c:(39) ATTRIBUTES path=/26.245523010000
  DEBUG: ow_parsename.c:(59) /26.245523010000
   NODEID: 2
   unique: 13, success, outsize: 144
unique: 14, opcode: LOOKUP (1), nodeid: 2, insize: 44
LOOKUP /26.245523010000/D6F
getattr /26.245523010000/D6F
   CALL: ow_fstat.c:(22) path=/26.245523010000/D6F
   CALL: ow_parsename.c:(95) path=[/26.245523010000/D6F]
  DEBUG: ow_cache.c:(927) Looking for device 26 24 55 23 01 00 00 1F
  DEBUG: ow_cache.c:(1083) Search in cache sn 26 24 55 23 01 00 00 1F 
pointer=0x7fd4a8a38fdc index=0 size=4
  DEBUG: ow_cache.c:(1099) Value found in cache. Remaining life: 106 seconds.
  DEBUG: ow_presence.c:(76) Found device on bus 0
   CALL: ow_fstat.c:(39) ATTRIBUTES path=/26.245523010000/D6F
  DEBUG: ow_parsename.c:(59) /26.245523010000/D6F
   NODEID: 3
   unique: 14, success, outsize: 144
unique: 15, opcode: LOOKUP (1), nodeid: 3, insize: 48
LOOKUP /26.245523010000/D6F/airflow
getattr /26.245523010000/D6F/airflow
   CALL: ow_fstat.c:(22) path=/26.245523010000/D6F/airflow
   CALL: ow_parsename.c:(95) path=[/26.245523010000/D6F/airflow]
  DEBUG: ow_cache.c:(927) Looking for device 26 24 55 23 01 00 00 1F
  DEBUG: ow_cache.c:(1083) Search in cache sn 26 24 55 23 01 00 00 1F 
pointer=0x7fd4a8a38fdc index=0 size=4
  DEBUG: ow_cache.c:(1099) Value found in cache. Remaining life: 106 seconds.
  DEBUG: ow_presence.c:(76) Found device on bus 0
  DEBUG: ow_parsename.c:(646) Unknown property for this device D6F/airflow
  DEBUG: ow_parsename.c:(152) Set error to 27 <Path - bad path syntax>
  DEBUG: ow_parsename.c:(59) /26.245523010000/D6F/airflow
  DEBUG: ow_parsename.c:(59) /26.245523010000/D6F/airflow
   unique: 15, error: -2 (No such file or directory), outsize: 16


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to