[Owfs-developers] direct_io in fuse

2005-06-21 Thread Christian Magnusson

BTW: Shouldn't we try to mount the fuse-directory with the
-odirect_io option just to make the read-operations atomic.
I'm mostly thinking about the the LCD's counters.ALL which reset
every time you read it, but without this option two different
processes could catch a pressed button.

 cat /var/1wire/FF.72020100/counters.ALL
   0,   0,   2,   0

The same goes for all uncached files which are supposed to return
a new value... not some other ongoing conversion from another
process.

I thought about it when I say this post from Miklos in fuse-devel.

/Christian


 I have a question about the usage of the sleep function with
 fuse. When I tried to use sleep(20) in the read function of
 hello.c. And then tried to read from it 2 times (the 2nd proces was
 started 10 sec later) the 1st proces would stop after 20 seconds but
 the 2nd proces would stop when the 1st process stopped thus after 10
 seconds. Is this the right behaviour? If so why?

Data from the first read is cached, and immediately returned to the
second read, once the first was completed.

You can try '-odirect_io' to make each read() start a new request.

Miklos


-- 
Christian Magnusson [EMAIL PROTECTED]



---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] More on Hanging Problems

2005-06-21 Thread Jan Kandziora
Am Dienstag, 21. Juni 2005 04:46 schrieb Paul Alfille:
 On Monday 20 June 2005 04:38 pm, Jan Kandziora wrote:
  Dear Paul,
 
  I've investigated further on the problem I described last week (in the
  thread owtcl and writing data).
 
  It seems to be related to EMC: Nearly every time I switch on a large
  240/24V AC transformer I need for my project, I get a single error of the
  kind I described. But sometimes, it is even a cascade of such errors,
  which I can't bring into connection to any action I took (not). Maybe, it
  was the fluorescent light on last week, but today, I didn't turn them on
  and still got cascades of such errors (over about 1 minute).
 
  Then again, everything is fine for a couple of minutes.

 Is it possible to add shielding?

From overall engineering point of view, shielding makes things worse.
Cables are thicker and harder to bend, heat is dissipated worse and even then, 
there is no guarantee you won't encounter any problems - There is hardly any 
shielding that could withstand a large electromagnetic pulse sent by a mains 
transformator or other impedance switched on at maximum voltage of the sine 
wave. To allow this, the shielding has to be connected to earth with a 
maximum resistance about 1 milliohms, which rules out any kind of connectors 
(and most kinds of earth, too).

This is a general problem. All better transmission protocols have some 
retry-funtion, if such a situation happens - which is often.


  I checked for USB errors with dmesg, and got very few USB disconnects
  (about 1 of 30 times), but no other USB link layer errors. On the most
  tries, only the 1-wire seemed to be affected.

 The question is what is the program/port's state after one of these errors.
 It seems like there is nor recovery after an error. (i.e., the system
 doesn't work intermittently, only yes or no). If the error causes the USB
 port to close, life is easy.

I tried about 70..80 switches, only 2 times the USB connection broke; most 
times, the 1-wire connection broke; sometimes, nothing happened (must have 
switched on near zero-cross)


 We can re-open the USB port more easily than a full restart. We don't need
 to enumerate the devices, or resort the internal data structures.

Ok. That would bring down the recovery time for usb fail to the values for 
recovery of 1-wire.


 
  1. Is there any way to detect an unrecoverable error on bus side?
  2. I want to use owserver. You offered to change owserver to restart the
  connection automatically: How is the development status for this?
  3. Is there any way to process the init sequence faster? For USB errors,
  it would not be so dramatic if it takes 3 to 5 seconds to recover, as I
  expect them to be very rare. However, the 1-Wire error happens *every
  time* a big inductive load is switched near the device, so a faster
  recovery would be a big help.

 Ho do I tell the 1-wire error from normal failures? (Wrong addresses,
 bits lost, ...)

All the device nodes in the mnt/1wire/uncached directory are gone in that 
case, even the one for the adaptor chip! owserver just fails in that 
situation. I think there already is a function that cleans up that 
directory or exit()s owserver.

Kind regards

Jan



---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77alloc_id492op=click
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] More on Hanging Problems

