Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Wireless wan (mobile broadband) configuration, netifrc
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Zarhan
l33t
l33t


Joined: 27 Feb 2004
Posts: 996

PostPosted: Mon Dec 04, 2017 10:48 am    Post subject: Wireless wan (mobile broadband) configuration, netifrc Reply with quote

Hi,

how are you supposed to configure a wireless WAN connection to a laptop (in this case a Thinkpad with Sierra Wireless WAN card)?

I can see that there's a network interface wwan0 with ifconfig. I would guess you can just do the standard ln -s net.lo net.wwan0 under init.d to get the networking script operational.

However, how do you bring that up once I get a SIM card in place? E.g.
- How to unlock the SIM (send PIN)
- How to read SMS

and so on.

I can create and acpid script/action to bind bringing up the interface to an Fn key, so no problem there.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Mon Dec 04, 2017 6:19 pm    Post subject: Reply with quote

You probably need to install and configure net-dialup/ppp. For SMS look at app-mobilephone/smstools.
Back to top
View user's profile Send private message
Zarhan
l33t
l33t


Joined: 27 Feb 2004
Posts: 996

PostPosted: Mon Dec 04, 2017 7:58 pm    Post subject: Reply with quote

Already have those, but it seems that there really is no interface for accessing the AT command interface of the modem. There are no /dev/ttyUSBX devices present.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Tue Dec 05, 2017 4:35 am    Post subject: Re: Wireless wan (mobile broadband) configuration, netifrc Reply with quote

Zarhan wrote:
how are you supposed to configure a wireless WAN connection to a laptop (in this case a Thinkpad with Sierra Wireless WAN card)?

Would you please show us how that card appears in dmesg, lsusb, lspci, ifconfig -a, ...?
Back to top
View user's profile Send private message
Zarhan
l33t
l33t


Joined: 27 Feb 2004
Posts: 996

PostPosted: Tue Dec 05, 2017 6:50 am    Post subject: Reply with quote

This is pretty much it. The options mentioned in the wikilink are installed.

lsusb:
Code:
Bus 001 Device 007: ID 1199:9079 Sierra Wireless, Inc.


dmesg:
Code:
[    1.617693] usbcore: registered new interface driver cdc_ncm
[    1.617700] usbcore: registered new interface driver cdc_mbim
[    1.621754] usbcore: registered new interface driver cdc_acm
[    1.621755] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    1.621761] usbcore: registered new interface driver cdc_wdm
[    5.056619] cdc_mbim 1-6:1.12: cdc-wdm0: USB WDM device
[    5.056720] cdc_mbim 1-6:1.12 wwan0: register 'cdc_mbim' at usb-0000:00:14.0-6, CDC MBIM, 3a:15:28:0b:c5:79
[    5.405493] usbcore: registered new interface driver qcserial
[    5.405499] usbserial: USB Serial support registered for Qualcomm USB modem
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Tue Dec 05, 2017 10:38 am    Post subject: Reply with quote

Zarhan,

You need some of this
/usr/src/linux/drivers/net/usb/Kconfig:
config USB_NET_QMI_WWAN
        tristate "QMI WWAN driver for Qualcomm MSM based 3G and LTE modems"
        depends on USB_USBNET
        select USB_WDM
        help
          Support WWAN LTE/3G devices based on Qualcomm Mobile Data Modem
          (MDM) chipsets.  Examples of such devices are
            * Huawei E392/E398

          This driver will only drive the ethernet part of the chips.
          The devices require additional configuration to be usable.
          Multiple management interfaces with linux drivers are
          available:

            * option: AT commands on /dev/ttyUSBx
            * cdc-wdm: Qualcomm MSM Interface (QMI) protocol on /dev/cdc-wdmx

          A modem manager with support for QMI is recommended.

          To compile this driver as a module, choose M here: the
          module will be called qmi_wwan.


Do you have /dev/ttyUSBx so you can use AT commands to gen the link up or /dev/cdc-wdmx so you can use the proprietary protocol?
The conventional setup is AT commands over the serial link to cover unlocking the SIM, dialling and authenticating , then start PPP to use Ethernet on the link.

-- edit --

Code:
 * option: AT commands on /dev/ttyUSBx
As a wild guess, I think that refers to the kernel module named option.
I need that for my USB 3G dongle to get the serial ports.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Zarhan
l33t
l33t


Joined: 27 Feb 2004
Posts: 996

PostPosted: Tue Dec 05, 2017 11:39 am    Post subject: Reply with quote

I had enabled USB_SIERRA_NET since that's supposed to be the driver. I now added the Qualcomm driver as well. Qcserial is now loaded at boot, and /dev/cdc-wdm0 device does appear. The ttyUSB devices are still missing.

The laptop is actually a Thinkpad T470, forgot to mention that.
Back to top
View user's profile Send private message
Zarhan
l33t
l33t


Joined: 27 Feb 2004
Posts: 996

PostPosted: Tue Dec 05, 2017 11:42 am    Post subject: Reply with quote

Ok, looks like the ttyUSBX interfaces are not necessarily needed.

However, lots of links, eg. http://www.embeddedpi.com/documentation/3g-4g-modems/raspberry-pi-sierra-wireless-mc7304-modem-qmi-interface-setup talk about qmiutils package, and that does not seem to be available for Gentoo. What to do now?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Tue Dec 05, 2017 11:46 am    Post subject: Reply with quote

Zarhan,

If you can find a tool to drive it /dev/cdc-wdm0 cam be used to establish the link. Its a proprietary protocol though.
If not, you need the USB serial devices. That probably needs
Code:
CONFIG_USB_SERIAL_OPTION
in the kernel.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Zarhan
l33t
l33t


Joined: 27 Feb 2004
Posts: 996

PostPosted: Tue Dec 05, 2017 12:46 pm    Post subject: Reply with quote

I have USB_SERIAL enabled (due to the fact that I have a USB to serial converter as well). I now added USB_SERIAL_GENERIC and USB_SERIAL_SIMPLE, as well as USB_SERIAL_QCAUX and USB_SERIAL_QUALCOMM, and also USB_SERIAL_SIERRAWIRELESS.

None of the above helped.
Back to top
View user's profile Send private message
Zarhan
l33t
l33t


Joined: 27 Feb 2004
Posts: 996

PostPosted: Tue Dec 05, 2017 12:54 pm    Post subject: Reply with quote

Oh, turns out libqmi is actually included with Gentoo. I just had to enable use flag mbim.

So, I can control it at least with qmicli -d /dev/cdc-wdm0.

Thanks for all the pointers. Looks like this card does no longer even support the old serial interface.
Back to top
View user's profile Send private message
Zarhan
l33t
l33t


Joined: 27 Feb 2004
Posts: 996

PostPosted: Thu Mar 08, 2018 7:24 pm    Post subject: Reply with quote

Just in case someone else would need it, I got this thing streamlined.

I created a new network init script using standard method, that is ln -s net.lo net.wwan0.

Then, in /etc/conf.d/net, I added the following functions. I used this https://gist.github.com/ploth/556ef1620be411c8f66f96b9fc570bb3 as a starting point. However, I opted to use modemmanager instead of mbim_cli to handle most of the low-level stuff. Only figuring out the IP and DNS parameters are from mbim_cli.

This assumes that modemmanager is running. The modemmanager package doesn't provide init script to start it as service, but one can use this one here:

https://forums.gentoo.org/viewtopic-p-7633094.html#7633094

Why I don't use networkmanager? Well, I want my network to be available before login.

Code:
preup() {
  if [[ ${IFACE} == "wwan0" ]] ; then

    rfkill_device=$(rfkill list | grep tpacpi_wwan_sw | awk 'BEGIN { FS = ":" } ; { print $1 }')
    rfkill unblock ${rfkill_device}

    mmcli -m 0 --simple-connect="apn=internet"

    query=$(mbimcli -d /dev/cdc-wdm0 -p  --query-ip-configuration)
    squery=($query) #split into array elements

    ipv4=$(echo ${squery[10]} | sed s/\'//g)
    gwv4=$(echo ${squery[12]} | sed s/\'//g)
    d1v4=$(echo ${squery[15]} | sed s/\'//g)
    d2v4=$(echo ${squery[18]} | sed s/\'//g)
    ipv6=$(echo ${squery[31]} | sed s/\'//g)
    gwv6=$(echo ${squery[33]} | sed s/\'//g)
    d1v6=$(echo ${squery[36]} | sed s/\'//g)
    d2v6=$(echo ${squery[39]} | sed s/\'//g)

    if [[ $2 == '' || $2 == '4' ]]; then
      # ipv4
      ip addr add $ipv4 dev wwan0
      echo -e "nameserver $d1v4\nnameserver $d2v4" | resolvconf -a wwan0.lte
      # activate device
      ip link set wwan0 up
      ip route add default via $gwv4 metric 50
    elif [[ $2 == '6' ]]; then
      # ipv6
      ip addr add $ipv6 dev wwan0
      echo -e "nameserver $d1v6\nnameserver $d2v6" | resolvconf -a wwan0.lte
      # activate device
      ip link set wwan0 up
      ip route add default via $gwv6 metric 50
    fi 
  fi
}

predown() {
  if [[ ${IFACE} == "wwan0" ]] ; then
    mmcli -m 0 --simple-disconnect

    # deactivate device
    ip link set wwan0 down
    ip add flush dev wwan0
    resolvconf -d wwan0.lte
    mmcli -m 0 -d
    rfkill_device=$(rfkill list | grep tpacpi_wwan_sw | awk 'BEGIN { FS = ":" } ; { print $1 }')
    rfkill block ${rfkill_device}

  fi
}
Back to top
View user's profile Send private message
Maxwell
Tux's lil' helper
Tux's lil' helper


Joined: 10 Dec 2003
Posts: 97

PostPosted: Thu Jun 11, 2020 12:45 pm    Post subject: Reply with quote

Hi Zarhan

The gist provided is no longer available. Could you be so kind and provide your /etc/conf.d/net file?

Trying to use a Vodafone branded huawei e398 usb stick on a raspberry pi/arm sbc
_________________
Freedom works. Use it!
Linux, by Gentoo
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Fri Jun 12, 2020 4:03 am    Post subject: Reply with quote

Nowadays I'd recommend using net-misc/connman[+ofono] instead. It seems to be good at handling exotic dialup setups.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum