[phpBB Debug] PHP Notice: in file /includes/session.php on line 2167: Array to string conversion
[phpBB Debug] PHP Notice: in file /includes/session.php on line 2167: Array to string conversion
[phpBB Debug] PHP Notice: in file /includes/session.php on line 2167: Array to string conversion
[phpBB Debug] PHP Notice: in file /includes/session.php on line 2167: Array to string conversion
Installing and configuring a ZTE K3520-Z mobile broadband modem under SuSE 11.1 Linux :: Asperger Technical

 

Username:  Remember me?
Password:




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Installing and configuring a ZTE K3520-Z mobile broadband modem under SuSE 11.1 Linux
Post Number:#1  PostPosted: Wed Sep 09, 2009 10:45 pm 
Offline
Site Admin

Joined: 1st June, 2007
Posts: 48
This short article describes my experience of trying to install and configure a ZTE K3520-Z Vodafone Mobile Connect modem on a laptop running SuSE Linux 11.1 to enable me to access the internet in locations where there isn't an unsecured wireless LAN around. This was quite a challenging project even for someone with over 10 years experience of working on Linux systems.

The modem plugs into the USB port and visually resembles a USB memory stick. Drivers are not required on computers running Windows because the software to control the modem is stored in a non-volatile memory inside the modem itself. When the modem is inserted into a Windows PC, it initially resembles a flash memory stick or virtual CD-ROM drive, then automatically downloads and executes the control software before being switched to operate as a modem. This inbuilt software unfortunately does not work with Linux which means that the only way to use the modem with a Linux machine is to install a software package to control it.

The software package used to control mobile broadband modems on the Vodafone network under Linux is called Vodafone Mobile Connect (hereafter referred to as VMC) that can be downloaded from Betavine. The SuSE package contains the RPM for VMC version 2.10.01 along with a selection of dependency RPM files that have to be installed beforehand, and installation instructions.

VMC is written in python rather than C which explains why many of its dependencies are python packages. My first task was to check that all the dependencies were installed and install any that were missing. I found that python-crypt and python-twisted-conch were neither installed nor included on the SuSE 11.1 DVD. Conversely, python-tz-2006p and python-sqlite2 that were contained in the package were already installed. I downloaded python-twisted-conch-8.1.0-1.37.x86_64.rpm and python-crypto-2.0.1-28.81.x86_64.rpm from an RPM repository. They installed perfectly with no problems. Next I installed the ozerocdoff and usb_modeswitch RPMs, then finally, VMC without any problems. An icon for VMC now appeared under New Applications on GNOME.

Version 0.9.7 of usb_modeswitch proved to be problematic with the K3520-Z modem so I upgraded it to version 1.0.2. Officially usb_modeswitch has to be compiled although usb_modeswitch-1.0.2-1.pm.3.i586.rpm can be found in RPM repositories.

Normal users are only able to run VMC if they are members of the uucp and dialout groups. I added myself to these groups by entering

# usermod -A uucp,dialout Reseda

whilst logged in as root. Replace Reseda with the name of the user you wish to include in the uucp and dialout groups. Alternatively you can use User and Group management under YaST to add users to groups. Logout then login again so that the changes become effective.

The instructions conclude with "Enjoy your mobile connection!" but there are still a few more tasks to complete...

I executed VMC by entering

$ vodafone-mobile-connect-card-driver-for-linux

The program starts to load but terminates with the following error message

File "/usr/share/vodafone-mobile-connect/vmc/common/plugin.py", line 26, in <module>

from pytz import timezone

exceptions.ImportError: No module named pytz

Failed to load application: No module named pytz

What is wrong? An investigation confirmed that pytz is definitely installed in the python-tz-2006p package. I tried reinstalling python-tz-2006p but got exactly the same error. A more detailed investigation revealed that VMC loads python modules from the /usr/lib64/python2.6/site-packages directory whereas pytz is located in the /usr/lib/python2.6/sitepackages directory.

I solved this problem by making the following symbolic link

# ln -s /usr/lib/python2.6/sitepackages/pytz /usr/lib64/python2.6/site-packages/pytz

therefore enabling successful execution of VMC.

The next problem is when VMC is executed it displays a "No known devices found" message in a window and prompts me for custom device settings. Why doesn't VMC automatically recognise my modem when it is plugged in?

I entered

$ lsusb

and amongst the output is Bus 001 Device 004: ID 19d2:2000 ONDA Communication S.p.A.

The significance of the 2000 for the PID shows that the modem is in CD-ROM mode rather than modem mode which is why VMC fails to recognise it. I previously mentioned that the modem initially tries to download the control software to the computer when it is plugged in. This software is responsible for switching the modem to modem mode but it won't execute under Linux which is why the modem stays in C-ROM mode unless switched to modem mode from within Linux.

Switching a modem from CD-ROM mode to modem mode is accomplished in Linux using the usb_modeswitch utility with the correct parameters for the particular modem. I checked /etc/usb_modeswitch.conf to see if it contained the parameters for the ZTE K3520-Z. They were not included. I then did a search on the internet and managed to find what were claimed to be the correct parameters for the ZTE K3520-Z.

I entered

# usb_modeswitch -v 0x19d2 -p 0x2000 -m 9 -M 5553424312345678000000000000061b000000020000000000000000000000

whilst logged in as root. The significance of the long and illogical number is the message that must be sent to the modem to switch it from CD-ROM to modem mode. This message is sent to endpoint 9 of the USB device with a VID of 0x19d2 and a PID of 0x2000.

The following output was produced

* usb_modeswitch: tool for controlling "flip flop" mode USB devices
* Version 1.0.2 (C) Josua Dietze 2009
* Works with libusb 0.1.12 and probably other versions