2005-06-21 Thread Jan Kandziora
Am Dienstag, 21. Juni 2005 08:43 schrieb Christian Magnusson:
 I have actually also noticed some of those problems too... I have one
 of my LCD-displays in my office very close to the lamp-switch, and
 sometimes owserver has hanged at the same time as I entered the room
 and switched on the lamp and just walked through the room to get a
 screwdriver or something else. The 1-wire bus is connected to my uClinux
 board in the office too, so I have had those thoughts for some time
 that it has to be some connection between the EMC and the 1-wire
 bus stability.

I'm glad I'm not the only person who encountered this kind of error. I just 
thought I will either lose my credibility or my mind.


 I have never needed to remove the power supply to the 1-wire adapter
 when the problem has occurred. I have just needed to restart owserver
 and I had plans to do this automatically for a long time.

Yes, same for me. But it takes about 2 seconds to detect a failed owserver and 
to restart it - for local owserver. For remote owserver, things are even 
worse. It would be far better owserver wouldn't fail in this situation, but 
just re-initialize, maybe only the 1-wire, to get rid of the problem.


 It would be nice if you could look in the /bus.0/statistics/errors
 and see where the errors increase when you have problem next time.
 (Either from owhttp or owfs and connect to the failing owserver)

 When I have had problems, it's usually DS2480_reset_errors which
 increase every time I try to read something on the 1-wire bus.

Ok, I will do this in the evening.


 I think it would be safe to add a re-initialization of the 1-wire
 adapter when some of those errors occur:

 DS2480_reset_errors
 DS9097_reset_errors
 DS9490_reset_errors
 (and perhaps if DS2480_read_timeout is large I think...)

 if(DS2480_reset_errors || DS9097_reset_errors || DS9490_reset_errors) {
   COM_close(in);
   usleep(10);
   COM_open(in);
   if ( DS2480_detect(in) ) {
 if ( DS9097_detect(in) ) {
   ret = -ENODEV;
 }
   }
 }

 Something like this would probably be enough to make a reset of the
 adapter when the 1-wire bus fails.

I'm willing to dig into owlib to make up the necessary functions if someone 
guides me. Then I can try out if it helps.

Kind regards

Jan


---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


RE: [Owfs-developers] More on Hanging Problems

2005-06-21 Thread Alfille, Paul H.,M.D.

DS2480_reset_errors
DS9097_reset_errors
DS9490_reset_errors
(and perhaps if DS2480_read_timeout is large I think...)

if(DS2480_reset_errors || DS9097_reset_errors || DS9490_reset_errors) {
  COM_close(in);
  usleep(10);
  COM_open(in);
  if ( DS2480_detect(in) ) {
if ( DS9097_detect(in) ) {
  ret = -ENODEV;
}
  }
}

Something like this would probably be enough to make a reset of the
adapter when the 1-wire bus fails.

--
This would work, but there may be a more efficient DS9490_detect, I made room
for the USB device handle in connection_in
in-connin.usb.dev so we can break out the internal part of DS9490_detect and
save re-enumerating the entire USB bus.

Perhaps a fallback of re-enumerating if the simpler routine fails.

Paul


https://lists.sourceforge.net/lists/listinfo/owfs-developers


---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77alloc_id492op=click
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


RE: [Owfs-developers] More on Hanging Problems

2005-06-21 Thread Alfille, Paul H.,M.D.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Jan
Kandziora
Sent: Tuesday, June 21, 2005 4:12 AM
To: owfs-developers@lists.sourceforge.net
Subject: Re: [Owfs-developers] More on Hanging Problems


