USB Dongle stops working

Hello,
I tried to setup a SMS server with a HUAWEI E160 using smstools3.
Receiving Test-SMS works as expected for some hours.
But after a while the E160 did not receive SMS anymore.

When looking into the smstools3 log everything looks normal.

2022-09-22 12:09:43,6, E160: Checking device for incoming SMS                                                                                                      
2022-09-22 12:09:43,6, E160: Checking if modem is ready                                                                                                            
2022-09-22 12:09:43,6, E160: Pre-initializing modem                                                                                                                
2022-09-22 12:09:43,6, E160: Initializing modem                                                                                                                    
2022-09-22 12:09:43,6, E160: Signal Strength Indicator: (17,99) -79 dBm (Good), Bit Error Rate: not known or not detectable                                        
2022-09-22 12:09:43,6, E160: Checking if Modem is registered to the network                                                                                        
2022-09-22 12:09:43,6, E160: Modem is registered to the network                                                                                                    
2022-09-22 12:09:43,6, E160: Selecting PDU mode                                                                                                                    
2022-09-22 12:09:43,6, E160: Checking memory size                                                                                                                  
2022-09-22 12:09:44,6, E160: No SMS received 

But there is no SMS received like here before

2022-09-21 19:58:58,6, E160: Checking device for incoming SMS                                                                                                      
2022-09-21 19:58:58,6, E160: Checking if modem is ready                                                                                                            
2022-09-21 19:58:58,6, E160: Pre-initializing modem                                                                                                                
2022-09-21 19:58:58,6, E160: Initializing modem                                                                                                                    
2022-09-21 19:58:58,6, E160: Signal Strength Indicator: (17,99) -79 dBm (Good), Bit Error Rate: not known or not detectable                                        
2022-09-21 19:58:58,6, E160: Checking if Modem is registered to the network                                                                                        
2022-09-21 19:58:58,6, E160: Modem is registered to the network                                                                                                    
2022-09-21 19:58:58,6, E160: Selecting PDU mode                                                                                                                    
2022-09-21 19:58:58,6, E160: Checking memory size                                                                                                                  
2022-09-21 19:58:59,6, E160: Used memory is 1, list: 0                                                                                                             
2022-09-21 19:58:59,6, E160: Trying to get stored message 0                                                                                                        
2022-09-21 19:58:59,5, E160: SMS received, From: 49176XXXXXXXX                                                                                                     
2022-09-21 19:58:59,6, E160: Wrote an incoming message file: /var/spool/sms/incoming/E160.fFkMjB                                                                   
2022-09-21 19:58:59,3, E160: Exec: eventhandler said something:                                                                                                    
2022-09-21 19:58:59,3, E160: ! => sending SMS as mail now                                                                                                          
2022-09-21 19:58:59,3, E160: ! please remove file /var/spool/sms/incoming/E160.fFkMjB                                                                              
2022-09-21 19:58:59,6, E160: Deleting message 0                                                                                                                    

I found that after unplugging the USB dongle an plugging again the missing SMS are received imediatly.

So I guess that there is a problem with USB.
My first thougt was: bad power supply. So I replaced it. But no luck.

And in fact the WAN port (network chip) of my NanoPi R2S ist connected via USB too. But there are no drop outs on WAN ....

Looking at dmesg did not help at all. The ringbuffer seems quite small. Same with logread.

How to find the problem?

Henning

do you know for a fact the dongle is still "online", and would it pass internet data if you killed your main connection ?

some ISPs terminate the connections after X hours of inactivity, you might need to implement a keep alive.

@frollic
There is no data connection at all !
The sim card supports phone and SMS services only.

So why the provider should kill a non existing connection?

When inserting the same sim card to a really old phone. I can still receive SMS. Even after weeks of inactivity...

I started writing all messages from dmesg / logread / smstools3 to disk (sd-card) two day's ago. Just to be sure ist's not a power problem I added an active USB Hub.
But nothing new. Not one hint in the logs. The modem is talking via USB, but it stops receiving irregular. Sometimes after 1h sometimes after 14h.

