Gammu在一段时间后停止接收短信

  • 本文关键字:一段时间 Gammu gammu
  • 更新时间 :
  • 英文 :


我遇到了一个困扰我一段时间的问题。我已经寻找了两个星期的解决方案,但没有任何结果。这些人和我有同样的问题,但没有答案。。

我正在用raspbian在Rpi上运行gammu(1.31)和gammu smsd。使用华为E367。

不知道为什么我有3个设备/dev/ttyUSB0、/dev/ttyUSB 1、/dev/tty USB2由于我不知道这些之间的区别,我尝试了不同的设置,并用以下内容运行它;gammuconf ttyUSB0和gammu smsdrc ttyUSB2。作为root用户和普通用户。

发送短信效果很好。然后问题来了。接收短信工作了一段时间,然后就停止了。如果我重新启动系统,它就会重新开始工作。有一段时间,但同样的事情会在一段时间后发生。


# Configuration file for Gammu SMS Daemon
# Gammu library configuration, see gammurc(5)
[gammu]
# Please configure this!
port = /dev/ttyUSB2
connection = at
# Debugging
#logformat = textall
# SMSD configuration, see gammu-smsdrc(5)
[smsd]
service = files
logfile = /home/pi/gammu/log/log_smsdrc.txt
# Increase for debugging information
debuglevel = 0
# Paths where messages are stored
inboxpath = /home/pi/gammu/inbox/
outboxpath = /home/pi/gammu/outbox/
sentsmspath = /home/pi/gammu/sent/
errorsmspath = /home/pi/gammu/error/
ReceiveFrequency = 2
LoopSleep = 1
GammuCoding = utf8
CommTimeout = 0
    
#RunOnReceive =

记录


Tue 2015/03/31 11:05:19 gammu-smsd[7379]: Starting phone communication...
Tue 2015/03/31 11:07:07 gammu-smsd[7379]: Terminating communication...
Tue 2015/03/31 11:07:26 gammu-smsd[2091]: Warning: No PIN code in /etc/gammu-smsdrc file
Tue 2015/03/31 11:07:26 gammu-smsd[2116]: Created POSIX RW shared memory at 0xb6f6d000
Tue 2015/03/31 11:07:26 gammu-smsd[2116]: Starting phone communication...
Tue 2015/03/31 11:07:26 gammu-smsd[2116]: Error at init connection: Error opening device, it doesn't exist. (DEVICENOTEXIST[4])
Tue 2015/03/31 11:07:26 gammu-smsd[2116]: Starting phone communication...
Tue 2015/03/31 11:07:26 gammu-smsd[2116]: Error at init connection: Error opening device, it doesn't exist. (DEVICENOTEXIST[4])
Tue 2015/03/31 11:07:26 gammu-smsd[2116]: Starting phone communication...
Tue 2015/03/31 11:07:26 gammu-smsd[2116]: Error at init connection: Error opening device, it doesn't exist. (DEVICENOTEXIST[4])
Tue 2015/03/31 11:07:26 gammu-smsd[2116]: Starting phone communication...
Tue 2015/03/31 11:07:26 gammu-smsd[2116]: Error at init connection: Error 
opening device, it doesn't exist. (DEVICENOTEXIST[4])
Tue 2015/03/31 11:07:26 gammu-smsd[2116]: Going to 30 seconds sleep because of too much connection errors
Tue 2015/03/31 11:08:14 gammu-smsd[2116]: Starting phone communication...
Tue 2015/03/31 11:08:21 gammu-smsd[2116]: Soft reset return code: Function not supported by phone. (NOTSUPPORTED[21])
Tue 2015/03/31 11:08:27 gammu-smsd[2116]: Read 2 messages
Tue 2015/03/31 11:08:27 gammu-smsd[2116]: Received 
IN20150331_110600_00_+xxxxxx_00.txt
Tue 2015/03/31 11:08:27 gammu-smsd[2116]: Received 
IN20150331_110820_00_+xxxxxx_00.txt
Tue 2015/03/31 11:09:38 gammu-smsd[2116]: Read 1 messages
Tue 2015/03/31 11:09:38 gammu-smsd[2116]: Received 
IN20150331_110934_00_+xxxxxx_00.txt
Tue 2015/03/31 11:13:57 gammu-smsd[2116]: Read 1 messages
Tue 2015/03/31 11:13:57 gammu-smsd[2116]: Received 
IN20150331_111352_00_+xxxxxx_00.txt

我想预警是在我的模式切换命令生效之前。在rc.local:中

sudo usb_modeswitch -v 0x12d1 -p 0x1446 -V 0x12d1 -P 0x1506 -m 0x01 -M 55534243123456780000000000000011062000000100000000000000000000  -I

我也有同样的问题,所以我写了一个shell脚本来重新激活干净的quick/dev/ttyUSB[0-2]设备,然后将其添加到cron作业中

*/5 * * * * /home/sysadmin/scripts/reanimate-usb-stick.sh >/dev/null 2>&1

重新激活usb棒。sh

#!/bin/bash
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
USBDEVICES=$(ls -l /dev/* | awk '//dev/ttyUSB[0-7]/ {print $6}' | wc -l)
DEVICEINFO=""
DEVICEPORT=""

if [ $USBDEVICES = 0 ]
        then
                datas=$(lsusb | grep -i hua | awk '/Bus/ {print $6}' | tr ":" "n")
                counter=0
                for line in $datas
                do 
                        counter=$((counter+1))
                        if [ $counter = 1 ]
                                then
                                        DEVICEINFO=$(echo "$line")
                        fi
                        if [ $counter = 2 ]
                                then
                                        DEVICEPORT=$(echo "$line")
                        fi
                done
    usb_modeswitch -v $DEVICEINFO -p $DEVICEPORT -J
    echo "$DEVICEINFO - $DEVICEPORT"
    else
        echo "ALLES OK : $USBDEVICES"
        exit
fi

这看起来与https://github.com/gammu/gammu/issues/4尽管有人试图在Gammu中解决这个问题,但华为调制解调器固件似乎不够稳定,无法满足这种使用。只需多次询问它是否列出收到的消息,它就会毫无反应。

此外,您使用的设备可能会略有不同,有关该主题的更多信息,请参阅Gammu手册和dd-wrt-wiki。

我在华为3g调制解调器e1750上也遇到过类似的问题。我在/etc/gammu smsdrc文件中添加了以下行:

ReceiveFrequency = 60
StatusFrequency = 60
CommTimeout = 60
SendTimeout = 60
LoopSleep = 10
CheckSecurity = 0

这个想法是最小化gammu smsd和3g调制解调器之间的通信数量。特别是默认值LoopSleep=1意味着gammu每秒都会向调制解调器发送命令,这对调制解调器固件来说可能太多了,所以我用了10。

接下来是所有Raspberry/ARM嵌入式项目的标准:使用powerfull电源。我使用的充电器带有固定电缆(我相信一些可重复使用的电缆可能不适合2A以上的电流),看起来是这样的:http://botland.com.pl/9240-thickbox_default/zasilacz-extreme-microusb-5v-21a-raspberry-pi.jpg

这样,调制解调器在运行大约50-100个小时后仍然挂起,但这对我的项目来说已经足够了。

最新更新