1
votes

I have a problem that's been bugging me for a while now. I've been searching for solutions for 2 weeks now without any result. These guys have the same problem as me but no answers there..

I'm running gammu (1.31) and gammu-smsd on a Rpi with raspbian. Using a Huawei E367.

Don't know why I got 3 devices /dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyUSB2 Since I don't know the difference between these I tried different settings and got it running with the following; gammuconf ttyUSB0 and gammu-smsdrc ttyUSB2. Both as root and normal users.

Sending SMS works great. Then comes the problem. Receiving SMS works for a while, then just stops. If I reboot the system it starts to work again. For a while, but the same thing happens after a while.


# 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 =

Log


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

I guess the early warnings are before my modeswitch command kicks in. in rc.local:

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

3 Answers

2
votes

I have the same Problem, so I wrote a shell script to reactivate the clean-quick /dev/ttyUSB[0-2] device, and then added it to cron job

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

reanimate-usb-stick.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
1
votes

This looks pretty much same as https://github.com/gammu/gammu/issues/4 and even though there were some attempts to fix this in Gammu, it seems that the Huawei modems firmware is simply not stable enough for this usage. Simply asking it several times for listing received messages makes it unresponsive.

Also which device you use might make slight difference, see Gammu manual and dd-wrt wiki for more information on that topic.

1
votes

I had similar problem with Huawei 3g modem e1750. I added following lines to /etc/gammu-smsdrc file:

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

The idea is to minimalize ammount of communication between gammu-smsd and 3g modem. Especially the default value LoopSleep=1 means that gammu sends commands to modem each second and it could be too much for modem firmware, so I used 10.

Next thing is something standard in all Raspberry/ARM embedded projects: Use powerfull power source. I'm using charger with fixed cable (I belive that some reusable cables could be inappriopriate for currents above 2A) that looks like that: http://botland.com.pl/9240-thickbox_default/zasilacz-extreme-microusb-5v-21a-raspberry-pi.jpg

With that the modem still hangs after about 50-100 hours of operation, but it's enouth for my project.