After some digging i found a piece of code that should work with the rfxcom and perl. However i have not tested this yet.
For the usb to work you need (to be safe) 2.6.9 or higher. It should be normally included in the kernel.
Anyone with some code under linux that works with the rfxcom, please share so we can have a bigger userbase/idea's.
Here is the piece of code:
#! /usr/bin/perl -w
use strict;
use Fcntl;
my $port = $ARGV[0];
print "Port: $port\n";
system("stty 4800 < $port");
system("stty -a < $port");
sysopen(RFXCOM, $ARGV[0], Fcntl::O_RDWR(), 0666) || die "ERROR: can not open $ARGV[0]\n";
my $timeout = 90;
my $inbuff = "";
my $char;
my $rin = "";
my $rout;
vec($rin, fileno(RFXCOM), 1) = 1;
while ((select($rout=$rin, undef, undef, $timeout)) && (!($inbuff =~ m/.+\n/))) {
sysread RFXCOM, $char, 1;
print "--$char--";
$inbuff .= $char;
}
if ($inbuff eq "") {
print "Error! Timed out waiting for input.\n";
}
else {
print "Got line:" . $inbuff . "";
}
rfxcom linux/perl
Moderator: b_weijenberg
- Snelvuur
- Forum Moderator
- Posts: 3156
- Joined: Fri Apr 06, 2007 11:01 pm
- Location: Netherlands
- Contact:
rfxcom linux/perl
Hmm, seems someone else has been busy too:
http://www.xpl-perl.org.uk/file/xpl-per ... om?rev=215
xpl perl with experimental rfxcom support.
http://www.xpl-perl.org.uk/file/xpl-per ... om?rev=215
xpl perl with experimental rfxcom support.
- Snelvuur
- Forum Moderator
- Posts: 3156
- Joined: Fri Apr 06, 2007 11:01 pm
- Location: Netherlands
- Contact:
rfxcom linux/perl
The xpl-perl rfxcom is by far the most correct one. I dot get several messages back, although they still need decoding. At least it gives data back.
If you want to try it out, download it from the trunk since version 0.4 of the xpl-perl does not include this part yet.
If you want to try it out, download it from the trunk since version 0.4 of the xpl-perl does not include this part yet.
- Snelvuur
- Forum Moderator
- Posts: 3156
- Joined: Fri Apr 06, 2007 11:01 pm
- Location: Netherlands
- Contact:
rfxcom linux/perl
Well i had a chat with the builder of the xpl-perl project. Basicly he's added now support for temperature for the rfxsensor:
xpl-trig/sensor.basic: bnz-rfxcom.debiantje -> * - rfsensor00f0[temp]=7.5
xpl-trig/sensor.basic: bnz-rfxcom.debiantje -> * - rfsensor00f0[temp]=7
xpl-trig/sensor.basic: bnz-rfxcom.debiantje -> * - rfsensor00f0[temp]=7.5
I'll help him out more so we can have all the functions.
And i've also spoken him about the ctx35. Since my perl project was allready 99% done he can almost copy my stuff 1 on 1 to xpl.
xpl-trig/sensor.basic: bnz-rfxcom.debiantje -> * - rfsensor00f0[temp]=7.5
xpl-trig/sensor.basic: bnz-rfxcom.debiantje -> * - rfsensor00f0[temp]=7
xpl-trig/sensor.basic: bnz-rfxcom.debiantje -> * - rfsensor00f0[temp]=7.5
I'll help him out more so we can have all the functions.
And i've also spoken him about the ctx35. Since my perl project was allready 99% done he can almost copy my stuff 1 on 1 to xpl.