#Udev rules to run usb_modeswitch for hybrid USB devices - those not provided by the usb_modeswitch developer.
#To refine selection of modems of a group having the same vendore and product IDs, the following attributes are available for addition to rules:
# ATTRS{manufacturer}
# ATTRS{product}
# ATTRS{serial}
# ATTRS{subsystem_vendor}
# ATTRS{subsystem_device}

#Bypass all of these rules if not for "usb" subsystem.
SUBSYSTEM=="usb", ACTION=="add", GOTO="usb_add"
GOTO="modeswitch_rules_end"
LABEL="usb_add"
# only storage class devices are handled
ATTRS{bDeviceClass}=="08", GOTO="modeswitch_rules_begin"
ATTRS{bInterfaceClass}=="08", GOTO="modeswitch_rules_begin"
GOTO="modeswitch_rules_end"
LABEL="modeswitch_rules_begin"

###########
#Huawei modems switched by changing class with the -H argument
ATTRS{bInterfaceClass}=="ff", GOTO="modeswitch_rules_end"

########################################################
# Huawei EC121
# Originated from Vodaphone Mobile Connect rule, not in usb_modeswitch configuration directory - may not be necessary

ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1411", ACTION=="add", RUN+="usb_modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -C 0xff -H 1"

########################################################
# Huawei CDMA Mobile C5320 (C300)
# Added by Puppy Linux -- not in released usb_modeswitch configuration directory.

ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="3197", ACTION=="add", RUN+="usb_modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -H 1"

#########

LABEL="modeswitch_rules_end"
