SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Thu Apr 18, 2024 23:02
SMSTools3 Community » Help and support Bottom

[answered] Unstable /dev/ttyACM?

  This topic is locked

Page:  1

Author Post
Member
Registered:
Feb 2010
Location: Norway
Operating system name and version: Debian squeeze/sid
Version of smsd: 3.1.6
Smsd installed from: package repository
Name and model of a modem / phone: SE K750i
Interface: USB

Sometimes (not often) my interface device eg. /dev/ttyACM0 decides to suddenly change and become /dev/ttyACM1. I only have one mobil connected so smsd wont send any more sms's if this happens. I'm getting "Cannot open serial port /dev/ttyACM0, error: No such file or directory" in the logs.
I'm not really asking for help on solving my unstable telephone, but will a workaround be to add several "modems" to my smsd.conf, one for ACM0, ACM1 and ACM2..? Two of them will always be unavailable, but one of them will most likely always work.. And how can I configure smsd.conf to minimize delays if one ACM dies?

Is there anything bad in this workaround?

I'm only using this for private usage, so a rock stable solution isnt really necessary..


Thanks!

Regards
Lars

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
When smsd is starting and a modem port cannot be opened, that process will stop permanently. Therefore you cannot have ACM1 and ACM2 as "ready for use" when your modem is ACM0. Also, even if they could be as a spare, there will be very much error messages in the log.

You could monitor alarm events, and change the port setting and restart smsd by the external process. It could work in this way:

First, use keep_open = no for a modem. This will ensure that in case of an error you will get a message which is easy to detect.

Define an alarmhandler. When opening fails, smsd will call that script and $6 is the alarm text. In your case it contains "Cannot open serial port". When your script sees this, it can create a flag-file to somewhere. You could also log all alarm events to your own log file, it may be usefull if you later get some other messages.

Next, create a watchdog script and run it by the cron, for example once per minute. It should monitor if a flag-file exists. When the file exists, it can call init.d/smstools stop.

Then you need to check what is the port used currently. It can be seen using dmesg. Take a look at this post. It contains a sample code to detect the port and change the smsd.conf setting.

After the port setting is changed, your watchdog can start the smsd again, and it will run using the new port. A flag-file should be removed and case should be taken that the watchdog script will not run if it's already running.

How this kind of a functionality sounds for you? And are you good in scripting? ;)

Member
Registered:
Feb 2010
Location: Norway
Topic owner
Thank you very much for your answer, it made sense!
I have experience in scripting, and this doesn't sound to hard :)

Regards

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Here is an another way to act:

Modify the init.d/smstools (or sms3) script. In the case of start, check what is the current port using dmesg. Then create (or update) a symbolic link to that port, for example (if running as a root):
ln -f -s /dev/ttyACM2 /dev/smsd_port

or use some other directory if running as an unpriviledged user.

In the smsd.conf, just define device = /dev/smsd_port (or link in some other directory). There is no need to change it every time.

The alarmhandler can call /etc/init.d/smstools restart and then just exit, when it has seen that the serial port cannot be opened. No other scripts are needed (or at least I think so ;) )

Member
Registered:
Feb 2010
Location: Norway
Topic owner
That looks like a much more elegant solution! Will use that one.. Thanks a lot!

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.