Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save plieningerweb/6fc9116612dbd72701db to your computer and use it in GitHub Desktop.
Save plieningerweb/6fc9116612dbd72701db to your computer and use it in GitHub Desktop.
Debug USB-Modeswitch (Raspberry with debian jessi lite) and Huawei E303

test if modeswitch works

$ sudo usb_modeswitch -v 0x12d1 -p 0x1f01 -M "55534243123456780000000000000a11062000000000000100000000000000"

if yes than usually you would do this (but for me it did not work)

#edit config file
/etc/usb_modeswitch.conf

#add some stuff
#Huawei E303
DefaultVendor= 0x12d1
DefaultProduct= 0x1f01
TargetVendor= 0x12d1
TargetProduct= 0x14dc
MessageEndPoint = "0x01"
MessageContent="55534243123456780000000000000a11062000000000000100000000000000"
NoDriverLoading=1


#test config file with
sudo usb_modeswitch -c /etc/usb_modeswitch.conf 

instead we try to add a udev rule:

#add udev rule

cat /etc/udev/rules.d/75-usb-modeswitch.rules
#huawei e303
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1f01", RUN+="/usr/sbin/usb_modeswitch -v 0x12d1 -p 0x1f01 -M '55534243123456780000000000000a11062000000000000100000000000000'"

you can test if it is working using

#test udev admin hooks
sudo udevadm trigger --action=add 

then, check output of $ lsusb it it changed.

if it seems working do a reboot $ sudo reboot

log in again and check if it is there with $ lsusb

product id 14dc is there--> looks good!

infos to huawei e303

lsusb modes: source (https://www.raspberrypi.org/forums/viewtopic.php?t=18996) 12d1:14db: network mode 12d1:1f01 - CD Mode 12d1:14db - Web Mode / HiLink 12d1:1442 - Serial Mode

may be check 55534243123456780000000000000011062000000100000000000000000000

@zubairghori
Copy link

Good this works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment