Project

General

Profile

Feature #6226

Add usb_modeswitch to the pfSense package repo

Added by Steve Wheeler over 3 years ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
04/21/2016
Due date:
% Done:

100%

Estimated time:

Description

Having usb_modeswitch and it's dependencies available in the pfSense default package repo will allow people to use 3g/4g modems that are not yet supported by u3g.
This worked well in <2.3. But since we now use a different pkg repo it's not available.

Associated revisions

Revision 1b988ed0 (diff)
Added by Renato Botelho 9 months ago

Fix #6226: Add sysutils/usb_modeswitch to the list of packages

Revision de4e0a79 (diff)
Added by Renato Botelho 9 months ago

Fix #6226: Add sysutils/usb_modeswitch to the list of packages

History

#1 Updated by Chris Buechler over 3 years ago

  • Target version deleted (2.3.1)

#2 Updated by Dan Lundqvist almost 3 years ago

Has this feature request stalled ?

There is a package that that could handle this, it is only a matter of the correct config file to use with the package.

http://pkg.freebsd.org/freebsd:10:x86:64/release_3/All/usb_modeswitch-2.2.5.txz

I have used it with a Huawei E8372 using the following lazy working on 2.3.2 and 2.3.2_1

----------------------------------------------------------------------------------------------
pfSense 2.3 and Huawei E8372 - Making it Work
For my home network I like using a small nano PC by Foxconn as my router. The down side is that the nano only has a single Ethernet port.
My internet is an LTE connection and the carrier provides one of the new “smart” modems in my case the Huawei E8372. Because of the lack
of a second Ethernet port and the risk of double NAT I want the LTE modem to be directly connected to the pfSense PC.
As the modem defaults to storage mode it was an interesting journey to get pfSense to make use of it. I am no expert in pfSense or FreeBSD
and have trawled the forums and some websites for various bits I cobbled together into something that works for me. It may not be the best
way so your mileage may vary. I just wanted my LTE modem to work with pfSense.

Some notes on the setup
pfSense does not like it when there are not two network adapters. You will be constantly stuck and the interfaces configuration prompt.
I resolved this by using a USB Ethernet adapter for the curious Trendnet TU3-ETG.
I enable the Secure Shell and use Bitvise to SSH to the pfSense PC so I can easily copy and paste the contents of the configuration files.

What is needed:
- usb_modeswitch (This needs to be installed from the FreeBSD repositories as it's not included in pfSense.)
- Shellcmd (Available via the pfSense package manager)
- Text editor (Nano is a nice editor you can install it from the shell with pkg install nano)

You will install two packages (Three if you want nano)
You will create two files; lte.cfg for the modem configuration & lte.sh which will be used by Shellcmd

Install usb_modechange

Beware this is not a supported configuration and this may break with updates but it is the only way I found to install usb_modeswitch

From the shell run the command below and install the package:
pkg add http://pkg.freebsd.org/freebsd:10:x86:64/release_3/All/usb_modeswitch-2.2.5.txz

Install Shellcmd
From the web GUI go to System / Package Manager then select Available Packages find Shellcmd and install it.

Create lte.cfg file for usb_modeswitch configuration for E8372

Use your prefered text editor to create the modem configuration file in cd /usr/local/sbin I named the file lte.cfg

Modem configuration for the E8372 was found here http://www.draisberghof.de/usb_modeswitch

Modem Configuration copy the text below and paste it in the lte.cfg file. ###################################################
#Huawei E8372
#Contributed by: ozonejunkie

DefaultVendor= 0x12d1
DefaultProduct=0x1f01

TargetVendor= 0x12d1
TargetProduct= 0x14db

MessageContent="55534243123456780000000000000a11062000000000000100000000000000"
NoDriverLoading=1 # ###################################################

Create lte.sh file for Script to modeswitch modem

The code to correctly switch your modem you can put a script file in /etc/rc.d.
I named mine lte.sh remember to chmod +x the lte.sh file
#!/bin/sh
/usr/local/sbin/usb_modeswitch -c /usr/local/sbin/lte.cfg
sleep 5

Any shell script can be placed in the /usr/local/etc/rc.d/ directory. The filename must end in .sh and it must be marked as executable (chmod +x lte.sh).

Configure Shellcmd

Via the web GUI go to the Services menu and select Shellcmd & click Add

Shellcmd Configuration

Command: /etc/rc.d/lte.sh
Shellcmd Type: earlyshellcmd
Description: LTE Start
Click Save

You should now be able to configure the interface via the interfaces menu.

#3 Updated by khaled osama 9 months ago

update for pfsense 2.4.4

run the following command to support pfsense 2.4.4

pkg add http://pkg.freebsd.org/freebsd:11:x86:64/release_2/All/usb_modeswitch-2.5.2.txz

#4 Updated by Renato Botelho 9 months ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

#5 Updated by khaled osama 9 months ago

i tried on pfsense 2.4.4 with same huawei model
and it worked fine

#6 Updated by Savas Yucedag 4 months ago

khaled osama wrote:

update for pfsense 2.4.4

run the following command to support pfsense 2.4.4

pkg add http://pkg.freebsd.org/freebsd:11:x86:64/release_2/All/usb_modeswitch-2.5.2.txz

I followed the above mentioned step, however usb_modeswitch doesn't work on my 2.4.4 system.

usb_modeswitch-2.5.2
Name : usb_modeswitch
Version : 2.5.2
Installed on : Sun Apr 14 13:28:28 2019 +04
Origin : sysutils/usb_modeswitch
Architecture : FreeBSD:11:amd64
Prefix : /usr/local
Categories : sysutils
Licenses : GPLv2
Maintainer :
WWW : http://www.draisberghof.de/usb_modeswitch/
Comment : Handling Mode-Switching USB Devices
Annotations :
FreeBSD_version: 1101001
Flat size : 119KiB
Description :
USB_ModeSwitch is (surprise!) a mode switching tool for controlling
"flip flop" (multiple device) USB gear.

USB_ModeSwitch makes this process easy to handle by taking the important
parameters from a configuration file and doing all the initialization
and communication stuff, with heavy help from "libusb". It is mainly
used automatically - via udev events and rules - to do the switch
without any user interaction. But it can also be run as a command line
tool, usually when trying to make unknown devices work with it.

WWW: http://www.draisberghof.de/usb_modeswitch/

#7 Updated by Jim Pingle 4 months ago

  • Status changed from Feedback to Closed

usb_modeswitch has been available from the pfSense (not FreeBSD) repo for months now, including in the latest release. You do not need to install it from the FreeBSD repo. If you are having a problem with using it, please post on the forum or pfSense subreddit.

#8 Updated by Savas Yucedag 4 months ago

Jim Pingle wrote:

usb_modeswitch has been available from the pfSense (not FreeBSD) repo for months now, including in the latest release. You do not need to install it from the FreeBSD repo. If you are having a problem with using it, please post on the forum or pfSense subreddit.

Thanks Jim,

I used FreeBSD repo as https://docs.netgate.com/pfsense/en/latest/cellular/known-working-3g-4g-modems.html says
"It’s not available in the pfSense repository, but there’s an open issue which requests to add it and explains how to install the package from the FreeBSD repository." I believe this needs to be updated.

Best,

Savas

#9 Updated by Jim Pingle 4 months ago

Docs have been updated.

Also available in: Atom PDF