1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cellular - Wireless - 3G Modem Installation

Discussion in 'Peripheral Hardware' started by acottag, Mar 31, 2010.

  1. acottag

    acottag New Member

    Messages:
    13
    Likes Received:
    0
    Hello!

    I am installing a 3g modem.

    Once logged as root and I give the command
    # tail /var/log/messages
    I got the follwoing set of messages:
    Code:
    Mar 31 14:34:05 Vega@acottag kernel: Root mount waiting for: usbus1
    Mar 31 14:34:05 Vega@acottag last message repeated 2 times
    Mar 31 14:34:05 Vega@acottag kernel: uhub1: 8 ports with 8 removable, self powered
    Mar 31 14:34:05 Vega@acottag kernel: Trying to mount root from ufs:/dev/ad0s1a
    Mar 31 14:35:20 Vega@acottag login: ROOT LOGIN (root) ON ttyv0
    Mar 31 14:35:27 Vega@acottag root: Unknown USB device: vendor 0x16d5 product 0x6501 bus uhub0
    Mar 31 14:35:27 Vega@acottag kernel: ugen0.2: <AnyDATA Corporation> at usbus0
    Mar 31 14:35:27 Vega@acottag kernel: ubsa0: <Data Interface> on usbus0
    From the last 3 messages I get to know data on the modem.

    How may get to know if the modem is installed?

    Thanks in advance.

    * This thread is started as part of a project for documention on Cellular Modem installation and Configuration; please see http://forums.freebsd.org/showthread.php?t=12801
     
  2. acottag

    acottag New Member

    Messages:
    13
    Likes Received:
    0
    Here go the steps to make in order to check if the modem is working with the computer.

    Step 1 - Identify new device node name when plugging modem usb cable.
    ---------------------------------------------------------------------

    Type tail /var/log/messages at shell prompt:
    [cmd="Vega@acottag#"] tail /var/log/messages[/cmd]
    Code:
    Mar 31 14:34:05 Vega@acottag kernel: Root mount waiting for: usbus1
    Mar 31 14:34:05 Vega@acottag last message repeated 2 times
    Mar 31 14:34:05 Vega@acottag kernel: uhub1: 8 ports with 8 removable, self powered
    Mar 31 14:34:05 Vega@acottag kernel: Trying to mount root from ufs:/dev/ad0s1a
    Mar 31 14:35:20 Vega@acottag login: ROOT LOGIN (root) ON ttyv0
    Mar 31 14:35:27 Vega@acottag root: Unknown USB device: vendor 0x16d5 product 0x6501 bus uhub0
    Mar 31 14:35:27 Vega@acottag kernel: ugen0.2: <AnyDATA Corporation> at usbus0
    Mar 31 14:35:27 Vega@acottag kernel: ubsa0: <Data Interface> on usbus0
    Vega@acottag#
    There is a device /dev/ugen0.2 referenced by line
    Code:
    Mar 31 14:35:27 Vega@acottag kernel: ugen0.2: <AnyDATA Corporation> at usbus0
    Step 2 - Manually connect to modem, using ppp comand.
    -----------------------------------------------------
    Step 2.1 - Start ppp.
    ---------------------
    Type ppp at shell prompt:
    [cmd="Vega@acottag#"]ppp[/cmd]
    Code:
    Loading /lib/libalias_cuseeme.so
    Loading /lib/libalias_irc.so
    Loading /lib/libalias_nbt.so
    Loading /lib/libalias_pptp.so
    Loading /lib/libalias_smedia.so
    Working in interactive mode
    Using interface: tun0
    ppp ON Vega@acottag>
    The ppp command prompt returns.

    Step 2.2 - Set ppp device.
    --------------------------
    Type set device /dev/ugen0.2 at ppp command line:

    ppp ON Vega@acottag> set device /dev/ugen0.2
    Code:
    ppp ON Vega@acottag>
    The ppp command prompt returns.

    Step 2.3 - Set device speed.
    ----------------------------
    Type set speed 115200 at ppp command line:

    ppp ON Vega@acottag> set speed 115200
    Code:
    ppp ON Vega@acottag>
    The ppp command prompt returns.

    Step 2.4 - Enter terminal mode in ppp.
    --------------------------------------
    Type command term:
    [cmd="Vega@acottag#"]ppp ON Vega@acottag> term[/cmd]
    Code:
    warning deflink: Entering terminal mode on /dev/ugen0.2
    type ’~?’ for help
    ppp ON Vega@acottag>
    
    The ppp command prompt returns.

    Step 2.5 - Issue comand AT to modem.
    ------------------------------------
    Type command at:
    ppp ON Vega@acottag> at
    Code:
    Warning at: command: Invalid command
    Warning at: Failed 1
    ppp ON Vega@acottag>
    
    In this example, the modem is not working with the computer, still; this could maybe predicted to happen, after message
    Code:
    Mar 31 14:35:27 Vega@acottag root: Unknown USB device: vendor 0x16d5 product 0x6501 bus uhub0
    got in Step 1.

    Please help.

    Thanks in advance.
     
  3. jb_fvwm2

    jb_fvwm2 Member

    Messages:
    1,570
    Likes Received:
    1
    Back when I used a 56k modem,
    in one TTY the ppp.conf would be in
    the background working while...
    Code:
    atz
    atdt 
    dial 1310.....
    (sometimes name, password after that...)
    
    while the other end of the connection would
    change the ppp prompt to ppP pPP PPP (1...2...3...)
    or vice versa, if all three CAPITALIZED then
    the connetion PPP was established and one
    could change to another ttys and have an
    internet connection.
    I always set
    set log local Phase Chat Connect LCP IPCP CCP CBCP tun command
    (all on one line) in ppp.conf so progress/error messages were
    onscreen pre-PPP rather than in a log file.
    (note that TUN maybe has changed since then to something
    else)
    ...
    Maybe part of the information above might help.
    OTOH I searched far and wide for cellular modem
    howto's and went with another equal-cost solution..
     
  4. aragon

    aragon New Member

    Messages:
    2,031
    Likes Received:
    0
    Disconnect your modem from the USB port and then run:

    Code:
    kldload u3g
    kldload usba
    
    Reinsert your modem. Device attachment logs in /var/log/messages should be different now (no ugen0.0), and there should be a TTY device in /dev now.

    Code:
    ls -l /dev/ttyU*
    
    Now you just need to figure out which TTY device is the correct one, and add that to ppp.conf.
     
  5. acottag

    acottag New Member

    Messages:
    13
    Likes Received:
    0
    Following the sugested procedure.

    Code:
    kldload u3g
    kldload usba
    
    1. Test if drivers u3g and ubsa are loaded.
    1.1 Driver u3g:

    Code:
    Vega@acottag# kldload u3g
    module_register: module uhub/u3g already exists!
    Module uhub/u3g failed to register: 17
    kldload: cant't load u3g: File exists
    
    1.2 Driver ubsa:

    Code:
    Vega@acottag# kldload ubsa
    module_register: module uhub/ubsa already exists!
    Module uhub/ubsa failed to register: 17
    kldload: cant't load ubsa: File exists
    
    These messages are displayed (I believe) because the two modules, u3g and ubsa, are statically compiled in the kernel, as defined in kernel configuration file /usr/src/sys/i386/conf/GENERIC:
    Code:
    (...)
    # USB Serial devices
    device		u3g		# USB-based 3G modems (Option, Huawei, Sierra)
    device		uark		# Technologies ARK3116 based serial adapters
    device		ubsa		# Belkin F5U103 and compatible serial adapters
    device		uftdi		# For FTDI usb serial adapters
    device		uipaq		# Some WinCE based devices
    device		uplcom		# Prolific PL-2303 serial adapters
    device		uslcom		# SI Labs CP2101/CP2102 serial adapters
    device		uvisor		# Visor and Palm devices
    device		uvscom		# USB serial support for DDI pocket's PHS
    (...)
    
    2. Reinsert modem cable; give command tail /var/log/messages:

    Code:
    Vega@acottag# tail /var/log/messages:
    Mar 31 14:35:27 Vega@acottag root: Unknown USB device: vendor 0x16d5 product 0x6501 bus uhub0
    Mar 31 14:35:27 Vega@acottag kernel: ugen0.2: <AnyDATA Corporation> at usbus0
    Mar 31 14:35:27 Vega@acottag kernel: ubsa0: <Data Interface> on usbus0
    

    3. List /dev/tty* devices:

    Code:
    Vega@acottag# ls -ld /dev/tty*
    crw------- 1 root wheel  0,  86 Apr  2 20:21 /dev/ttyU0
    crw------- 1 root wheel  0,  87 Apr  2 20:21 /dev/ttyU0.init
    crw------- 1 root wheel  0,  88 Apr  2 20:21 /dev/ttyU0.lock
    crw------- 1 root wheel  0,  39 Apr  2 20:21 /dev/ttyv0
    crw------- 1 root wheel  0,  40 Apr  2 20:21 /dev/ttyv1
    crw------- 1 root wheel  0,  41 Apr  2 20:21 /dev/ttyv2
    crw------- 1 root wheel  0,  42 Apr  2 20:21 /dev/ttyv3
    crw------- 1 root wheel  0,  43 Apr  2 20:21 /dev/ttyv4
    crw------- 1 root wheel  0,  44 Apr  2 20:21 /dev/ttyv5
    crw------- 1 root wheel  0,  45 Apr  2 20:21 /dev/ttyv6
    crw------- 1 root wheel  0,  46 Apr  2 20:21 /dev/ttyv7
    crw------- 1 root wheel  0,  47 Apr  2 20:21 /dev/ttyv8
    crw------- 1 root wheel  0,  48 Apr  2 20:21 /dev/ttyv9
    crw------- 1 root wheel  0,  49 Apr  2 20:21 /dev/ttyva
    crw------- 1 root wheel  0,  50 Apr  2 20:21 /dev/ttyvb
    crw------- 1 root wheel  0,  51 Apr  2 20:21 /dev/ttyvc
    crw------- 1 root wheel  0,  52 Apr  2 20:21 /dev/ttyvd
    crw------- 1 root wheel  0,  53 Apr  2 20:21 /dev/ttyve
    crw------- 1 root wheel  0,  54 Apr  2 20:21 /dev/ttyvf
    Vega@acottag#
    
    Check, device node /dev/ttyU0 is created by the system.

    4. Define the device and speed in /etc/ppp/ppp.conf as follows.

    Code:
    (...)
    set device /dev/ttyU0
    set speed 115200
    (...)
    
    5. Connect manually to the modem using ppp.

    5.1 Start ppp:

    Code:
    Vega@acottag# ppp
    Loading /lib/libalias_cuseeme.so
    Loading /lib/libalias_irc.so
    Loading /lib/libalias_nbt.so
    Loading /lib/libalias_pptp.so
    Loading /lib/libalias_smedia.so
    Working in interactive mode
    Using interface: tun0
    ppp ON Vega@acottag.net>
    
    5.4 Input term in ppp.

    Code:
    ppp ON Vega@acottag.net> term
    deflink: Entering terminal mode on /dev/ttyU0
    Type '~?' fo help
    ubsa_cfg_request:369: device request failed, err=USB_ERR_STALLED (ignored)
    ubsa_cfg_request:369: device request failed, err=USB_ERR_STALLED (ignored)
    (...)
    ubsa_cfg_request:369: device request failed, err=USB_ERR_STALLED (ignored)
    
    Error message outputs to fill the screen and the system hangs.

    Please help.
    :p
     
  6. acottag

    acottag New Member

    Messages:
    13
    Likes Received:
    0
    Hello!

    Does anyone knows where may I find documentation / publications with information regarding device configuration, in order to follow and understand article http://people.freebsd.org/~n_hibma/u3g.html)?

    Thanks in advance.
     
  7. varda

    varda New Member

    Messages:
    107
    Likes Received:
    0
    I've used episodically AnyData ADU-500A on FreeBSD 8.0

    Code:
    kldload ubsa
    
    Or in /boot/loader.conf to autostart:
    Code:
    ubsa_load="YES"
    
    Download from project [age and install:
    Code:
    fetch http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-1.1.1.tar.bz2
    fetch http://www.draisberghof.de/usb_modeswitch/usb_modeswitch.setup
    tar -xvf usb-modeswitch-1.1.1.tar.bz2
    cd usb_modeswitch-1.1.1 && make clean && make
    cp usb_modeswitch.conf /etc/usb_modeswitch.setup
    
    'make clean' required because Linux binary included in archive.

    Locate info for your modem model in downloaded database usb_modeswitch.setup and copy and paste that portion to /etc/usb_modeswitch.setup

    Run once or twice compiled usb_modeswitch watch it output and take a look to system console or dmesg (/var/log/messages) output for changes on usb devices until you get in /dev cuaU0.0 cuaU0.1 ... ttyU0.0 ttyU0.1 ... and supplimental files.

    Then you can perform tests manually directly on port:

    Code:
    cu -s 115200 -l cuaU0.0
    ATZ
    OK
    
    And other GSM/3G commands. Google around for AT command set and try.

    After that you can configure userland PPP /etc/ppp/ppp.conf accordingly to your provider requirements:
    Code:
    default:
     set log Phase Chat LCP IPCP CCP tun command
     disable pred1 deflate deflate24 protocomp acfcomp shortseq vj
     deny pred1 deflate deflate24 protocomp acfcomp shortseq vj
     set speed 115200
    
    gprs_3g_provider:
     set login
     set device /dev/cuaU0.0
     set phone \#777
     set dial "ABORT BUSY ABORT NO\\sCARRIER \
    	   TIMEOUT 5 \
               \"\" ATE1 \
    	   OK-AT-OK ATQ0V1X4 \
    	   OK \\dATDT\\T \
    	   TIMEOUT 40 \
    	   CONNECT"
     set phone \#777
     set authname IF_ANY
     set authkey IF_ANY
     set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
     add default HISADDR
    
    Start specific ppp process:
    Code:
    ppp -ddial gprs_3g_provider
    Watch ppp log. If everything will OK, reduce log level for ppp and restart it.

    It works, tested many times.
     
  8. jb_fvwm2

    jb_fvwm2 Member

    Messages:
    1,570
    Likes Received:
    1
    It is good to have that posted howto... I searched hours and
    hours for something similar. (Using another
    freebsd + wifi solution now...)...

    ...
    Just posting because I can add a bit to it ...
    if you add "local" to the "set log" line, messages are
    easier to watch, onscreen rather than in a file.
    ...
    and I seem to recall once it is working, it more
    immediately notifies one of something amiss as well
    as the (maybe) reason(s).
     
  9. acottag

    acottag New Member

    Messages:
    13
    Likes Received:
    0
    Hello!

    Following the suggested procedure by varda.

    1. Check if module ubsa is loaded.

    Code:
    vega# pwd
    /root
    vega# kldload ubsa
    module_register: module uhub/ubsa already exists!
    Module uhub/ubsa failed to register: 17
    kldload: cant't load ubsa: File exists
    
    This messages agree with the fact that module ubsa is statically linked with the kernel; I believe this is not a problem.

    2. Fetch, extract and make usb_switch.

    Code:
    #vega fetch http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-1.1.1.tar.bz2
    #vega fetch http://www.draisberghof.de/usb_modeswitch/usb_modeswitch.setup
    #vega tar -xvf usb-modeswitch-1.1.1.tar.bz2
    #vega cd usb_modeswitch-1.1.1 && make clean && make
    
    Ok.

    3. Modify usb_modeswitch.setup to AnyData product configuration.
    3.1 Check present directory.

    Code:
    vega# pwd
    /root/usb_modeswitch-1.1.1
    
    3.2 Modify usb_modeswitch.setup.
    Resulting usb_modeswitch.setup:

    Code:
    # Modified: acottag - 2010-04-21: configuration for AnyData modems
    #
    # usb_modeswitch.setup
    #
    #
    #
    # Last modified: 2010-03-16
    #
    # Configuration collection for usb_modeswitch, a mode switching tool for
    # controlling flip flop (multiple mode) USB devices
    #
    # Detailed instructions and a friendly forum on the homepage:
    # http://www.draisberghof.de/usb_modeswitch
    #
    # You may want to check for a newer version of this file at:
    # http://www.draisberghof.de/usb_modeswitch/usb_modeswitch.setup
    
    CheckSuccess=2
    ########################################################
    # AnyDATA ADU-500A, ADU-510A, ADU-510L, ADU-520A
    #
    # This ID gets an "Option" treatment by newer kernels.
    # Use module option "option_zero_cd=2" with usb-storage.
    # A kernel patch to fix the problem is pending
    #
    # Contributor: Vladimir Poluektov, Gabriel Smolar
    
    DefaultVendor=  0x05c6
    DefaultProduct= 0x1000
    
    TargetVendor=   0x16d5
    TargetProduct=  0x6502
    
    # only for reference and 0.x versions
    # MessageEndpoint=0x08
    
    MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
    
    4. copy usb_modeswitch.setup to /etc/usb_modeswitch.setup.

    Code:
    vega# cp usb_modeswitch.conf /etc/usb_modeswitch.setup
    
    5. Run usb_modeswitch.

    Code:
    vega# ./usb_modeswitch
    
    Looking for target devices...
     No devices in target or class found
    Looking for default devices...
     No devices in target or class found. Nothing to do. Bye.
    
    Is it possible that the configuration values need to be changed accordingly to Vendor and Product ID gave by tail /var/log/messages?

    Code:
    vega# tail /var/log/messages
    (...)
    Apr 21 14:35:27 Vega@acottag root: Unknown USB device: vendor 0x16d5 product 0x6501 bus uhub0
    Apr 21 14:35:27 Vega@acottag kernel: ugen0.2: <AnyDATA Corporation> at usbus0
    Apr 21 14:35:27 Vega@acottag kernel: ubsa0: <Data Interface> on usbus0
    
     
  10. varda

    varda New Member

    Messages:
    107
    Likes Received:
    0
    Take a look for the difference between configuration file
    Code:
    TargetVendor=   0x16d5
    TargetProduct=  0x6502
    and your real device detected by OS
    Code:
    Apr 21 14:35:27 Vega@acottag root: Unknown USB device: vendor 0x16d5 product 0x6501 bus uhub0
    That mean it's not exactly one from a list of AnyDATA ADU-500A, ADU-510A, ADU-510L, ADU-520A. 0x6502 != 0x6501. Probably slightly different product. Try to set
    Code:
    TargetProduct=  0x6501
    in usb_modeswitch.setup and make sure that correct path to it compilled in executable binary.
     
  11. varda

    varda New Member

    Messages:
    107
    Likes Received:
    0
    Also I've forget to say that usb_modeswitch required if your modem seen as flash or CD drive with Windows/MacOS drivers at the first time. So this program switch it to modem mode. May be this's not you case. In config file
    Code:
    DefaultVendor=  0x05c6
    DefaultProduct= 0x1000
    
    means that tou device first detected as described above and then switched/redetected to device identified below.
    Code:
    TargetVendor=   0x16d5
    TargetProduct=  0x6502
    
    As I understand you have FreeBSD 7 version and have ttyU0 in /dev after plugging modem. Also there should be cuaU0 device. That mean everything all rigth with your usb stick, OS sees it. Try to connect on it directly and run AT commands:
    Code:
    cu -s 115200 -l cuaU0
    ATZ
    
    Also this device present in:
    Code:
    grep 0x6501 /src/sys/dev/usb/usbdevs
    product ANYDATA ADU_E100X       0x6501  CDMA 2000 1xRTT/EV-DO USB Modem
    
     
  12. acottag

    acottag New Member

    Messages:
    13
    Likes Received:
    0
    Good day.

    Just to keep ideas organized.

    1.
    I am running FreeBSD RELEASE 8.0. Is it possible that this may constitutes a problem?

    2.
    Running usb_modeswitch with TargetProduct changed to 0x6501 in /etc/usb_modeswitch.setup now does return a message informing that target product is found.

    The output
    Code:
    vega# pwd
    vega# /root/usb-modeswitch-1.1.1
    vega# ./usb_modeswitch
    Looking for target devices ...
     Found devices in terget mode or class(1)
    Looking for default devices...
     No devices in default mode or class found. Nothing to do. Bye.
    
    is shown with with the following /etc/usb_modeswitch.setup:

    Code:
    # Modified: acottag - 2010-04-28: configuration for AnyData modems
    #
    # usb_modeswitch.setup
    #
    #
    #
    # Last modified: 2010-03-16
    #
    # Configuration collection for usb_modeswitch, a mode switching tool for
    # controlling flip flop (multiple mode) USB devices
    #
    # Detailed instructions and a friendly forum on the homepage:
    # http://www.draisberghof.de/usb_modeswitch
    #
    # You may want to check for a newer version of this file at:
    # http://www.draisberghof.de/usb_modeswitch/usb_modeswitch.setup
    
    ;CheckSuccess=2
    ########################################################
    # AnyDATA ADU-500A, ADU-510A, ADU-510L, ADU-520A
    #
    # This ID gets an "Option" treatment by newer kernels.
    # Use module option "option_zero_cd=2" with usb-storage.
    # A kernel patch to fix the problem is pending
    #
    # Contributor: Vladimir Poluektov, Gabriel Smolar
    
    DefaultVendor=  0x05c6
    DefaultProduct= 0x1000
    
    TargetVendor=   0x16d5
    TargetProduct=  0x6501
    
    # only for reference and 0.x versions
    # MessageEndpoint=0x08
    
    MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
    
    The modem being used is the AnyData ADU-BAT-100, which is probably similar to
    Code:
    product ANYDATA ADU_E100X       0x6501  CDMA 2000 1xRTT/EV-DO USB Modem
    
    mentioned in /usr/src/sys/dev/usb/usbdevs; note, though, that usbdevs is used no more, starting from FreeBSD version 8.0.


    3.
    Yes, device cuaU0 is shown:

    Code:
    vega# ls /dev/cuaU0*
    /dev/cuaU0 /dev/cuaU0.init /dev/cuaU0.lock
    4.
    I am inclined to believe that usb_modeswitch is not needed, as well, since devices appear as mentioned in 3. above, and when the modem is plugged the system reports VendorID and ProductID as 0x16d5 and 0x6502, directly, without any reference to values like 0x05c6 and 0x1000 being made, as shown by

    Code:
    vega# tail /var/log/messages
    Apr 28 14:35:27 Vega@acottag root: Unknown USB device: vendor 0x16d5 product 0x6501 bus uhub0
    Apr 28 14:35:27 Vega@acottag kernel: ugen0.2: <AnyDATA Corporation> at usbus0
    Apr 28 14:35:27 Vega@acottag kernel: ubsa0: <Data Interface> on usbus0
    
    4. Finnaly, when I type
    Code:
    root# cu -s 115200 -l cuaU0
    , I get the following error message filling the rest of the screen:

    Code:
    ubsa_cfg_request:369: device request failed, err=USB_ERR_STALLED (ignored)
    ubsa_cfg_request:369: device request failed, err=USB_ERR_STALLED (ignored)
    ubsa_cfg_request:369: device request failed, err=USB_ERR_STALLED (ignored)
    
    (...)
    Code:
    ubsa_cfg_request:369: device request failed, err=USB_ERR_STALLED (ignored)
    
    and the system hangs.

    Should I try FreeBSD version 7.3 to check if the same error occurs?

    Please help.
    Thanks in advance.
     
  13. varda

    varda New Member

    Messages:
    107
    Likes Received:
    0
    It seems that you don't need usb_modeswitch since you stick not appeared as flash or CD drive after inserting. Please try with loaded ubsa only. Try with u3g only. Try on fresh installed OS. Try on another machine. Try with another modem...