Assuming your device's vendor and product IDs are as configured above, ie 03f0
and 581d
respectively, you can create a udev rule that will automatically initialize the device and bind it to libqmi, as shown below:
file /etc/udev/rules.d/98-modem-rules.rules
Create the file using your favorite text editor (and appropriate permissions, sudo
is required) with the content:
ACTION!="add|change", GOTO="mbim_to_qmi_rules_end"
SUBSYSTEM!="usb|drivers", GOTO="mbim_to_qmi_rules_end"
# load qmi_wwan module
SUBSYSTEM=="usb", \
ATTR{idVendor}=="03f0", ATTR{idProduct}=="581d", \
RUN+="/sbin/modprobe -b qmi_wwan"
# Initialize the LTE lt112 module to operational status:
SUBSYSTEM=="usb", \
ATTR{idVendor}=="03f0", ATTR{idProduct}=="581d", \
ATTR{bConfigurationValue}="3"
# add the new id in the qmi_wwan driver
SUBSYSTEM=="drivers", \
ENV{DEVPATH}=="/bus/usb/drivers/qmi_wwan", \
ATTR{new_id}="03f0 581d"
# load qcserial module
SUBSYSTEM=="usb", \
ATTR{idVendor}=="03f0", ATTR{idProduct}=="581d", \
RUN+="/sbin/modprobe -b qcserial"
# add the new id in the qcserial driver
SUBSYSTEM=="drivers", \
ENV{DEVPATH}=="/bus/usb-serial/drivers/qcserial", \
ATTR{new_id}="03f0 581d"
LABEL="mbim_to_qmi_rules_end"
On your machine, you'll also need to install the appropriate packages:
Assuming Ubuntu (as no distribution information was given), run:
sudo apt install libqmi libqmi-utils
When done, activate the new udev rule:
sudo udevadm control --reload-rules
sudo udevadm trigger
You may also find modem-manager, a GUI front-end to see modem stats, such as network signal strength, etc, to be of use.
It can be installed via:
sudo apt install modem-manager-gui
A cold start will be required after inserting a SIM card.
Update:
An alternative to this would be to install the package usb-modeswitch-data
(which will also pull in usb-modeswitch as a dependency).
The package contains udev rules that allow usb-modeswitch to initialize the device correctly, with multiple entries for multiple devices. See the changelog(s) on the same here.
The udev rules in the package are stored in a file called 40-usb_modeswitch.rules
. For your particular hardware, its' on line 32-33:
# HP hs4112
ATTR{idVendor}=="03f0", ATTR{idProduct}=="581d", RUN+="usb_modeswitch '/%k'"
After installing usb-modeswitch
and usb-modeswitch-data
, you'll need to reboot, even after reloading udev rules before the SIM card is recognized.