Am Dienstag, 21. Juni 2005 04:46 schrieb Paul Alfille:
 On Monday 20 June 2005 04:38 pm, Jan Kandziora wrote:
  Dear Paul,
 
  I've investigated further on the problem I described last week (in the
  thread owtcl and writing data).
 
  It seems to be related to EMC: Nearly every time I switch on a large
  240/24V AC transformer I need for my project, I get a single error of the
  kind I described. But sometimes, it is even a cascade of such errors,
  which I can't bring into connection to any action I took (not). Maybe, it
  was the fluorescent light on last week, but today, I didn't turn them on
  and still got cascades of such errors (over about 1 minute).
 
  Then again, everything is fine for a couple of minutes.

 Is it possible to add shielding?

From overall engineering point of view, shielding makes things worse.
Cables are thicker and harder to bend, heat is dissipated worse and even then, 
there is no guarantee you won't encounter any problems - There is hardly any 
shielding that could withstand a large electromagnetic pulse sent by a mains 
transformator or other impedance switched on at maximum voltage of the sine 
wave. To allow this, the shielding has to be connected to earth with a 
maximum resistance about 1 milliohms, which rules out any kind of connectors 
(and most kinds of earth, too).

This is a general problem. All better transmission protocols have some 
retry-funtion, if such a situation happens - which is often.


  I checked for USB errors with dmesg, and got very few USB disconnects
  (about 1 of 30 times), but no other USB link layer errors. On the most
  tries, only the 1-wire seemed to be affected.

 The question is what is the program/port's state after one of these errors.
 It seems like there is nor recovery after an error. (i.e., the system
 doesn't work intermittently, only yes or no). If the error causes the USB
 port to close, life is easy.

I tried about 70..80 switches, only 2 times the USB connection broke; most 
times, the 1-wire connection broke; sometimes, nothing happened (must have 
switched on near zero-cross)


 We can re-open the USB port more easily than a full restart. We don't need
 to enumerate the devices, or resort the internal data structures.

Ok. That would bring down the recovery time for usb fail to the values for 
recovery of 1-wire.


 
  1. Is there any way to detect an unrecoverable error on bus side?
  2. I want to use owserver. You offered to change owserver to restart the
  connection automatically: How is the development status for this?
  3. Is there any way to process the init sequence faster? For USB errors,
  it would not be so dramatic if it takes 3 to 5 seconds to recover, as I
  expect them to be very rare. However, the 1-Wire error happens *every
  time* a big inductive load is switched near the device, so a faster
  recovery would be a big help.

 Ho do I tell the 1-wire error from normal failures? (Wrong addresses,
 bits lost, ...)

All the device nodes in the mnt/1wire/uncached directory are gone in that 
case, even the one for the adaptor chip! owserver just fails in that 
 GREAT! ^^ something to test.

situation. I think there already is a function that cleans up that 
directory or exit()s owserver.

Kind regards

Jan



---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77alloc_id492op=ick
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77alloc_id492op=click
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


RE: [Owfs-developers] direct_io in fuse

2005-06-21 Thread Alfille, Paul H.,M.D.
Absolutely. Do you want to do it, or should I?

Paul

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Christian Magnusson
Sent: Tuesday, June 21, 2005 2:54 AM
To: owfs-developers
Subject: [Owfs-developers] direct_io in fuse



BTW: Shouldn't we try to mount the fuse-directory with the
-odirect_io option just to make the read-operations atomic.
I'm mostly thinking about the the LCD's counters.ALL which reset
every time you read it, but without this option two different
processes could catch a pressed button.

 cat /var/1wire/FF.72020100/counters.ALL
   0,   0,   2,   0

The same goes for all uncached files which are supposed to return
a new value... not some other ongoing conversion from another
process.

I thought about it when I say this post from Miklos in fuse-devel.

/Christian


 I have a question about the usage of the sleep function with
 fuse. When I tried to use sleep(20) in the read function of
 hello.c. And then tried to read from it 2 times (the 2nd proces was
 started 10 sec later) the 1st proces would stop after 20 seconds but
 the 2nd proces would stop when the 1st process stopped thus after 10
 seconds. Is this the right behaviour? If so why?

Data from the first read is cached, and immediately returned to the
second read, once the first was completed.

You can try '-odirect_io' to make each read() start a new request.

Miklos


-- 
Christian Magnusson [EMAIL PROTECTED]



---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77alloc_id492op=click
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers