Hi,
I'm using nodo that bridge IR->RF (kaku) and works with eventghost, but this is in windows.
I'm looking for some linux software , or someone who writes some, that reads the serial/usb port /dev/ttyUSB, that writes to and log file example /var/log/nodo.log the events, and you can set some actions (scripts) on those events. So nog graphical interface is required
any ideas/help?
software read serial port and write log
software read serial port and write log
Well logging works
wodan:~# nohup cat /dev/ttyUSB0 > nodo.txt
nohup: ignoring input and redirecting stderr to stdout
^X^C
wodan:~# cat nodo.txt
C3=0
AAB50D2=0
AB50D2=0
AAB50D2=0
AB50D2=0
But how do I get an action to it, for example is C3=0 than launch script ./lamp3on
wodan:~# nohup cat /dev/ttyUSB0 > nodo.txt
nohup: ignoring input and redirecting stderr to stdout
^X^C
wodan:~# cat nodo.txt
C3=0
AAB50D2=0
AB50D2=0
AAB50D2=0
AB50D2=0
But how do I get an action to it, for example is C3=0 than launch script ./lamp3on
software read serial port and write log
In Perl, open the file /dev/ttyUSB0.
Create a loop of reading every line, after each line process it.
Create a loop of reading every line, after each line process it.
- Snelvuur
- Forum Moderator
- Posts: 3156
- Joined: Fri Apr 06, 2007 11:01 pm
- Location: Netherlands
- Contact:
software read serial port and write log
kroon: take a look at the perl script for the ti0203 (comes with mister house i believe) it has also a read on the serial and has a loop and such, more example are out there.
// Erik (binkey.nl)
// Erik (binkey.nl)
Re: software read serial port and write log
I use perl also for this.
A short code sample below...
A short code sample below...
Code: Select all
use Device::SerialPort;
$ob = Device::SerialPort->new ($PORT) || die "Can't Open $PORT: $!";
$ob->baudrate(115200) || die "failed setting baudrate";
$ob->parity("none") || die "failed setting parity";
$ob->databits(8) || die "failed setting databits";
$ob->handshake("none") || die "failed setting handshake";
$ob->write_settings || die "no settings";
open(DEV, "<$PORT")
|| die "Cannot open $PORT: $_";
while($_ = <DEV>){
}