Open daddyfix opened 3 years ago
It's probably (a wild guess, totally untested) due to the code using multithreading. Try modifying the Makefile and add "-pthread" to the CC line, like this:
CC=gcc -pthread
then "make clean ; make" to recompile all files.
There might be other problems with the code too though. It was after all written for Solaris and not Linux many years ago, and even though both are Unix variants there are some subtle differences. I'll see if I can move our GSM modem to a Linux system and test it a bit more someday in the future...
Compile worked easily after adding '-pthread'
#make clean
rm -f psmsd psmsc *.o *~ \#* */*~ */#*
root@mobilesvr:/pimedia_scripts/psmsd-master# make
gcc -pthread -O2 -g -Wall -c -o psmsd.o psmsd.c
gcc -pthread -O2 -g -Wall -c -o gsm.o gsm.c
gcc -pthread -O2 -g -Wall -c -o serial.o serial.c
gcc -pthread -O2 -g -Wall -c -o uucp.o uucp.c
gcc -pthread -O2 -g -Wall -c -o cap.o cap.c
gcc -pthread -O2 -g -Wall -c -o queue.o queue.c
gcc -pthread -O2 -g -Wall -c -o argv.o argv.c
gcc -pthread -O2 -g -Wall -c -o spawn.o spawn.c
gcc -pthread -O2 -g -Wall -c -o ptime.o ptime.c
gcc -pthread -O2 -g -Wall -c -o buffer.o buffer.c
gcc -pthread -O2 -g -Wall -c -o users.o users.c
gcc -pthread -O2 -g -Wall -c -o strmisc.o strmisc.c
gcc -pthread -o psmsd psmsd.o gsm.o serial.o uucp.o cap.o queue.o argv.o spawn.o ptime.o buffer.o users.o strmisc.o -lpthread -lpthread
gcc -pthread -O2 -g -Wall -c -o psmsc.o psmsc.c
gcc -pthread -o psmsc psmsc.o buffer.o users.o strmisc.o -lpthread
But TTY failed again
/psmsd -t -d5
*** serial_open("/dev/ttyUSB3", 115200, 30000): Start
MAIN: Starting threads:
SER_RECV_THREAD: Starting
SER_XMIT_THREAD: Starting
XMIT: MSG: +CSCS="HEX", DATA: <null>
FIFO_READ_THREAD: Starting (fifo=/etc/psmsd/fifo)
MAIN: Waiting for signals...
TTY_READ_THREAD: Starting
Segmentation fault
I sorry about taking your time on an old project. I'm just looking for a package that can manage my GSM for receiving SMS. I tried Gammu but its unreliable for me
I'm going to go over your code and read more on thread for Raspberry Pi and C.
But if you happen to test it on a Linux system please let me know how it goes.
Thanks again for all your help, all the way from Sudbury, Ontario, Canada
No worries. We'll see if we can get this going. This seems like a real bug btw (not just a Solaris vs Linux portability problem). I probably never really tested the "-t" option back when I wrote it. It stops core dumping for me if I just add the following to tty_read_thread() in psmsd.c:
if (!tty_fp) tty_fp = stdin;
Updated the GIT repo now.
(For our usage we either use the psmsc client for sending SMS, or use the "receive SMS and reply with something" mode in psmsd so we can execute commands recieved via SMS)
That's awesome. I'm gonna try it when I get home
Many thanks
On Tue., Oct. 19, 2021, 9:50 a.m. Peter Eriksson, @.***> wrote:
No worries. We'll see if we can get this going. This seems like a real bug btw (not just a Solaris vs Linux portability problem). I probably never really tested the "-t" option back when I wrote it. It stops core dumping for me if I just add the following to tty_read_thread() in psmsd.c:
if (!tty_fp) tty_fp = stdin;
Updated the GIT repo now.
(For our usage we either use the psmsc client for sending SMS, or use the "receive SMS and reply with something" mode in psmsd so we can execute commands recieved via SMS)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ptrrkssn/psmsd/issues/2#issuecomment-946743904, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEIKU33IT3OFGFIKHMZZSLUHVZQVANCNFSM5GHYDRNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Can not get psmsd to run as Enable TTY reader. ( Im new to C programming)
I have tried to solve this problem all day but still can't figure out where the Segmentation Fault (io file read) occurs.
I believe it occurs in function -> tty_read_thread(void *tap) (approx line 1000)
Any pointers will be appreciated.
This is my gdb debug code.