From owner-freebsd-multimedia@FreeBSD.ORG Wed Jul 6 07:07:44 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECEB9106566C; Wed, 6 Jul 2011 07:07:44 +0000 (UTC) (envelope-from achill@matrix.gatewaynet.com) Received: from smadev.internal.net (host3.dynacom.ondsl.gr [62.103.35.211]) by mx1.freebsd.org (Postfix) with ESMTP id 3D4AD8FC15; Wed, 6 Jul 2011 07:07:42 +0000 (UTC) Received: from smadev.internal.net (localhost.internal.net [127.0.0.1]) by smadev.internal.net (8.14.2/8.14.2) with ESMTP id p6677fL2015130; Wed, 6 Jul 2011 10:07:41 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) Received: from localhost (localhost [[UNIX: localhost]]) by smadev.internal.net (8.14.2/8.14.2/Submit) id p6677evA015129; Wed, 6 Jul 2011 10:07:40 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) From: Achilleas Mantzios Organization: Dynacom Tankers Mgmt To: Boris Samorodov Date: Wed, 6 Jul 2011 10:07:40 +0300 User-Agent: KMail/1.9.7 References: <201107041339.22470.achill@matrix.gatewaynet.com> <201107051730.03784.achill@matrix.gatewaynet.com> <03644739@h30.sp.ipt.ru> In-Reply-To: <03644739@h30.sp.ipt.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <201107061007.40884.achill@matrix.gatewaynet.com> Cc: freebsd-multimedia@freebsd.org, freebsd-hardware@freebsd.org Subject: Re: FreeBSD and controlling an alarm via relay X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2011 07:07:45 -0000 Hey, its a small world! i am the other guy (achix) from the zoneminder camp :) this all has to do with a continuation of the zoneminder work, zoneminder driving a relay, driving a xmitter and finally triggering an ala= rm to the central alarm control panel. i have done this in the past with a rather "legacy" way (utilizing a zyXel = modem), but wanted to=20 do something more fancy. =CE=A3=CF=84=CE=B9=CF=82 Tuesday 05 July 2011 22:56:28 =CE=BF/=CE=B7 Boris = Samorodov =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > On Tue, 5 Jul 2011 17:30:03 +0300 Achilleas Mantzios wrote: >=20 > > Most probably i'll go for something cheaper like this one=20 > > http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Co= ntrolled-/110710346488?pt=3DUK_BOI_Electrical_Components_Supplies_ET&hash= =3Ditem19c6d9d2f8 >=20 > > Could i use the ucom driver to talk to the USB device like a normal > > serial device, via /dev/cua*** ? >=20 > 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. >=20 Is there any big probability for the chip to not be on of those that FreeBS= D supports (uark, uftdi, etc..) ? most sellers hardly give such info out. > > The above link says one needs to talk to the relay with: > > 8 Data, 1 Stop, No Parity,Baud rate : 9600 >=20 > I've never changed those parameters. >=20 > > and the commands look like: > > FF 01 00 (HEX)=20 > > or=20 > > 255 1 0 (DEC) >=20 > > could i be able to specify those over ucom?=20 > > do you know any application, perl library, utility or just a guide for > > standard C serial port programming? >=20 > > 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; >=20 > > my $v =3D new Modem::Vgetty; >=20 > > $v->device('DIALUP_LINE'); > > $v->send("ATH1"); > > sleep(5); > > $v->send("ATH0"); >=20 > > 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. >=20 > I use python for scripting and it is as simple as write(data) and > read(data). >=20 Cool, thanx, see you over the zoneminder forum. =2D-=20 Achilleas Mantzios