plugin_huawei

HUAWEI Plugin

This plugin returns information about your Huawei E220 3G USB modem via it's /dev/ttyUSB* user interface.

It may (or may not) work well with other Huawei 3G USB modems too (which uses PPP interface between modem and computer), like E160, E169, E226, E272, E230 etc. Since they all seem to use same kind of set of AT commands and responses. Tested with Huawei E220, E160E and Vodafone Huawei K3565.

When the Huawei 3G USB modem is plugged in, it creates several ttyUSB devices under the dev directory:

/dev/ttyUSB0    (this is the modem interface used for networking)
/dev/ttyUSB1    (this is the user interface (UI) device)
/dev/ttyUSB2

This plugin tries to connect per default to the Huawei user interface (UI) device at /dev/ttyUSB1. If your UI interface is connected to another port you can use the environment variable HUAWEI_PORT. For example:

export HUAWEI_PORT=/dev/ttyUSB2

Some of the functions requires that the PIN is entered to the modem. This plugin doesn't try to enter the PIN code, this task belongs to the dialer (e.g. wvdial, etc) which opens the actual network connection via /dev/ttyUSB0 modem interface.


huawei::quality(arg1)returns received signal strength
huawei::mode(arg2)returns system mode
huawei::manuf()returns manufacturer
huawei::model()returns model
huawei::fwver()returns firmware version
huawei::operator()returns gsm/umts operator
huawei::flowreport(arg3)returns uptime (last connection time), tx/rx rates s, and tx:rx totals bytes

Where the args are:

arg1%=percentage (0…100), dbm=decibel watt (-113…-51), rssi=relative (0…31)
arg2text=as text (NO CONN,GSM,GPRS,EDGE,WCDMA,HSDPA,HSUPA,HSPA), number=as numeric (0…7)
arg3uptime=in 1 days 10:11:12 format, uptime_seconds=in seconds s, tx_rate=tx rate s, rx_rate=rx rate s, total_tx=total tx bytes, total_rx=total rx bytes

Flowreport values start to updating only when the data start to flow through the modem. The modem is updating it's uptime value at 2 seconds interval. For tx/rx rate values you may want to use netdev-plugin, which can update it's values more frequently than every two seconds.

The update interval is limited to 100 ms, so asking more frequent updating via Widget update parameter is not possible.


Variables {
   tick 500
   tack 100
   minute 60000
   huaweiT 500
}

Display XWindow {
    Driver     'X11'
    Size       '120x32'
    Font       '6x8'
    Pixel      '4+1'
    Gap        '-1x-1'
    Border      20
    Foreground '000000ff'
    Background '00000013'
    Basecolor  '70c000'
    Buttons    0
    Brightness 200
}

Widget HuaweiQuality {
    class 'Text'
    expression huawei::quality('%')
    prefix 'QLT  '
    postfix '% '
    width 10
    precision 0
    align 'L'
    update huaweiT
}

Widget HuaweiQualityBar {
    class 'Bar'
    expression huawei::quality('%')
    length 10
    direction 'E'
    style 'H'
    max 100.0
    update huaweiT
}

Widget HuaweiMode {
    class 'Text'
    expression huawei::mode('text')
    prefix ''
    postfix ''
    width 8
    align 'C'
    update huaweiT
}

Widget HuaweiManuf {
    class 'Text'
    expression huawei::manuf()
    prefix 'MANUF: '
    postfix ' '
    width 10
    align 'L'
    update huaweiT
}

Widget HuaweiModel {
    class 'Text'
    expression huawei::model()
    prefix 'MOD:'
    postfix ''
    width 10
    align 'L'
    update huaweiT
}

Widget HuaweiFirmware {
    class 'Text'
    expression huawei::fwver()
    prefix 'FW:'
    postfix ''
    width 20
    align 'L'
    update huaweiT
}

Widget HuaweiUptime {
    class 'Text'
    expression huawei::flowreport('uptime')
    prefix 'UP '
    postfix ''
    width 12
    align 'L'
    update huaweiT
}

Widget HuaweiOperator {
    class 'Text'
    expression huawei::operator()
    prefix ''
    postfix ''
    width 10
    align 'L'
    update huaweiT
}

#kbits/s
Widget HuaweiRx {
    class 'Text'
    expression huawei::flowreport('rx_rate')/1024*8
    prefix 'DL'
    postfix 'k/s '
    width 10
    align 'R'
    precision 1
    update huaweiT
}

#kbit/s
Widget HuaweiBarRx {
    class 'Bar'
    expression huawei::flowreport('rx_rate')/1024*8
    length 10   
    direction 'E'
    style 'H'
    max 1000.0
    update huaweiT
}

#kbits/s
Widget HuaweiTx {
    class 'Text'
    expression huawei::flowreport('tx_rate')/1024*8
    prefix 'UL'
    postfix 'k/s '
    width 10
    align 'R'
    precision 1
    update huaweiT
}

#kbit/s
Widget HuaweiBarTx {
    class 'Bar'
    expression huawei::flowreport('tx_rate')/1024*8
    length 10   
    direction 'E'
    style 'H'
    max 1000.0
    update huaweiT
}

#Mbytes
Widget HuaweiTotalRx {
    class 'Text'
    expression huawei::flowreport('total_rx')/(1024*1024)
    precision 1
    prefix 'DL '
    postfix 'MB '
    width 10
    align 'L'
    update huaweiT
}

#Mbytes
Widget HuaweiTotalTx {
    class 'Text'
    expression huawei::flowreport('total_tx')/(1024*1024)
    precision 1
    prefix 'UL '
    postfix 'MB '
    width 10
    align 'L'
    update huaweiT
}


Layout Screen1 {
    Row1 {
        Col1  'HuaweiUptime'    
        Col13 'HuaweiMode'
    }
    Row2 {
        Col1  'HuaweiQuality'   
        Col11 'HuaweiOperator'
    }
    Row3 {
        Col1  'HuaweiRx'
        Col11 'HuaweiBarRx'
    }
    Row4 {
        Col1  'HuaweiTx'
        Col11 'HuaweiBarTx'
    }  
}

Display 'XWindow'
Layout 'Screen1'

  • plugin_huawei.txt
  • Last modified: 2020/07/17 18:33
  • (external edit)