Looking for target devices ...
No devices in target mode or class found
Looking for default devices ...
Found default devices (1)
Accessing device 011 on bus 002 ...
Using endpoints 0x09 (out) and 0x89 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
No driver found. Either detached before or never attached

Received inquiry data (detailed identification)
-------------------------
Vendor String: ZTE Corp
Product String: USB Storage
Revision String: 2.31
-------------------------

Device description data (identification)
-------------------------
Manufacturer: Qualcomm, Incorporated
Product: USB ZTE Storage
Serial No.: P671M8VDF_MS
-------------------------
Setting up communication with interface 0 ...
Trying to send the message to endpoint 0x09 ...
OK, message successfully sent
Device is gone, skipping further steps ...
Checking for mode switch after 3 seconds settling time ...
Original device can't be accessed anymore. Good.
Found a new device in target mode or class

Mode switch succeeded. Bye.


I entered

$ lsusb

and amongst the output is Bus 001 Device 004: ID 19d2:0055 ONDA Communication S.p.A. which shows that the modem is now in modem mode.

It's inconvenient having to manually switch the modem from CD-ROM mode to modem mode every time I come to use VMC, but thankfully, this can be automatically implemented whenever the modem is inserted into the computer by using udev. I created a new udev rule file /etc/udev/rules.d/45-K3520-Z.rules with the following content

# ZTE K3520-Z
SUBSYSTEM=="usb", SYSFS{idVendor}=="19d2", SYSFS{idProduct}=="2000", RUN+="/usr/sbin/usb_modeswitch"


and added the following content to /etc/usb_modeswitch.conf

########################################################
# ZTE K3520-Z
#

DefaultVendor= 0x19d2
DefaultProduct= 0x2000

;TargetVendor= 0x19d2
;TargetProduct= 0x0055

MessageEndpoint=0x09

MessageContent="5553424312345678000000000000061b000000020000000000000000000000"

########################################################


How this works is that if a USB device with a VID of 0x19d2 and a PID of 0x2000 is detected, then usb_modeswitch is executed which transmits the message contained in /etc/usb_modeswitch.conf to the USB device with the VID and PID defined in /etc/usb_modeswitch.conf

Next I entered

# /etc/init.d/boot.udev reload

whilst logged in as root to reload the udev rules.

I inserted the modem and ran lsusb several times in order to monitor the USB devices. After a few seconds the output contained Bus 001 Device 004: ID 19d2:0055 ONDA Communication S.p.A. which confirmed that the automatic switching to modem mode works.

I tried executing VMC again and it still displays a "No known devices found" message in a window and prompts me for custom device settings. What is wrong?

An investigation revealed that /dev/ttyUSB device files should have been created when the modem was inserted into the computer, but there was no trace of them at all. USB modems are serial USB devices that can only be used if a /dev/ttyUSB device file exists in order for the software to transmit and receive data to and from the modem. The /dev/ttyUSB device files are created by loading the usbserial kernel module.

I entered

$ lsmod | grep usb

to identify if the usbserial kernel module was loaded and it wasn't.

I entered

# /sbin/modprobe usbserial vendor=0x19d2 product=0x0055

whilst logged in as root and the ttyUSB0 to ttyUSB4 device files now appeared in the /dev directory. These ttyUSB device files all point to the USB device with a VID of 0x19d2 and a PID of 0x0055.

It is possible to automatically load the usbserial kernel module whenever the modem is inserted into the computer by using udev. I created a new udev rule file /etc/udev/rules.d/90-modprobe.rules with the following content

# ZTE K3520-Z
#
ACTION!="add", GOTO="ZTE_End"
#
SUBSYSTEM=="usb", SYSFS{idVendor}=="19d2",
SYSFS{idProduct}=="0055", GOTO="ZTE_Modem"
#
LABEL="ZTE_Modem"
RUN+="/sbin/modprobe usbserial vendor=0x19d2 product=0x0055"
#
LABEL="ZTE_End"


The order in which udev executes rules is according to the lexical position of the rule filename. I prefixed the rule to switch the modem from CD-ROM to modem mode with 45 to place it in the same category as the rule files for other modems. I decided to prefix the rule file to load the usbserial kernel module with a 90 to ensure it executed after the modem had switched to modem mode.

Next I entered

# /etc/init.d/boot.udev reload

whilst logged in as root to reload the udev rules.

I inserted the modem, waited a few seconds for it to switch to modem mode, then executed VMC. The following appeared in the output

get_plugin_by_vendor _product_id called with 0x19D2 and 0x0055

data port is /dev/ttyUSB1

ctrl port is /dev/ttyUSB3


VMC recognised my modem and allowed me to connect to the internet without requesting any other information from me. I loaded up Firefox and my homepage appeared a second or so later.

Conclusion

Some things are really easy if you know how and really frustrating if you don't know how. Configuring a ZTE K3520-Z modem is one of them. A new SuSE package containing all the latest and correct files, and clear concise instructions (copy these if you please), should definitely be created – and quickly.

Why the parameters for the ZTE K3520-Z are not included as standard in /etc/usb_modeswitch.conf intrigues me because it is supposed to be a popular modem that has been around for some time.


Top
 Profile  
 
Share this information
  • Delicious
  • Digg
  • Diigo
  • DZone
  • Facebook
  • Google
  • LinkedIn
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Twitter
  • Yahoo
    Display posts from previous:  Sort by  
    Post new topic Reply to topic  [ 1 post ] 

    All times are UTC


    Who is online

    Registered users: No registered users


    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum

    Search for:
    Jump to:  
    cron
    This forum is powered by phpBB