While looking for a solution I found this entry.

Hm, I'm using ttyUSB1 in the past. Changed to ttyUSB0 now. Wait and see if something changes ...

Reply to myself.
Changing tty port did not change anything :frowning:

see if usbreset can help you, if you run it periodically ...

I'm wondering if usbreset did a full reset of the device.

After pluggin in the device I get this:

root@R2S:~# dmesg                                                                                                                                                 
[160837.450576] usb 1-1: new high-speed USB device number 11 using ehci-platform                                                                                   
[160837.621276] usb-storage 1-1:1.0: USB Mass Storage device detected
[160837.623173] scsi host0: usb-storage 1-1:1.0
[160837.624876] usb 1-1: USB disconnect, device number 11
[160845.014386] usb 1-1: new high-speed USB device number 12 using ehci-platform
[160845.187804] usb-storage 1-1:1.0: USB Mass Storage device detected
[160845.210713] option 1-1:1.0: GSM modem (1-port) converter detected
[160845.211790] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[160845.213012] usb-storage 1-1:1.1: USB Mass Storage device detected
[160845.250972] option 1-1:1.1: GSM modem (1-port) converter detected
[160845.252143] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[160845.253427] usb-storage 1-1:1.2: USB Mass Storage device detected
[160845.256686] scsi host0: usb-storage 1-1:1.2
[160845.258266] usb-storage 1-1:1.3: USB Mass Storage device detected
[160845.261871] scsi host1: usb-storage 1-1:1.3
[160846.286465] scsi 1:0:0:0: Direct-Access     HUAWEI   MMC Storage      2.31 PQ: 0 ANSI: 2
[160846.288867] scsi 0:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[160846.336421] sd 1:0:0:0: [sda] Attached SCSI removable disk

But after usbreset I got only this:

root@R2S:~# usbreset 12d1:1003                                                                                                                                    
Resetting HUAWEI Mobile ... ok
root@R2S:~# dmesg                                                                                                                                                 
[160635.367928] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0                                                                        
[160635.369599] option 1-1:1.0: device disconnected
[160635.371043] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[160635.372205] option 1-1:1.1: device disconnected
[160635.499529] usb 1-1: reset high-speed USB device number 10 using ehci-platform
[160635.661197] usb-storage 1-1:1.0: USB Mass Storage device detected
[160635.683798] option 1-1:1.0: GSM modem (1-port) converter detected
[160635.684784] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[160635.685565] usb-storage 1-1:1.1: USB Mass Storage device detected
[160635.703858] option 1-1:1.1: GSM modem (1-port) converter detected
[160635.704967] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2

Then I tried unbind/bind

 root@R2S:~# dmesg -C                                                                                                               
 root@R2S:~# echo -n '1-1' > /sys/bus/usb/drivers/usb/unbind                                                                        
 root@R2S:~# echo -n '1-1' > /sys/bus/usb/drivers/usb/bind                                                                          
 root@R2S:~# dmesg                                                                                                                  
[163443.831824] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0                                                                        
[163443.834027] option 1-1:1.0: device disconnected
[163443.835233] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[163443.836146] option 1-1:1.1: device disconnected
[163452.387410] usb-storage 1-1:1.0: USB Mass Storage device detected
[163452.389089] option 1-1:1.0: GSM modem (1-port) converter detected
[163452.390219] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[163452.391499] usb-storage 1-1:1.1: USB Mass Storage device detected
[163452.405078] option 1-1:1.1: GSM modem (1-port) converter detected
[163452.406068] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[163452.407173] usb-storage 1-1:1.2: USB Mass Storage device detected
[163452.409081] scsi host0: usb-storage 1-1:1.2
[163452.410408] usb-storage 1-1:1.3: USB Mass Storage device detected
[163452.412326] scsi host1: usb-storage 1-1:1.3
[163453.420242] scsi 0:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[163453.422238] scsi 1:0:0:0: Direct-Access     HUAWEI   MMC Storage      2.31 PQ: 0 ANSI: 2
[163453.449471] sd 1:0:0:0: [sda] Attached SCSI removable disk