Hello dear friends.

New tests!


root@CONSTANT:~> echo -n 
'1,NO,0,OFF,0,0,,#2,NO,0,OFF,0,0,,#3,NO,0,OFF,0,0,,#4,NO,0,OFF,0,0,,#5,NO,0,OFF,0,0,,#6,NO,0,OFF,0,0,,#7,NO,0,OFF,0,0,,#8,NO,0,OFF,0,0,,#'|
 
gzip -c  > ee

root@CONSTANT:~> cat ee | hexdump -C
00000000  1f 8b 08 00 03 2a 02 58  00 03 33 d4 f1 f3 d7 31 
|.....*.X..3....1|
00000010  d0 f1 77 73 03 92 06 3a  3a ca 46 e8 02 c6 e8 02 
|..ws...::.F.....|
00000020  26 e8 02 a6 e8 02 66 e8  02 e6 e8 02 16 e8 02 00 
|&.....f.........|
00000030  be 53 9c e3 88 00 00 00                           |.S......|
00000038

root@CONSTANT:~> owwrite -s 172.19.19.10 /relay_setting/RELAY_SET  `cat ee`

And now at the owserver host:

root@CONSTANT2:~> cat /etc/constant_control.bin | hexdump -C
00000000  1f 8b 08 03 2a 02 58 03  33 d4 f1 f3 d7 31 d0 f1 
|....*.X.3....1..|
00000010  77 73 03 92 06 3a 3a ca  46 e8 02 c6 e8 02 26 e8 
|ws...::.F.....&.|
00000020  02 a6 e8 02 66 e8 02 e6  e8 02 16 e8 02 be 53 9c 
|....f.........S.|
00000030  e3 88                                             |..|
00000032

Some bytes are lost. (00 - this bytes are lost!!! May be something
else..)

My server config:

root@CONSTANT2:~> cat /etc/owfs.conf
i2c=/dev/i2c-1:ALL

server: port=4304
server: i2c

owfs: mountpoint = /OWFS
owfs: server = 4304

external
SENSOR: "relay_setting", "constant_family", "owfs2relay_control", 
'yet_more_params',
SCRIPT: "RELAY_SET", "constant_family", b1024, 1, u, /opt/nick_read, 
/opt/nick_write, 'something_trash'

and /opt/nick_read or /opt/nick_write files:

root@CONSTANT2:~> cat /opt/nick
#!/bin/sh
RW=$4

case "$RW" in
         read)  cat /etc/constant_control.bin ;;
         write) cat > /etc/constant_control.bin ;;
esac

AND /etc/constant_control.bin file:

root@CONSTANT2:~> cat /etc/constant_control.bin | hexdump -C
00000000  1f 8b 08 03 2a 02 58 03  33 d4 f1 f3 d7 31 d0 f1 
|....*.X.3....1..|
00000010  77 73 03 92 06 3a 3a ca  46 e8 02 c6 e8 02 26 e8 
|ws...::.F.....&.|
00000020  02 a6 e8 02 66 e8 02 e6  e8 02 16 e8 02 be 53 9c 
|....f.........S.|
00000030  e3 88                                             |..|
00000032

READ:root@CONSTANT:~> owread -s 172.19.19.10 /relay_setting/RELAY_SET | 
hexdump -C 
                     00000000  1f 8b 08 03 2a 02 58 03  33 d4 f1 f3 d7 
31 d0 f1  |....*.X.3....1..|
00000010  77 73 03 92 06 3a 3a ca  46 e8 02 c6 e8 02 26 e8 
|ws...::.F.....&.|
00000020  02 a6 e8 02 66 e8 02 e6  e8 02 16 e8 02 be 53 9c 
|....f.........S.|
00000030  e3 88 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
|................|
00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
|................|
*
00000400

The read is normal (How many bytes it read? Is it round file length?),
but write is not good.

Can you show my error? Or is the error in the ownet?

Henry.



14.10.2016 22:53, Henry Pootel пишет:
> Hello.
>
> Using owfs-3.1p4.
>
> I need to write binary data to an external sensor.
>
> I do this settings:
>
> owfs.conf
> ...
> SCRIPT: "RELAY_SET", "constant_family", b1024, 1, u, /opt/_read,
> /opt/_write, ''
> ...
>
> The main is b1024. Is it right?
>
> And write from a client by perl script:
>
> OWNet::write( "$dev_ip:4304" , "/relay_setting/RELAY_SET", `echo -n $ss
> | gzip -c` );
>
> As you see, I write a gziped data.
>
> Client Hexdump is -
> [0000] 1F 8B 08 00 6C 3D 01 58 00 03 33 D4 F1 F3 D7 31....
>
> But!
>
> root@CONSTANT:~> owread -s 172.19.19.10 /relay_setting/RELAY_SET  | hexdump
> 0000000 088b 6c00 013d 0058 3303 f1d4 d7f3 d031
> 0000010 77f1 0373 0692 3a3a 46ca 02e8 e8c6 2602
> 0000020 02e8 e8a6 6602 02e8 e8e6 1602 02e8 be00
> 0000030 9c53 88e3 0000 0000 0000 0000 0000 0000
> 0000040 0000 0000 0000 0000 0000 0000 0000 0000
> *
> 0000400
>
> My script make a simple cat to file. We are can see this file:
>
> cat constant_control.bin  | hexdump
> 0000000 088b 6c00 013d 0058 3303 f1d4 d7f3 d031
> 0000010 77f1 0373 0692 3a3a 46ca 02e8 e8c6 2602
> 0000020 02e8 e8a6 6602 02e8 e8e6 1602 02e8 be00
> 0000030 9c53 88e3 0000 0000
> 0000038
>
> I think, first byte is lost and...
> By another words, I can unzip the owread data.
>
> Please, where is first byte or my mistake?
>
> cat /opt/_write
> #!/bin/sh
> RW=$4
>
> case "$RW" in
>          read)  cat /etc/constant_control.bin ;;
>          write) cat > /etc/constant_control.bin ;;
> esac
>
>
> Thanks.
>

-- 

== Henry Pootel ==

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to