wdoekes / asterisk-chan-dongle

chan_dongle channel driver for Huawei UMTS cards, works with Asterisk 14+
Other
299 stars 104 forks source link

@ sign after Provider Name #39

Closed 532910 closed 4 years ago

532910 commented 7 years ago

Sometimes, after some time, I see at sign or unprintable square at the end of provider name:

cellgate*CLI> dongle show device state tele2 -------------- Status ------------- ... Provider Name : Tele2� ...

cellgate*CLI> dongle show device state tele2 -------------- Status ------------- ... Provider Name : Tele2@ ...

This is expected output: cellgate*CLI> dongle show device state tele2 -------------- Status ------------- ... Provider Name : Tele2 ...

532910 commented 7 years ago

sometimes dongle cmd tele2 reset helps sometimes I need to reboot

wdoekes commented 7 years ago

An @ sign would be an incorrectly decoded NUL.

But the fact that the output changes worries me more.

If you find any more info, please update this ticket.

532910 commented 7 years ago

And now it's "TELE2" in uppercase:

dongle show device state tele2 ... Provider Name : TELE2

532910 commented 7 years ago

I don't know, how I do this. I just toggle modem power on the usb hub.

532910 commented 7 years ago

And some time after it become Tele2� again.

532910 commented 7 years ago

Looks like it's not the asterisk-chan-dongle bug!

Welcome to minicom 2.7.1

AT+COPS? +COPS: 0,2,"25020",2

OK

AT+COPS=? +COPS: (2,"TELE2 RU","TELE2 RU","25020",2),(1,"MTS-RUS","MTS","25001",2),(1,"Beeline","Beeline","25099",2),(1,"MegaFon)

OK AT+COPS=? +COPS: (2,"TELE2 RU","TELE2 RU","25020",2),(1,"MegaFon RUS","MegaFon","25002",2),(1,"Beeline","Beeline","25099",2),(1,)

OK AT+COPS=? +COPS: (2,"Tele2@","Tele2�","25020",2),(1,"MTS-RUS","MTS","25001",2),(1,"Beeline","Beeline","25099",2),(1,"MegaFon RUS)

OK

532910 commented 7 years ago

May it be a simcard bug?

532910 commented 7 years ago

Another dongle shows the same error, but all my dongles are E1550 with the same firmware.

532910 commented 7 years ago

I've replaced the simcard, but nothing changed. Sometimes it shows +COPS: (2,"Tele2@","Tele2�","25020",2)... sometimes it shows +COPS: (2,"Tele2�","Tele2 ","25020",2)...

wdoekes commented 4 years ago
diff --git a/at_parse.c b/at_parse.c
index 888ff8a..2598f65 100644
--- a/at_parse.c
+++ b/at_parse.c
@@ -103,6 +103,16 @@ EXPORT_DEF char* at_parse_cops (char* str)
        if(marks[3][-1] == '"')
            marks[3]--;
        marks[3][0] = 0;
+       /* Sometimes there is trailing garbage here;
+        * e.g. "Tele2<U+FFFD>" instead of "Tele2"
+        * see github issue #39 */
+       while (marks[3] > marks[2] && (
+               (unsigned char)marks[3][-1] < 32 ||
+               (unsigned char)marks[3][-1] == '@' ||
+               (unsigned char)marks[3][-1] >= 128)) {
+           marks[3]--;
+           marks[3][0] = 0;
+       }
        return marks[2];
    }

(edit: swapped order of marks[3]-- and =0)

wdoekes commented 4 years ago

Maybe you want to share the make/model of your dongle as well.

532910 commented 4 years ago

E1550 patched for voice support, lsusb shows: 12d1:1001 Huawei Technologies Co., Ltd. E161/E169/E620/E800 HSDPA Modem

532910 commented 4 years ago

The patch fixes both #69 and #39 (this one)

532910 commented 4 years ago

Just an acknowledgment that master works fine. Thank you, Walter!