init port only first applied (cul and rfxcom)

Begonnen von Guest, 18 Januar 2011, 09:28:51

Vorheriges Thema - Nächstes Thema

Guest

Originally posted by: <email address deleted>

I have in my fhem.cfg 2 devices

define CUL CUL /dev/cul868 4631

define RFXCOM RFXCOM /dev/rfxcom


The cul has paramaters for init the serial and the rfxcom also.

When I reboot the system, like this the cul works correct and the
rfxcom doesn't.


When I run fhem again, I see with stty -F /dev/rfxcom, while start
fhem the correct parameters, but when it's complete started, it has
again the default parameters. So in het log of fhem, It has corrected
init, but the setting doesn't stay on the port.

log

2011.01.18 09:21:20 0: Server shutdown
2011.01.18 09:22:17 3: CUL opening CUL device /dev/cul868
2011.01.18 09:22:17 3: CUL device opened
2011.01.18 09:22:17 3: RFXCOM opening RFXCOM device /dev/rfxcom
2011.01.18 09:22:17 1: RFXCOM: RFXCOM_OpenDev /dev/rfxcom done
2011.01.18 09:22:17 3: RFXCOM: device opened
2011.01.18 09:22:18 1: RFXCOM: Init OK
2011.01.18 09:22:18 2: FHEMWEB port 8083 opened
2011.01.18 09:22:18 2: FHEMWEB port 8084 opened

port settings after reboot

 stty -F /dev/rfxcom
speed 9600 baud; line = 0;
-brkint -imaxbel

stty -F /dev/cul868
speed 9600 baud; line = 0;
min = 0; time = 0;
ignbrk -brkint -icrnl -imaxbel
-opost
-isig -icanon -iexten -echo


Then I putted in the fhem.cfg the devices like this and rebooted the
system

define RFXCOM RFXCOM /dev/rfxcom

define CUL CUL /dev/cul868 4631

log

2011.01.18 09:25:35 1: RFXCOM: RFXCOM_OpenDev /dev/rfxcom done
2011.01.18 09:25:35 3: RFXCOM: device opened
2011.01.18 09:25:36 1: RFXCOM: Init OK
2011.01.18 09:25:36 3: CUL opening CUL device /dev/cul868
2011.01.18 09:25:36 3: CUL device opened
2011.01.18 09:25:37 2: FHEMWEB port 8083 opened
2011.01.18 09:25:37 2: FHEMWEB port 8084 opened
2011.01.18 09:25:37 0: Server started (version 5.0 from 2010-08-15
($Id: fhem.pl,v 1.111 2010-09-30 13:12:27 rudolfkoenig Exp $), pid
1022)
2011.01.18 09:25:43 2: CUL: unknown message ? (K018481562C is unknown)
Use one of B C F A G M R T V W X e f m l t u x

port settings

stty -F /dev/rfxcom
speed 4800 baud; line = 0;
min = 0; time = 0;
ignbrk -brkint -icrnl -imaxbel
-opost
-isig -icanon -iexten -echo

stty -F /dev/cul868
speed 9600 baud; line = 0;
-brkint -imaxbel


Than the rfxcom works correct , but the cul has errors in the log.
Also deifined cul868@9600, but no good.

In my udev I have this

KERNEL=="ttyUSB*", ATTRS{serial}=="A5001SsW", SYMLINK+="rfxcom"
OWNER="fhem"
KERNEL=="ttyACM*", SYSFS{product}=="CUL868", SYMLINK+="cul868"
OWNER="fhem"

Any ideas what's going wrong?

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

As the author of the rfxcom routines I do have tested this.
I do see the same effect with /dev/rfxcom. I do not have problems with
CUL functions.

What I have seen: When the define statement is issued the rfxcom
routines RFXCOM_OpenDev() successfully changes the baudrate, but some
seconds after this the previous baudrate is restored.

I have traced this in fhem.pl and I have seen that bringing fhem.pl in
background (fork) lets rfxcom forget its new  baudrate and restores
the old one.

These are the statements that do this in fhem.pl:
  # Go to background if the logfile is a real file (not stdout)
  if($attr{global}{logfile} ne "-" && !$attr{global}{nofork}) {
    defined(my $pid = fork) || die "Can't fork: $!";
    exit(0) if $pid;
  }

Running fhem in forground solves the problem for me, by adding the
following to fhem.cfg:
attr global logfile -

An alternative is to set the baud rate before starting fhem.

On my system I have now added the following to /etc/rc.local:
  stty -F /dev/rfxcom speed 4800

@Perl and  Device::SerialPort Gurus:

Anyone knows why the baudrate is changed back after a fork? How can I
make a baudrate change permanent?

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

rudolfkoenig

                                                   

> Anyone knows why the baudrate is changed back after a fork? How can I
> make a baudrate change permanent?

I can confirm the problem (osx works, ubuntu 10.10 is broken), and since I did
not found any simple way I reorganized the initialization: fork is done now
before interpreting the configuration file.

I tested it with and without backgrounding, with correct and broken
configuration, on Ubuntu and osx, and I hope I did not broke anything, but you
never know: so please test it.

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

> I tested it with and without backgrounding, with correct and broken
> configuration, on Ubuntu and osx, and I hope I did not broke anything, but you
> never know: so please test it.

Hello Rudi,

I can confirm that it it now works! I have your new fhem.pl now
running on my fhem production system.

The baudrate changes in my module 40_RFXCOM.pm to the RFXCOM device
are now applied as long as fhem runs. After stopping fhem the system
sets the old baudrate again.

So everything works as expected. No problems so far.

For your records: I am using debian squeeze on a sheevaplug device
(ARM).

If there will are any side effects I will tell you ASAP.

Regards Willi

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

I can confirm also, that it works as expected

regards Richard

On Jan 29, 6:38 pm, Willi wrote:
> > I tested it with and without backgrounding, with correct and broken
> > configuration, on Ubuntu and osx, and I hope I did not broke anything, but you
> > never know: so please test it.
>
> Hello Rudi,
>
> I can confirm that it it now works! I have your new fhem.pl now
> running on my fhem production system.
>
> The baudrate changes in my module 40_RFXCOM.pm to the RFXCOM device
> are now applied as long as fhem runs. After stopping fhem the system
> sets the old baudrate again.
>
> So everything works as expected. No problems so far.
>
> For your records: I am using debian squeeze on a sheevaplug device
> (ARM).
>
> If there will are any side effects I will tell you ASAP.
>
> Regards Willi

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.