Warning: Declaration of bdyssh_menu_titles::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = Array, $id = 0) in /var/www/jopka/data/www/bdyssh.ru/wp-content/themes/bdyssh/functions.php on line 57
Bdyssh! // Бдыщщь!

Вообще—то я не религиозный человек, но если ты есть там наверху, спаси меня, %username%.

How to use Huawei Hilink E303 as serial modem (for SMS) / Настройка Huawei Hilink E303 для автоматизированной отправки SMS (из скриптов)

Warning! This is uncomplete, not well tested, nighty article. Do not use on production servers. I will add bells and whistles later.
This is for those who can’t wait and want to be at bleeding edge.

How to use Huawei Hilink E303 as serial modem (for SMS),
when it works out-of-box as Ethernet card and Internet works also already,
so all available HOWTOs not applicable.

Tested on:

$ cat /etc/lsb-release

connect new E303 (with SIM installed) after long pause (for easy dmesg read)

read dmesg and see how changes usb ID from 12d1:1f01 to 12d1:14dc.

After that, internet works just fine, but we not need it: ls /dev/ttyU* show nothing.

remove with synaptic, usb-modeswitch completely (+data).

remove E303.

reconnect E303, read dmesg and see ID 12d1:1f01 not changes.
(see lsusb also).

See in Nautilus it now looks like compact disk icon, not removable drive.

Get http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-2.0.1.tar.bz2 ,
compile (libusb1.0-0-dev needed) using ‘make’.

create file e303.txt

# Huawei E303 HiLink

DefaultVendor= 0x12d1
DefaultProduct= 0x1f01

TargetVendor= 0x12d1
TargetProduct= 0x1001



and run
$ sudo ./usb_modeswitch -c e303.txt

see complete output, ended with ‘-> Run lsusb to note any changes. Bye!’

(also use lsusb to check)

$ ls /dev/ttyU*
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2

$ sudo chmod a+rw /dev/ttyU*

minicom via /dev/ttyUSB0

turn on Local Echo: ^a, z, e, Enter

send command:

NOTE: This command teoretically permanently changes behaviour of E303,
so be careful. None of CDROM or Flash drive icons will now appear in Nautilus, at least,
even after replug E303 and/or system reboot.

quit from minicom ^a, q (quit w/o reset)

replug E303 (at another port is better

$ ls /dev/ttyU*
should again shows
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2

(but do not forget again $ sudo chmod a+rw /dev/ttyU*)

now lsusb shows
Bus 001 Device 027: ID 12d1:1c05 Huawei Technologies Co., Ltd.

and dmesg shows
[15358.209721] option 1-1.4:1.0: GSM modem (1-port) converter detected
[15358.209885] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB0

to ttyUSB2.

…and finally!

echo “SMS Test Message” | gsmsendsms -d /dev/ttyUSB0 -b 19200 8915phonenumber

And now, important instruction manual how to do next:

1. Stand up,
2. Try not to dance,
3. Dance a lot.

TODO: Try to restore original ID (as out-of-box) with 1) usb_modeswitch, or 2) minicom.

Added info about old distro:

If you have old LTS release and can’t update your system due to it is used for production:

$ cat /etc/lsb-release

$ uname -a
Linux test-desktop 2.6.32-122-rtai #rtai SMP Tue Jul 27 12:44:07 CDT 2010 i686 GNU/Linux

(note: special real time kernel, rtai, in use)

After you configure your modem on fresh Linux version as shown above, and on your old system, when you see ’12d1:1c05 Huawei Technologies Co., Ltd.’ but /dev/ttyU* show nothing, use:

$ sudo modprobe usbserial vendor=0x12d1 product=0x1c05

and ls /dev/ttyU* again.
(do not forget again $ sudo chmod a+rw /dev/ttyU*). Should work.

Permanent fix: $ gedit /etc/modules and add ‘usbserial vendor=0x12d1 product=0x1c05’.

But having old kernel on a server is not really a good idea, so if we need to have old special kernel somewhere, we should establish separate standalone server for communication purposes (and connect modem to it flawlessly as i show above).

Hope it helps.