Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Jul 2011 23:56:28 +0400
From:      Boris Samorodov <bsam@ipt.ru>
To:        Achilleas Mantzios <achill@matrix.gatewaynet.com>
Cc:        freebsd-multimedia@freebsd.org, freebsd-hardware@freebsd.org
Subject:   Re: FreeBSD and controlling an alarm via relay
Message-ID:  <03644739@h30.sp.ipt.ru>
In-Reply-To: <201107051730.03784.achill@matrix.gatewaynet.com> (Achilleas Mantzios's message of "Tue, 5 Jul 2011 17:30:03 %2B0300")
References:  <201107041339.22470.achill@matrix.gatewaynet.com> <alpine.BSF.2.00.1107050902220.63675@tripel.monochrome.org> <201107051730.03784.achill@matrix.gatewaynet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 5 Jul 2011 17:30:03 +0300 Achilleas Mantzios wrote:

> Most probably i'll go for something cheaper like this one 
> http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710346488?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6d9d2f8

> Could i use the ucom driver to talk to the USB device like a normal
> serial device, via /dev/cua*** ?

I use USB-to-7-RS232-ports devices via /dev/cuaU00-/dev/cuaU06.
Works like a charm. But you should find out what chip is used
for USB-to-RS232 bridge and (kld)load a driver.

> The above link says one needs to talk to the relay with:
> 8 Data, 1 Stop, No Parity,Baud rate : 9600

I've never changed those parameters.

> and the commands look like:
> FF 01 00 (HEX) 
> or 
> 255 1 0 (DEC)

> could i be able to specify those over ucom? 
> do you know any application, perl library, utility or just a guide for
> standard C serial port programming?

> i have used mgetty/vgetty in the past to control some modems.
> I do not know if there any fancier methods to access the serial port,
> but this is how i used to do it, back in 7.*
> /usr/local/bin/vm shell -l cuad1 -S onhook_offhook.pl
> where onhook_offhook.pl reads like:
> #!/usr/bin/perl
> #
> use Modem::Vgetty;

> my $v = new Modem::Vgetty;

> $v->device('DIALUP_LINE');
> $v->send("ATH1");
> sleep(5);
> $v->send("ATH0");

> if i could speak directly with e.g. "255 1 0" like
> $v->send("255 1 0");
> that would be awesome...
> i guess i will have to try it out.

I use python for scripting and it is as simple as write(data) and
read(data).

-- 
HTH and WBR, bsam



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?03644739>