sms-gateway gnokii Initialization failed sometimes

I have problem with gnokii 0.6.31 +usb huawei e220 (centos 6.4 64 bit) Normaly works ok.

echo "SMS from Huawei" | gnokii --phone huawei --config /etc/gnokiirc --sendsms 1234567890
GNOKII Version 0.6.31
Send succeeded with reference -1!

Open in new window


But after one,two days it's stop working, and i get:

echo "SMS from Huawei" | gnokii --phone huawei --config /etc/gnokiirc --sendsms 1234567890 
GNOKII Version 0.6.31 Initialization failed (11) 
Telephone interface init failed: Command timed out.
Quitting.

Open in new window


Only solution i know it's to plug out/in usb huawei modem , and it start working.

I try with this, but don't work.
echo '2-1' |tee /sys/bus/usb/drivers/usb/unbind
echo '2-1' |tee /sys/bus/usb/drivers/usb/bind

Open in new window


I got the same output whenever it's working or not

gnokii --identify 
GNOKII Version 0.6.31 
Apparently you didn't configure gnokii. Please do it prior to using it. You can get some clues from comments included in sample config file or give a try with gnokii-configure utility included in gnokii distribution.
IMEI : Unknown 
Manufacturer : Unknown 
Model : Unknown
Product name : Unknown
Revision : Unknown

Open in new window


info from /var/log/messages
Jun 15 12:36:02 chi kernel: usbcore: registered new interface driver usbserial 
Jun 15 12:36:02 chi kernel: USB Serial support registered for generic
 Jun 15 12:36:02 chi kernel: usbcore: registered new interface driver usbserial_generic
 Jun 15 12:36:02 chi kernel: usbserial: USB Serial Driver core 
Jun 15 12:36:02 chi kernel: USB Serial support registered for GSM modem (1-port)
 Jun 15 12:36:02 chi kernel: option 2-1.8:1.0: GSM modem (1-port) converter detected
 Jun 15 12:36:02 chi kernel: usb 2-1.8: GSM modem (1-port) converter now attached to ttyUSB0
 Jun 15 12:36:02 chi kernel: option 2-1.8:1.1: GSM modem (1-port) converter detected
 Jun 15 12:36:02 chi kernel: usb 2-1.8: GSM modem (1-port) converter now attached to ttyUSB1 
Jun 15 12:36:02 chi kernel: usbcore: registered new interface driver option
 Jun 15 12:36:02 chi kernel: option: v0.7.2:USB Driver for GSM modems

Open in new window


lsusb

Bus 002 Device 004: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E230/E270/E870 HSDPA/HSUPA Modem

Open in new window


config:

[global] port = none model = fake initlength = default connection = serial use_locking = no serial_baudrate = 9600 smsc_timeout = 10

[xgnokii] allow_breakage = 0

[gnokiid] bindir = /usr/local/sbin/

[connect_script] TELEPHONE = 12345678

[phone_huawei] 
model = AT 
port = /dev/ttyUSB1 
connection = serial

Open in new window

LVL 1
pkofinatAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gheistCommented:
Does the modem freeze or reconnect USB bus somehow? Anything in dmesg when it "fails" ?
0
pkofinatAuthor Commented:
when i can't send sms, dmesg and /var/log/messages it's empty
lsusb give me the same output

                                 
Bus 002 Device 004: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E230/E270/E870 HSDPA/HSUPA Modem

Open in new window

0
gheistCommented:
Can you try restarting gnokiid using cron every couple of hours?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

pkofinatAuthor Commented:
i don't use daemon gnokiid, some script use only gnokii  command

gnokiid --debug
GNOKIID Version 0.6.31
gnokiid purpose is to work only with the phones that do not have AT Hayes
commands interpreter.

Open in new window

0
gheistCommented:
Another guess - You can use powertop to disable USB powersaving for modem and for it's USB port.
0
pkofinatAuthor Commented:
thanks for advice, i'll test it.
0
gheistCommented:
If it proves worth we will check how to disable powersaving for that circuit permanently. (+1W power draw per USB port)
0
pkofinatAuthor Commented:
for last 7 days it's working

I can't do it by powertop, by i think powersaving it's was it.
I do it by disable autosuspend to all usb devices and add newest kernel for repository.

for i in /sys/bus/usb/devices/*/power/autosuspend; do echo -1 > $i; done
for i in /sys/bus/usb/devices/*/power/level; do echo on > $i; done

thanks gheist
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gheistCommented:
Shortcut: echo -1 | tee /sys/bus/usb/devices/*/power/autosuspend
Correct way: https://www.linux.com/news/hardware/peripherals/180950-udev
0
pkofinatAuthor Commented:
I can't do it by powertop, by i think powersaving it's was it.
I do it by disable autosuspend to all usb devices and add newest kernel for repository.

And i used diffrent tool to solve the problem.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Wireless Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.