![gnokii 有时初始化失败](https://linux22.com/image/660388/gnokii%20%E6%9C%89%E6%97%B6%E5%88%9D%E5%A7%8B%E5%8C%96%E5%A4%B1%E8%B4%A5.png)
我在使用 gnokii 0.6.31 +usb huawei e220 (centos 6.4 64 bit) 时遇到了问题,正常运行。
echo "SMS from Huawei" | gnokii --phone huawei --config /etc/gnokiirc --sendsms 1234567890
GNOKII Version 0.6.31
Send succeeded with reference -1!
但几天后它停止工作,并出现以下错误情况:
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.
我知道的唯一解决方案是拔下并重新连接华为 USB 调制解调器,然后它就可以再次工作了。
我尝试了这个,但是没有用:
echo '2-1' |tee /sys/bus/usb/drivers/usb/unbind
sleep 20
echo '2-1' |tee /sys/bus/usb/drivers/usb/bind
无论它是否工作,我都会得到相同的输出
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
来自 /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
输出lsusb
:
Bus 002 Device 004: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E230/E270/E870 HSDPA/HSUPA Modem
配置:
[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
答案1
这解决了我的问题:
我从存储库中添加新内核并禁用所有 USB 设备的自动挂起:
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