blob: 0615df687c1ac3a27e457af5eeb8c8fdf0114390 [file] [log] [blame]
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# mist udev rules for switching supported USB devices into a modem.
# Run after 50-udev-default.rules and before 60-persistent-*.rules.
# TODO(benchan): Generate this file as part of the build process.
# Extract the vendor/product IDs of supported devices from default.conf and
# create corresponding udev rules in this file.
# If MIST_SUPPORTED_DEVICE is set to 1, the device has already been handled once
# due to a prior udev add or change event.
ENV{MIST_SUPPORTED_DEVICE}=="1", GOTO="mist_end"
ACTION!="add|change", GOTO="mist_end"
#-------------------------------------------------------------------------------
# Supported USB devices after switching into a modem
SUBSYSTEM!="usb|tty", GOTO="mist_end"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1001", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1400", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1406", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="140b", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="140c", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1412", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="141b", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1432", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1433", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1436", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14ac", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14cf", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14db", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1506", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="150a", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="150f", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1511", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1576", GOTO="mist_mark_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1c1e", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0015", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0017", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0022", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0104", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0117", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1008", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1010", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1173", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1177", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1181", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1203", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1254", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1525", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1589", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2003", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="900b", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="ffe9", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="fff1", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="fffe", GOTO="mist_mark_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="ffff", GOTO="mist_mark_device"
ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9605", GOTO="mist_mark_device"
ATTRS{idVendor}=="2001", ATTRS{idProduct}=="7d01", GOTO="mist_mark_device"
ATTRS{idVendor}=="2001", ATTRS{idProduct}=="7d0c", GOTO="mist_mark_device"
ATTRS{idVendor}=="2020", ATTRS{idProduct}=="4010", GOTO="mist_mark_device"
# The following devices are Ethernet adapters in "Vendor Mode".
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="a101", ATTR{bInterfaceClass}=="ff", GOTO="mist_mark_device"
ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="8152", ATTR{bInterfaceClass}=="ff", GOTO="mist_mark_device"
ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="8153", ATTR{bInterfaceClass}=="ff", GOTO="mist_mark_device"
ATTRS{idVendor}=="13b1", ATTRS{idProduct}=="0041", ATTR{bInterfaceClass}=="ff", GOTO="mist_mark_device"
#-------------------------------------------------------------------------------
# Supported USB devices before switching into a modem
SUBSYSTEM!="usb", GOTO="mist_end"
ENV{DEVTYPE}!="usb_device", GOTO="mist_end"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", GOTO="mist_switch_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14fe", GOTO="mist_switch_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1505", GOTO="mist_switch_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1526", GOTO="mist_switch_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="15ca", GOTO="mist_switch_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1f01", GOTO="mist_switch_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1f15", GOTO="mist_switch_device"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1f17", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0013", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0040", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0101", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0154", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1007", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1009", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1171", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1175", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1179", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1201", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1237", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1523", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1588", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000", GOTO="mist_switch_device"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="fff5", GOTO="mist_switch_device"
ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="f000", GOTO="mist_switch_device"
ATTRS{idVendor}=="2001", ATTRS{idProduct}=="a403", GOTO="mist_switch_device"
ATTRS{idVendor}=="2001", ATTRS{idProduct}=="a706", GOTO="mist_switch_device"
ATTRS{idVendor}=="2020", ATTRS{idProduct}=="0002", GOTO="mist_switch_device"
# The following devices are Ethernet adapters in USB Storage mode.
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="a100", ATTR{bInterfaceClass}=="08", GOTO="mist_switch_device"
ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="8151", ATTR{bInterfaceClass}=="08", GOTO="mist_switch_device"
ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="8152", ATTR{bInterfaceClass}=="08", GOTO="mist_switch_device"
ATTRS{idVendor}=="13b1", ATTRS{idProduct}=="0040", ATTR{bInterfaceClass}=="08", GOTO="mist_switch_device"
GOTO="mist_end"
#-------------------------------------------------------------------------------
# Invoke mist to switch a supported USB device into a modem. mist needs to run
# as a daemon in order to monitor udev events to determine when the device is
# switched into a modem.
LABEL="mist_switch_device"
RUN+="/usr/bin/mist --daemon switch %S%p"
# Fall through to "mist_mark_device"
#-------------------------------------------------------------------------------
# If this device is a 'usb_device' device, set MIST_SUPPORTED_DEVICE to 1 to
# tell cros-disks to hide it from being auto-mounted. If this device is a 'tty'
# device, set MIST_SUPPORTED_DEVICE to 1 to tell 52-mm-modem-permissions.rules
# to set the right permissions on it.
LABEL="mist_mark_device"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{MIST_SUPPORTED_DEVICE}="1"
SUBSYSTEM=="tty", ENV{MIST_SUPPORTED_DEVICE}="1"
LABEL="mist_end"