0

I'm trying to configure the PC to connect to the Internet over Huawei modem when it's started. However, after start, the modem is recognized as Mass storage device. I can switch it to correct mode by running

sudo usb_modeswitch -v 12d1 -p 14fe -J 

I need the modem to work from start, so I figured out that I need to add the following to /etc/usb_modeswitch.conf:

DefaultVendor=0x12d1
DefaultProduct=0x14fe

TargetVendor=0x12d1
TargetProduct=0x1506
HuaweiNewMode=1

This works when I load the configuration file by running sudo usb_modeswitch -c /etc/usb_modeswitch.conf, but not when computer starts. Anybody knows how to apply the configuration on startup?

UPDATE: I tried also adding the following line to /lib/udev/rules.d/40-usb_modeswitch.rules:

ATTR{idVendor}=="12d1", ATTR{idProduct}=="14fe", RUN+="usb_modeswitch '%b/%k'"

or

ATTR{idVendor}=="12d1", ATTR{idProduct}=="14fe", RUN+="usb_modeswitch -v 12d1 -p 14fe -J"

I still can't get it to work.

2 Answers 2

0

I did it by running the usb_modeswitch command from a startup script, as described in How to run a script during boot as root (highest rated answer). One of the commenters states that this won't work on Ubuntu 16.04 or later, but in my case it does.

I know that this solution may seem "dirty" to some, but I already spent too much time trying to do it the "proper" way.

0

I think that after update udev rule You have to update initramfs

sudo update-initramfs -u

my file with udev rule is

cat /etc/udev/rules.d/41-huawei_e3372.rules

# Huawei E3372
ATTR{idVendor}=="12d1", ATTR{idProduct}=="14fe", RUN+="/usr/sbin/usb_modeswitch -v 12d1 -p 14fe -V 12d1 -P 1506 -J"

after that you can verify whether the file has been uploaded to the initramfs image by command

lsinitramfs /boot/initrd.img|grep 41-huawei_e3372.rules
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .