Created
July 1, 2019 05:07
-
-
Save yankee14/f361f8b7dee211faaed0e8ea69620ac9 to your computer and use it in GitHub Desktop.
udev rules to create better symlinks for Sierra Wireless HL7618 modems in ACM/NCM (+KUSBCOMP: 0) mode, or MBIM (+KUSBCOMP: 2) mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sierra Wireless HL7618 modems come from the factory configured for | |
# CDC-ACM/NCM mode. This mode can be used to establish an internet | |
# connection using PPP for CDC-ACM, or NCM. It can also be used | |
# in MBIM mode. The modes can be changed by issuing 'AT+KUSBCOMP=<MODE>', | |
# where <MODE> is 0 for ACM/NCM, or 2 for MBIM. | |
# | |
# When in NCM mode (+KSUBCOMP: 0), the modem appears to Linux as having 7 | |
# distinct interfaces: | |
# 1. tty 0 - AT command interface/ACM interface | |
# 2. tty 1 - Proprietary debug interface | |
# 3. tty 2 - AT command interface/ACM interface | |
# 4. wwan 0 - NCM interface | |
# 5. wwan 1 - NCM interface | |
# 6. wwan 2 - NCM interface | |
# 7. wwan 3 - NCM interface | |
# | |
# When in MBIM mode (+KUSBCOMP: 2), the modem appears to Linux as having 2 | |
# distinct interfaces | |
# 1. tty 0 - AT command interface | |
# 2. cdc wdm 0 - MBIM interface | |
# ----------------------------------------------------------------------------- | |
# Guard cases to filter out the singular tty's in which we are interested. | |
# Also filter out the MBIM interface if present | |
# | |
# do nothing if we aren't adding a new device | |
ACTION!="add", GOTO="end" | |
# catch all 3 modem tty's when in NCM mode | |
SUBSYSTEM=="tty", ATTRS{idVendor}=="1519", ATTRS{idProduct}=="0443", GOTO="tty-hl7618-ncm" | |
# catch single modem tty when in MBIM mode | |
SUBSYSTEM=="tty", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0911", GOTO="tty-hl7618-mbim" | |
# catch cdc-wdm interface when in MBIM mode | |
SUBSYSTEM=="usbmisc", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0911", GOTO="mbim-hl7618" | |
# ignore everything else that slips through the cracks | |
GOTO="end" | |
# | |
# | |
# | |
#### | |
# BEGIN SECTION TTY NCM | |
#### | |
LABEL="tty-hl7618-ncm" | |
# if we got here, we are one of the 3 tty's that appear in NCM mode. | |
# we need to set symlinks for the 1st and 3rd tty, since those are AT command | |
# interfaces. | |
ATTRS{iad_bFirstInterface}=="00", SYMLINK+="tty-HL7618-NCM0", RUN+="/usr/bin/logger 'udev: found a tty for a Sierra Wireless HL7618 LTE modem in CDC-ACM/NCM mode at $devnode. Creating symlink to $devnode at /dev/tty-HL7618-NCM0'" | |
ATTRS{iad_bFirstInterface}=="04", SYMLINK+="tty-HL7618-NCM2", RUN+="/usr/bin/logger 'udev: found a tty for a Sierra Wireless HL7618 LTE modem in CDC-ACM/NCM mode at $devnode. Creating symlink to $devnode at /dev/tty-HL7618-NCM2'" | |
GOTO="end" | |
# Sierra Wireless HL7618 modems come from the factory configured for | |
# CDC-ACM/NCM mode. This mode can be used to establish an internet | |
# connection using PPP for CDC-ACM, or NCM. It can also be used | |
# in MBIM mode. The modes can be changed by issuing 'AT+KUSBCOMP=<MODE>', | |
# where <MODE> is 0 for ACM/NCM, or 2 for MBIM. | |
# | |
# When in NCM mode (+KSUBCOMP: 0), the modem appears to Linux as having 7 | |
# distinct interfaces: | |
# 1. tty 0 - AT command interface/ACM interface | |
# 2. tty 1 - Proprietary debug interface | |
# 3. tty 2 - AT command interface/ACM interface | |
# 4. wwan 0 - NCM interface | |
# 5. wwan 1 - NCM interface | |
# 6. wwan 2 - NCM interface | |
# 7. wwan 3 - NCM interface | |
# | |
# When in MBIM mode (+KUSBCOMP: 2), the modem appears to Linux as having 2 | |
# distinct interfaces | |
# 1. tty 0 - AT command interface | |
# 2. cdc wdm 0 - MBIM interface | |
# ----------------------------------------------------------------------------- | |
# Guard cases to filter out the singular tty's in which we are interested. | |
# Also filter out the MBIM interface if present | |
# | |
# do nothing if we aren't adding a new device | |
ACTION!="add", GOTO="end" | |
# catch all 3 modem tty's when in NCM mode | |
SUBSYSTEM=="tty", ATTRS{idVendor}=="1519", ATTRS{idProduct}=="0443", GOTO="tty-hl7618-ncm" | |
# catch single modem tty when in MBIM mode | |
SUBSYSTEM=="tty", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0911", GOTO="tty-hl7618-mbim" | |
# catch cdc-wdm interface when in MBIM mode | |
SUBSYSTEM=="usbmisc", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0911", GOTO="mbim-hl7618" | |
# ignore everything else that slips through the cracks | |
GOTO="end" | |
# | |
# | |
# | |
#### | |
# BEGIN SECTION TTY NCM | |
#### | |
LABEL="tty-hl7618-ncm" | |
# if we got here, we are one of the 3 tty's that appear in NCM mode. | |
# we need to set symlinks for the 1st and 3rd tty, since those are AT command | |
# interfaces. | |
ATTRS{iad_bFirstInterface}=="00", SYMLINK+="tty-HL7618-NCM0", RUN+="/usr/bin/logger 'udev: found a tty for a Sierra Wireless HL7618 LTE modem in CDC-ACM/NCM mode at $devnode. Creating symlink to $devnode at /dev/tty-HL7618-NCM0'" | |
ATTRS{iad_bFirstInterface}=="04", SYMLINK+="tty-HL7618-NCM2", RUN+="/usr/bin/logger 'udev: found a tty for a Sierra Wireless HL7618 LTE modem in CDC-ACM/NCM mode at $devnode. Creating symlink to $devnode at /dev/tty-HL7618-NCM2'" | |
GOTO="end" | |
#### | |
# END SECTION TTY NCM | |
#### | |
#### | |
# BEGIN SECTION TTY MBIM | |
#### | |
LABEL="tty-hl7618-mbim" | |
# if we got here, we are the singular tty that appears in MBIM mode. | |
# create a permanent symlink | |
RUN+="/usr/bin/logger 'udev: found a tty for Sierra Wireless HL7618 LTE modem in MBIM mode at $devnode. Creating symlink to $devnode at /dev/tty-HL7618-MBIM0'" | |
SYMLINK+="tty-HL7618-MBIM0" | |
GOTO="end" | |
#### | |
# END SECTION TTY MBIM | |
#### | |
#### | |
# BEGIN SECTION MBIM | |
#### | |
LABEL="mbim-hl7618" | |
# if we got here, we are the singular cdc-wdm that appears in MBIM mode. | |
# create a permanent symlink | |
RUN+="/usr/bin/logger 'udev: found an MBIM interface for Sierra Wireless HL7618 LTE modem $devnode. Creating symlink to $devnode at /dev/cdc-wdm-HL7618-MBIM0'" | |
SYMLINK+="cdc-wdm-HL7618-MBIM0" | |
GOTO="end" | |
#### | |
# END SECTION MBIM | |
#### | |
LABEL="end" | |
#### | |
# END SECTION TTY NCM | |
#### | |
#### | |
# BEGIN SECTION TTY MBIM | |
#### | |
LABEL="tty-hl7618-mbim" | |
# if we got here, we are the singular tty that appears in MBIM mode. | |
# create a permanent symlink | |
RUN+="/usr/bin/logger 'udev: found a tty for Sierra Wireless HL7618 LTE modem in MBIM mode at $devnode. Creating symlink to $devnode at /dev/tty-HL7618-MBIM0'" | |
SYMLINK+="tty-HL7618-MBIM0" | |
GOTO="end" | |
#### | |
# END SECTION TTY MBIM | |
#### | |
#### | |
# BEGIN SECTION MBIM | |
#### | |
LABEL="mbim-hl7618" | |
# if we got here, we are the singular cdc-wdm that appears in MBIM mode. | |
# create a permanent symlink | |
RUN+="/usr/bin/logger 'udev: found an MBIM interface for Sierra Wireless HL7618 LTE modem $devnode. Creating symlink to $devnode at /dev/cdc-wdm-HL7618-MBIM0'" | |
SYMLINK+="cdc-wdm-HL7618-MBIM0" | |
GOTO="end" | |
#### | |
# END SECTION MBIM | |
#### | |
LABEL="end" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment