Page 1 of 1

[Solved] ad2pi with ser2sock problem

PostPosted: Thu Feb 06, 2014 10:40 am
by craig
Hi,

I manually made the changes to cmdline.txt and inittab to open up the gpio on my Pi.

I have compiled ser2sock, but when I start it with:

sudo /home/pi/ser2sock/ser2sock-master/ser2sock -p 1000 -s /dev/ttAMA0

I get this:

[✔] Serial 2 Socket Relay version V1.4.4 starting
[✔] Listening socket created on port 1000
[✔] Seting thread priority to HIGH
[✔] Start wait loop
[✘] Error can not open com port at /dev/ttAMA0
[✘] Error can not open com port at /dev/ttAMA0

One other thing, I haven't wired my ad2pi into the panel yet, was hoping to get this part working before I did that...hope that isn't the issue.

Any suggestions would be appreciated. I know my way around linux, but certainly no ninja with respect to trouble shooting the ports via the log files, etc.

thanks,
craig

ps. here is last line from inittab:
#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

and cmdline.txt
cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait

Re: ad2pi with ser2sock problem

PostPosted: Thu Feb 06, 2014 11:34 am
by mathewss
Yet another good reason to use the prebuilt Pi image :c) but I am guessing like many you prefer the hands on approach.

Looks like we could add some additional error report to that failed open but as it does not have it now lets look at the easy ones.

Code: Select all
ls -l /dev/ttAMA0


I suspect its permissions so also tell us what user you are running ser2sock as.

Event if the port was open by another process it would have to be opened exclusive so our attempt to open should work but we shall see.

Re
Sean M

Re: ad2pi with ser2sock problem

PostPosted: Thu Feb 06, 2014 12:17 pm
by craig
Here are results:

pi@raspberrypi /dev $ ll /dev/ttyAMA0
crw-rw---T 1 root dialout 204, 64 Jan 1 1970 /dev/ttyAMA0

I was running the ser2sock with sudo, as pi user.

I tried : sudo chmod o+rw /dev/ttyAMA0 but still got the same message

thanks,
craig

Re: ad2pi with ser2sock problem

PostPosted: Thu Feb 06, 2014 12:23 pm
by craig
fyi, I also still get the error if i sudo su over to root and run ser2sock

Re: ad2pi with ser2sock problem

PostPosted: Thu Feb 06, 2014 4:06 pm
by mathewss
Hmm.. That sucked. Lost internet at the office. Had to brave a blizzard to get technicians out to climb a pole to fix it. Yay.. All fixed now. I dont mind driving in the snow had lots of practice over the years in the highlands and mountains in the NW. Most Oregonians can deal with 3 months of non stop rain but give them snow down at 300' elevation and they panic.

ok we need to know what the error is.

Can you make this change to your code and recompile it. If you need the full file its on my github fork
Code: Select all
diff --git a/ser2sock.c b/ser2sock.c
index 7a56dce..1291f12 100644
--- a/ser2sock.c
+++ b/ser2sock.c
@@ -555,7 +555,7 @@ int init_serial_fd(char * szPortPath)
 
        if (fd < 0)
        {
-               log_message(STREAM_MAIN, MSG_BAD, "Error can not open com port at %s\n", szPortPath);
+               log_message(STREAM_MAIN, MSG_BAD, "Error can not open com port at %s errno: %i\n", szPortPath, errno);
                return fd;
        }

Re: ad2pi with ser2sock problem

PostPosted: Thu Feb 06, 2014 4:39 pm
by Scott
Looks like a typo. You have /dev/ttAMA0 in several places instead of /dev/ttyAMA0.

Re: ad2pi with ser2sock problem

PostPosted: Thu Feb 06, 2014 6:16 pm
by mathewss
Good eyes :) I am working on a patch to elaborate on non fatal errors like this.

[] Serial 2 Socket Relay version V1.4.4 starting
[] Listening socket created on port 1000
[] Seting thread priority to HIGH
[] Start wait loop
[] Error can not open com port at /dev/ttAMA0 errno: 2 'No such file or directory'

Re: ad2pi with ser2sock problem

PostPosted: Thu Feb 06, 2014 9:40 pm
by craig
Painful. thanks for the help, it was a typo.