Page 1 of 1

Ser2sock and AD2USB issues

PostPosted: Wed Jul 23, 2014 10:06 pm
by jplee3
Hey all,

So I finally hooked up the AD2USB to my RPI (under the AlarmDecoder Beta OS) and it's recognized as /dev/ttyUSB0. Ser2sock seems to be running (note: there's a persistent error that comes up where the ser2sock.pid cannot be created for whatever reason, so attempting to stop ser2sock fails...this might be a bug). However, no further messages or activity seems to be getting logged beyond this:

Jul 24 05:57:35 alarmdecoder ser2sock[2546]: [<E2><9C><94>] Using config file: /etc/ser2sock/ser2sock.conf
Jul 24 05:57:35 alarmdecoder ser2sock[2546]: [<E2><9C><94>] Serial 2 Socket Relay version V1.5.2 starting
Jul 24 05:57:35 alarmdecoder ser2sock[2546]: [<E2><9C><94>] Listening socket created on port 10000
Jul 24 05:57:35 alarmdecoder ser2sock[2546]: [<E2><9C><94>] daemonizing the process
Jul 24 05:57:35 alarmdecoder ser2sock[2549]: [<E2><9C><94>] Using PID file: /var/run/ser2sock.pid
Jul 24 05:57:35 alarmdecoder ser2sock[2549]: [<E2><9C><94>] Seting thread priority to HIGH
Jul 24 05:57:35 alarmdecoder ser2sock[2549]: [<E2><9C><94>] Start wait loop using ser2sock communication mode
Jul 24 05:57:35 alarmdecoder ser2sock[2549]: [<E2><9C><94>] Opened com port at /dev/ttyUSB0
Jul 24 05:57:35 alarmdecoder ser2sock[2549]: [<E2><9C><94>] Setting speed 115200
Jul 24 05:57:35 alarmdecoder ser2sock[2549]: [<E2><9C><94>] Set speed successful

I tried opening some doors and also setting the alarm and turning it back off. Nothing else is getting logged (unless it's in another log file?)

Any ideas of what I can check to make sure things are OK?

Re: Ser2sock and AD2USB issues

PostPosted: Wed Jul 23, 2014 10:11 pm
by jplee3
Ok so I realized I had encryption enabled so went ahead and set it to 0 and restarted the daemon. Now I'm able to send commands to the panel successfully but I'm not seeing logs of any events. Do I need to change the verbosity somewhere?

Re: Ser2sock and AD2USB issues

PostPosted: Thu Jul 24, 2014 4:55 am
by berkinet
Ser2sock does not log the contents of the data it forward. If you want to log that information you will have to do so in the GUI client or some other program.

Re: Ser2sock and AD2USB issues

PostPosted: Thu Jul 24, 2014 7:22 am
by jplee3
berkinet wrote:Ser2sock does not log the contents of the data it forward. If you want to log that information you will have to do so in the GUI client or some other program.



I thought Ser2Sock would spit the raw data into a log somewhere. At least, when it was first developed and I manually ran it as a daemon I recall it doing that. Did this change?

I'm running the appliance now and basically want to use the AD2USB as a passive listener/forwarder of panel events in addition to sending commands to it.

Re: Ser2sock and AD2USB issues

PostPosted: Thu Jul 24, 2014 9:43 am
by Scott
You can up the debug level with -g (level 2, I think) and it should log the messages to the log file.

Re: Ser2sock and AD2USB issues

PostPosted: Thu Jul 24, 2014 10:31 am
by jplee3
Scott wrote:You can up the debug level with -g (level 2, I think) and it should log the messages to the log file.


Thanks! I'll give that a shot. Otherwise, how would you interface with ser2sock to get events *back* from it? Is debug pretty much the only way?

Re: Ser2sock and AD2USB issues

PostPosted: Thu Jul 24, 2014 11:18 am
by Scott
Not exactly sure what you're asking. You can connect to port 10000 on your Pi and see all of the messages from the AlarmDecoder, which is what the webapp does internally. If you're talking about seeing the data contained in the keypresses (!Sending.done), the AlarmDecoder doesn't report that for security reasons.

Re: Ser2sock and AD2USB issues

PostPosted: Thu Jul 24, 2014 11:36 am
by jplee3
Scott wrote:Not exactly sure what you're asking. You can connect to port 10000 on your Pi and see all of the messages from the AlarmDecoder, which is what the webapp does internally. If you're talking about seeing the data contained in the keypresses (!Sending.done), the AlarmDecoder doesn't report that for security reasons.


So if I were to tcpdump port 10000, for example, I'd see all events as they occur? That's really what I'm looking for. I guess if debug just outputs that to a log that's cool. Back before all the recent updates, webapps, etc, I was having ser2sock write out to a log that I had OSSEC monitor (I wrote a decoder for it and added rules). OSSEC could then take action based on certain events (e.g. email/text me if a door was opened between 8am-5pm)

Re: Ser2sock and AD2USB issues

PostPosted: Thu Jul 24, 2014 11:42 am
by berkinet
tcpdump will give you a lot more data than you want. You could write a very basic socket client in Python to grab the data, or try something really simple like this.
telnet 10.0.1.2 10000 >> some_log_file&