Unusual application of cm119 gpio03 ( intrusion detection)

Hello and 73’s de iz8xoh Marco, south Italy

Would introduce myself a bit, I’m ham since 80’ s when i was really young and also I’m into networking and wifihyperlan and voip.

Would need some guidance on use of gpios on cm119 dongle:
even after long googling most of topics are about using the spare gpio’s on cm108/cm119 as ptt and this is ok, I got it.

But… is there the way to use the gpio03 ( should be on pin 13 of cm119 ) as an input and not output anf if pulled high/low ( le’t decide this later) put on a call on the asterisk ?

In other words, is there a way to poll the state on this gpio every second, or half of second with a while/do statement, and if state changes put on place an asterisk call ( anti thief intrusion system ) ??

I higly appreciate any guidance/reference and would like this is done on linux

cheers, 73’s Marco

It should be easy to read GPIOs, I think I’ve seen some posts before about (ie. read GPIO variable in an rpt.conf Event function) but don’t seem to be having much luck at the moment finding up-to-date info on how to do that. Hopefully someone else here knows how. This really should be in the ASL3 Manual… making a response to a digital input event is a basic fundamental use case. I would suggest though that you use GPIO2 or 4, because 3=PTT and I don’t believe it’s possible to override that without changing the app_rpt C code. If for some reason it was not easy to read a CM1xx GPIO in the current ASL Events system it would be easy to add such a capability in the app_rpt C code.
Alternatively, you could setup a 2nd URI and use the COS input only (no radio connected), which can definitely be read in event functions, see Event Management - AllStarLink Wiki and RPT_RXKEYED. This could then probably be used to trigger a DTMF command to initiate a connection on the main node.

hello NR9V, thanks for kind answer
yes of course I should investigate other pins since the 3 is " hard coded" in c code for keying/ptt

It was plus or minus a proof of concept of alternative use ( experimented some robbery in high mountain rpt location and instead use commercial anti-intrusion system why not place an asterisk call and/or radio announcement)

I’m glad at least you pointed me in the right place where start to look , such as event manager and read gpio variables

Sincerely, 73’ s iz8xoh Marco

Marco, are you using a pi or pc ?

Event management is perhaps the best universal way to approach this.
But you can do this with other external devices and use bash scripting.
I did something similar with parallel port inputs on a pc long ago but use other contraptions anymore.

Hello mike, to be honest I’m one of the developer ( hardware side ) of armbian on cheap, very cheap tvboxes ( suck as all winner or amlogic but i prefer rockchip series rk3228 or rk3229)
so let’s “say” I am on a pi, or at least I am on an armhf platform

I already did it with event manager, in particular with evtest and triggerhappy using the volume up event or even the left button of the mouse… but preferred to investigate further since we have plenty of gpios on cm119
Even if am not a coder I have no " fear" to investigate and/or slightly modify code how to poll the gpio state

Asterisk/app_rpt isn’t really designed for general-purpose GPIO activity. What I suggest is use a separate I2C chip via USB and do what you want to do outside of Asterisk.