I have a D-LINK DWM-157 USB 3G stick with working sms-only operator plan SIM card and without PIN code.
For some reason, neither gammu, nor gsmsendsms, nor gsmctl can connect to the device. They all report timeouts.
BUT wvdial finds the device allright and is able to both talk to it and make /etc/wvdial.conf entry:
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CFUN=1,0
Modem Type = Analog Modem
; Phone = <Target Phone Number>
ISDN = 0
; Password = <Your Password>
New PPPD = yes
; Username = <Your Login Name>
Modem = /dev/ttyUSB0
Baud = 9600
I also can manually execute all AT commands and send myself an sms by echo > /dev/ttyUSB0
#cat < /dev/ttyUSB0 &
# echo "ATZ" > /dev/ttyUSB0
OK
# echo "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0" > /dev/ttyUSB0
OK
# echo "AT+CMGS=\"+myphonewithcountrycode\",145" > /dev/ttyUSB0
>
# echo "foobar^Z" > /dev/ttyUSB0
foobar
+CMGS: 2
OK
#
If I do a cat < /dev/ttyUSB0 &
and then try gammu or gsmctl I can see that they both send AT commands and that modem replies with OK, but gammu/gsm act as if they didn't receive OK.
There is something very strangely wrong. What could be the problem?
Turned out there is one more (unused) software managing the modem: ModemManager.
As per this answer https://unix.stackexchange.com/questions/97242/how-to-send-at-commands-to-a-modem-in-linux I disabled ModemManager.
After
systemctl disable ModemManager
gammu can now identify my modem:There seems to be plenty of (sometimes apparently competing) services trying to service the same devices in newest Ubuntus. I had the same kind of trouble with my DNS settings, which get kept overwritten by NetworkManger, then systemd resolved and both ignoring what I had in netplan.