Sending SMS from cli containing cyrillic characters

Hello
On Archer MR200 v6 installed https://downloads.openwrt.org/releases/24.10.0/targets/ramips/mt76x8/openwrt-24.10.0-ramips-mt76x8-tplink_archer-mr200-v5-squashfs-tftp-recovery.bin

I cant't send sms with cyrillic character by command:
uqmi -d /dev/cdc-wdm0 --send-message 'тест' --send-message-target 89991112233
i receive an sms with unreadable text

with latin character I receive normal sms

and I haven't any ttyUSB ports for tests with sms-tool or at command

How send sms with cyrillic character?

Could you wait for 24.10.2 for proper hardware support?

Would not solve unicode dilemma though. (suggest you change title as this is not a device but tooling issue)

GSM charset handling is weird. Don't know about uqmi support, but FWIW using ModemManager worked for me in a quick test on a ZTE MF286D just now:

root@mf286d:~# mmcli -m any  --messaging-create-sms=number=+4747xxxxxx,text="тест"
  ------------------------
  Messaging | created sms: /org/freedesktop/ModemManager1/SMS/1
root@mf286d:~# mmcli -s 1
  -----------------------------
  General    |            path: /org/freedesktop/ModemManager1/SMS/1
  -----------------------------
  Content    |          number: +4747xxxxxx
             |            text: тест
  -----------------------------
  Properties |        pdu type: submit
             | delivery report: not requested
root@mf286d:~# mmcli -s 1 --send
successfully sent the SMS

The text was received and displayed correctly on my Android phone

1 Like

Why is that? Could you please share the output of cat /sys/kernel/debug/usb/devices

Several years ago, I used https://smstools3.kekekasvi.com to send SMS with any Unicode characters. The last software version seems to be from 2017, but there has been some recent activity on the forum. Based on https://smstools3.kekekasvi.com/index.php?p=national_language_shift_tables it would seem to me that there never was any 7-bit encoding for Cyrillic, and Unicode would have to be used instead. So, instead of 160 seven-bit characters per message, you could have up to 70 UTF-16 codes per message (or up to 35 emojis or other code points that are outside the Basic Multilingual Plane).

I haven’t used other ways of sending SMS from Linux. I hope that this helps find you a way to specify or implement the proper encoding.

Looking at the source code it seems to implement charset support for receive but not send.

On send it simply assumes the input is a latin1 byte stream:

On receive it "decodes" 8bit and UCS-2 messages:

But the display is still left to the caller, so I'm not sure this helps much wrt command line support. You get a "ucs-2" field with a byte stream which has to be interpreted as ucs-2 byt something else

1 Like

This tool could be used for conversion as I remember:

root@OpenWrt:~# cat /sys/kernel/debug/usb/devices

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 6.06
S:  Manufacturer=Linux 6.6.73 ehci_hcd
S:  Product=EHCI Host Controller
S:  SerialNumber=101c0000.ehci
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=05c6 ProdID=9025 Rev= 3.18
S:  Manufacturer=Android
S:  Product=Android
S:  SerialNumber=fcdba599
C:* #Ifs= 9 Cfg#= 1 Atr=a0 MxPwr=500mA
A:  FirstIf#= 6 IfCount= 3 Cls=01(audio) Sub=00 Prot=00
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E:  Ad=88(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
I:* If#= 6 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=(none)
I:* If#= 7 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
I:  If#= 7 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
E:  Ad=8a(I) Atr=05(Isoc) MxPS=  16 Ivl=1ms
I:* If#= 8 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
I:  If#= 8 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
E:  Ad=07(O) Atr=09(Isoc) MxPS=  16 Ivl=1ms
1 Like

for ModemManager there is not enough space - 1.07 MiB free

Yes, I sort of expected that. Then I guess you (or someone else, but who would that be?) will have to add the necessary support to uqmi. If you use iconv to convert the text then all you need is some way to tell uqmi to label the data as UCS-2.

Or continue the AT command alternative @AndrewZ suggested. Looks like you do have the ports, You're just lacking a driver. But the modem device ID isn't known by any of the USB serial drivers. Don't know why that was left out when it was added to qmi_wwan. Anyway, that can easily be solved and I'm sure Andrew has the proper procedure.

1 Like

Make sure you have kmod-usb-serial-option installed.
Then run (and add the same to startup):
echo "05c6 9025 ff" > /sys/bus/usb-serial/drivers/option1/new_id
That will give you some ttyUSB interfaces, If#= 2 (the 3rd tty interface) should be your AT command port. As a side effect the driver will wrongly grab your ADB interface (If#= 1).

i install kmod-usb-serial-option and echo "05c6 9025 ff" > /sys/bus/usb-serial/drivers/option1/new_id

try check at command - root@OpenWrt:~# picocom --q /dev/ttyUSB2
but shell hangs

Please show cat /sys/kernel/debug/usb/devices output once again.

root@OpenWrt:~# cat /sys/kernel/debug/usb/devices

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  1, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 6.06
S:  Manufacturer=Linux 6.6.73 ehci_hcd
S:  Product=EHCI Host Controller
S:  SerialNumber=101c0000.ehci
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=05c6 ProdID=9025 Rev= 3.18
S:  Manufacturer=Android
S:  Product=Android
S:  SerialNumber=fcdba599
C:* #Ifs= 9 Cfg#= 1 Atr=a0 MxPwr=500mA
A:  FirstIf#= 6 IfCount= 3 Cls=01(audio) Sub=00 Prot=00
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=option
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E:  Ad=88(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
I:* If#= 6 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=(none)
I:* If#= 7 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
I:  If#= 7 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
E:  Ad=8a(I) Atr=05(Isoc) MxPS=  16 Ivl=1ms
I:* If#= 8 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
I:  If#= 8 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
E:  Ad=07(O) Atr=09(Isoc) MxPS=  16 Ivl=1ms

You can also try the next port, but not the first two.

I tried all ttyUSB* ports

I can only think of trying the same after reboot/reset.

I took a stab at this and realized that this is hard since UCS-2 text tend to include lots of null bytes.

But taking the ModemManager approach and always send as UCS-2 if it fits in a single message turned out to be pretty simple:

Will try to find some time to create a PR for that.

1 Like