mist is a Chromium OS utility for switching USB cellular dongles into the modem mode. A cellular dongle may implement multiple functions and the function exposed by its initial USB configuration may not be a modem. We need to switch the device into a modem before it can be detected and managed by ModemManager to provide cellular connectivity.
mist is activated by udev events. When udev detects a supported dongle, it invokes
mist to switch the dongle into the modem mode. The mode switching operation invokes the following:
mist relies on udev to detect when a dongle is plugged into the system. A udev rules file,
/lib/udev/rules.d/51-mist.rules, is used to identify a supported dongle based on its USB vendor ID and product ID before and after mode switching. Upon detecting a supported dongle in the non-modem mode, udev launches a mist process to switch the dongle into modem, and also tags the dongle as
MIST_SUPPORTED_DEVICE=1, which allows cros-disks to filter out the mass storage exposed by the dongle.
After udev launches the
mist daemonizes itself so that it can use libudev to monitor the status of the mode switching via udev events. After the special USB messages are sent to the mass storage interface of the dongle, the dongle detaches itself from USB, which results in a udev remove event. After the dongle switches into the modem mode, it reattaches to USB, which results in a udev add event.
mist uses a protobuf-based configuration file,
/usr/share/mist/default.conf, to specify information about the supported dongles. The configuration file specifies a list of supported dongles and the following information associated with each dongle:
mist uses libusb 1.x API to retrieve the USB descriptors of the dongle and initiate bulk transfers to the mass storage interface of the dongle. It thus needs to have read and write access to the USB device associated with the dongle.