Hi list,

I wanted to close the loop on this with one final comment:

On 07/07/2011 10:55 PM, Eloy Paris wrote:

> On 07/07/2011 04:41 PM, Paul Alfille wrote:
>
>> I think I'm starting to see your question. You are wondering how to read
>> and write in the middle of a "file" (memory buffer).
>
> Yes, with the added complexity (for me to understand how things work)
> that I was trying to do this from the command line, with regular Unix
> utilities like "cat" .
>
>> The command line is an awkward place to do partial file operations.
>
> That's what I learned today. Perhaps "dd", which allows to specify an
> offset and a read size, would work, but definitely not "cat".

As Paul mentioned, there are several ways to read a block of memory from 
a device (for those 1-Wire devices that support this operation). To read 
from the command line one could use owread. However, "cat" cannot be 
used because it does not result in an operating system read() function 
call, which uses offset and size parameters that end up in a 1-Wire 
query (owq) structure.

However, in addition to owread, I found that the "dd" utility also 
allows to do memory reads. Here are two ways I was able to do a device 
memory read using "dd":

dd bs=1 count=2304 if=/owfs2/99.010203040506/generic/memory of=file.bin

dd bs=2304 count=1 if=/owfs2/99.010203040506/generic/memory of=file.bin

The first "dd" invocation took considerable longer than the second 
because, since the block size is 1 (bs=1), it actually issues 2304 
1-Wire read memory commands to read a single byte each time. This 
results in a *lot* of overhead. It's a good stress-test of the system, 
though ;-)

The second invocation is faster because it issues less 1-Wire read 
memory commands (less overhead). The number of 1-Wire read memory 
commands issued depends on how much memory can be read at once -- on the 
BAE and on my device it is 32 bytes (limitation set on the owfs side).

Thanks to Paul and Pascal for their insightful comments.

Cheers,

Eloy Paris.-

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to