LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-09-2019, 07:46 AM   #1
little necro
LQ Newbie
 
Registered: Sep 2019
Posts: 4

Rep: Reputation: Disabled
Unhappy Program worked one day, but after the weekend and a reboot it broke.


So I currently have PHP program using PHP serial to send a TAP protocol message to a paging system. The PHP program calls a python program in order to get information from another serial port. This was working on Friday, but then I shutdown the server and went home for the weekend. I came back in today and booted it back up to find my program no longer works. On Friday I remember I started the GUI and got some error about access denied to the port that talks to the paging system.

Does anyone know why my program worked one day but not the other?


Edit:
So I swapped the ports, I had receiver on ttyS0, and pager on ttyUSB0. I swapped these around and edited the program to reflect the swap and everything worked. Anyone know how this solved the problem so don't have to do that swap in the future. It's fine for testing, but not for the final solution.

Last edited by little necro; 09-09-2019 at 07:58 AM. Reason: Kinda fixed, but what?
 
Old 09-09-2019, 07:55 AM   #2
proN00B
LQ Newbie
 
Registered: Sep 2019
Posts: 11

Rep: Reputation: Disabled
Have you done a scan for gremlins?

scan gremlins
 
Old 09-09-2019, 11:27 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
Accidental working doesn't prove your program being good. So simply you have a problem to solve.
 
Old 09-09-2019, 11:55 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by little necro View Post
So I currently have PHP program using PHP serial to send a TAP protocol message to a paging system. The PHP program calls a python program in order to get information from another serial port. This was working on Friday, but then I shutdown the server and went home for the weekend. I came back in today and booted it back up to find my program no longer works. On Friday I remember I started the GUI and got some error about access denied to the port that talks to the paging system.

Does anyone know why my program worked one day but not the other?


Edit:
So I swapped the ports, I had receiver on ttyS0, and pager on ttyUSB0. I swapped these around and edited the program to reflect the swap and everything worked. Anyone know how this solved the problem so don't have to do that swap in the future. It's fine for testing, but not for the final solution.
Would help to know what the "some error about access denied" was, since that's probably the root cause. Also be helpful to know what version/distro of Linux, PHP, etc.
 
Old 09-09-2019, 12:41 PM   #5
little necro
LQ Newbie
 
Registered: Sep 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Would help to know what the "some error about access denied" was, since that's probably the root cause. Also be helpful to know what version/distro of Linux, PHP, etc.
I cannot provide that because I cannot get the error to come back up. I think it is an issue with the configuration on the serial ports. I currently have everything set through the programming.
 
Old 09-09-2019, 12:43 PM   #6
little necro
LQ Newbie
 
Registered: Sep 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
Accidental working doesn't prove your program being good. So simply you have a problem to solve.
The method to solve the issue was just unplugging the serial port and pluggin it back it, I tested by restarting multiple times to see the result. When I start the server the port will not work with the php program until it has been unplugged and plugged back in.
 
Old 09-09-2019, 12:58 PM   #7
little necro
LQ Newbie
 
Registered: Sep 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
So if I write a python script that runs at the start and opens the port that is connected to the paging system and then close it everything works as intended. So logically there must be an issue with PHP serials opening of the port for the first time or something that I am missing.


Perhaps I will remove PHP using serial all together then.

Last edited by little necro; 09-09-2019 at 01:03 PM.
 
Old 09-09-2019, 02:59 PM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by little necro View Post
I cannot provide that because I cannot get the error to come back up. I think it is an issue with the configuration on the serial ports. I currently have everything set through the programming.
Nothing in the PHP logs??? And version/distro of Linux? PHP????
Quote:
Originally Posted by little necro
The method to solve the issue was just unplugging the serial port and pluggin it back it, I tested by restarting multiple times to see the result. When I start the server the port will not work with the php program until it has been unplugged and plugged back in.
Might be permissions on the device itself, or that the Apache user needs to be added to the tty group.
Quote:
Originally Posted by little necro
So if I write a python script that runs at the start and opens the port that is connected to the paging system and then close it everything works as intended. So logically there must be an issue with PHP serials opening of the port for the first time or something that I am missing. Perhaps I will remove PHP using serial all together then.
Your program; your call.
 
Old 09-09-2019, 03:06 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,258
Blog Entries: 24

Rep: Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193
@proN00B: Welcome to LQ Programming forum.

Please keep posts in the Programming forum on topic and limit the amount of banter in response to other's questions.

From the LQ Rules:

Quote:
Do not post if you do not have anything constructive to say in the post.
Thanks.
 
1 members found this post helpful.
Old 09-09-2019, 06:16 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
It might help knowing the distribution / version you are running.

Without knowing anything about the PHP program, serial port php class or your python script it is impossible to say what is wrong.

At face value /dev/ttyS0 would indicate a hardware device and I find it strange that whatever was connected to it one day would change the next.

Quote:
On Friday I remember I started the GUI and got some error about access denied to the port that talks to the paging system.
Sounds like a permission problem. The typical problem with accessed denied to the port is the user that is trying to access the serial port does not belong to the dialout group. Reconnecting the serial port might mean the device is not being recognized at startup. Check the dmesg output and also check the web server logs if running your php script from a web server.
 
Old 09-10-2019, 10:03 AM   #11
Samsonite2010
Member
 
Registered: Apr 2015
Distribution: Debian
Posts: 267
Blog Entries: 1

Rep: Reputation: 117Reputation: 117
You do get issues with ports being reserved and reassigned - are devices always guaranteed to be the same number each time? Especially if connections are not closed at the right time.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware 14.1, full install, sound card worked OK, but microphone is not worked. zw963 Slackware 7 11-23-2013 06:57 AM
Audio clips stop playing, one day after reboot themess Debian 2 10-13-2011 05:26 PM
[SOLVED] Problems printing to Win7 attached printer - Worked one day then stopped. jlavik Linux - Newbie 4 10-14-2010 08:28 AM
LXer: Ubuntu 10.04 - one day before (and now one day after) Lucid release, things are LXer Syndicated Linux News 0 05-01-2010 01:02 AM
what kind of partying will you be doing this Memorial Day weekend? t3gah General 3 05-27-2005 10:40 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration