Today I had a chance to test Huawei E173 USB dongle and it works perfectly on my Mint Linux. All I had to do was to plug it in and turn on via network manager applet.
I wanted to test this dongle with CentOS 6 and the main idea was to use this device for SMS monitoring. Using online SMS providers is much cheaper and easier (a bunch of APIs) but the online services are useless when your network is disconnected.
There are a lot differences between RH based server distros and the new/cutting edge distro like Mint. To be honest, I expected the problems with CentOS.
The first thing was to check the USB dongle
[root@server ~]# dmesg |grep usb .... usb 2-4: new high speed USB device number 2 using ehci_hcd usb 2-4: New USB device found, idVendor=12d1, idProduct=1446 usb 2-4: New USB device strings: Mfr=3, Product=2, SerialNumber=0 usb 2-4: Product: HUAWEI Mobile usb 2-4: Manufacturer: HUAWEI Technology usb 2-4: configuration #1 chosen from 1 choice usb-storage: device found at 2 usb-storage: waiting for device to settle before scanning usb-storage: device found at 2 usb-storage: waiting for device to settle before scanning usbcore: registered new interface driver usb-storage usb-storage: device scan complete usb-storage: device scan complete ... |
Ops… the device is detected as USB storage which I didn’t expect (and I don’t want).
[root@server ~]# lsusb ... Bus 002 Device 002: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem) |
After some googling I discovered that the first thing I need to do is to install usb_modeswitch and smstools packages. The first package will be used to switch USB dongle from usb storage into modem mode. The second one will be used for SMS operations.
In the moment I tested this, I was far away from the server and I couldn’t try the simple plug/unplug method. The solution was to invoke the next command
[root@server ~]# usb_modeswitch -c /etc/usb_modeswitch.d/12d1\:1446 -v 0x12d1 -p 0x1446 Looking for target devices ... No devices in target mode or class found Looking for default devices ... found matching product ID adding device Found device in default mode, class or configuration (1) Accessing device 002 on bus 002 ... Getting the current device configuration ... OK, got current device configuration (1) Using first interface: 0x00 Using endpoints 0x01 (out) and 0x81 (in) Inquiring device details; driver will be detached ... Looking for active driver ... No driver found. Either detached before or never attached SCSI inquiry data (for identification) ------------------------- Vendor String: HUAWEI Model String: Mass Storage Revision String: 2.31 ------------------------- USB description data (for identification) ------------------------- Manufacturer: HUAWEI Technology Product: HUAWEI Mobile Serial No.: not provided ------------------------- Setting up communication with interface 0 Using endpoint 0x01 for message sending ... Trying to send message 1 to endpoint 0x01 ... OK, message successfully sent Resetting response endpoint 0x81 Could not reset endpoint (probably harmless): -71 Resetting message endpoint 0x01 Could not reset endpoint (probably harmless): -19 Device is gone, skipping any further commands -> Run lsusb to note any changes. Bye. |
As the output recommended, I tried again with lsusb
[root@server ~]# lsusb .... Bus 002 Device 003: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem ... |
Also, after this step, you should have
[root@server smsd]# ls /dev/ttyUSB* /dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2 |
I found that the settings file /etc/smsd.conf (for SMSTools) should be something like this:
devices = GSM1 logfile = /var/log/smsd/smsd.log loglevel = 7 user = smstools infofile = /var/run/smsd/smsd.working pidfile = /var/run/smsd/smsd.pid # 3.1.5 introduced smart logging # once your configuration is OK, set log level lower (5 is good in most cases) smart_logging = yes [GSM1] init = AT+CPMS="ME","ME","ME" device = /dev/ttyUSB0 incoming = yes |
You can find more information about the configuration parameters on the next link http://smstools3.kekekasvi.com/index.php?p=configure
Start smsd service with service smsd start
To send SMS message go into /var/spool/sms/outgoing/ dir and create the file testSMS (for example) and add the next content inside
To: 38765655849 fdfgdfgfg |
The other option is to use smssend command.
In case that something doesn’t work, check the logs inside /var/log/smsd/ dir.