Home | History | Annotate | Download | only in mbim_compliance
      1 # Copyright (c) 2015 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 """
      6 This module defines the constants which are used in different components
      7 within the MBIM compliance suite.
      8 All the constants should match the values and names specified in MBIM
      9 Specification[1].
     10 
     11 Reference:
     12     [1] Universal Serial Bus Communications Class Subclass Specification for
     13         Mobile Broadband Interface Model
     14         http://www.usb.org/developers/docs/devclass_docs/
     15         MBIM10Errata1_073013.zip
     16 """
     17 import uuid
     18 
     19 
     20 # The following type values are defined for the MBIM control messages sent from
     21 # the host to the device.
     22 MBIM_OPEN_MSG = 0x00000001
     23 MBIM_CLOSE_MSG = 0x00000002
     24 MBIM_COMMAND_MSG = 0x00000003
     25 MBIM_HOST_ERROR_MSG = 0x00000004
     26 
     27 # The following type values are defined for the MBIM control messages sent from
     28 # the device to the host.
     29 MBIM_OPEN_DONE = 0x80000001
     30 MBIM_CLOSE_DONE = 0x80000002
     31 MBIM_COMMAND_DONE = 0x80000003
     32 MBIM_FUNCTION_ERROR_MSG = 0x80000004
     33 MBIM_INDICATE_STATUS_MSG = 0x80000007
     34 
     35 # The following type values are defined for the MBIM status codes.
     36 MBIM_STATUS_SUCCESS = 0x00000000
     37 MBIM_STATUS_NO_DEVICE_SUPPORT = 0x00000009
     38 MBIM_STATUS_CONTEXT_NOT_ACTIVATED = 0x00000010
     39 MBIM_STATUS_INVALID_PARAMETERS = 0x00000015
     40 
     41 # The following type values are defined for both MBIM_HOST_ERROR_MSG and
     42 # MBIM_FUNCTION_ERROR_MSG.
     43 MBIM_ERROR_TIMEOUT_FRAGMENT = 0x00000001
     44 MBIM_ERROR_FRAGMENT_OUT_OF_SEQUENCE = 0x00000002
     45 MBIM_ERROR_LENGTH_MISMATCH = 0x00000003
     46 MBIM_ERROR_DUPLICATED_TID = 0x00000004
     47 MBIM_ERROR_NOT_OPENED = 0x00000005
     48 MBIM_ERROR_UNKNOWN = 0x00000006
     49 MBIM_ERROR_CANCEL = 0x00000007
     50 MBIM_ERROR_MAX_TRANSFER = 0x00000008
     51 
     52 # The following command codes are defined for the MBIM command identifiers.
     53 MBIM_CID_DEVICE_CAPS = 0x00000001
     54 MBIM_CID_SUBSCRIBER_READY_STATUS = 0x00000002
     55 MBIM_CID_RADIO_STATE = 0x00000003
     56 MBIM_CID_PIN = 0x00000004
     57 MBIM_CID_HOME_PROVIDER = 0x00000006
     58 MBIM_CID_REGISTER_STATE = 0x00000009
     59 MBIM_CID_PACKET_SERVICE = 0x0000000A
     60 MBIM_CID_SIGNAL_STATE = 0x0000000B
     61 MBIM_CID_CONNECT = 0x0000000C
     62 MBIM_CID_SERVICE_ACTIVATION = 0x0000000E
     63 MBIM_CID_IP_CONFIGURATION = 0x0000000F
     64 MBIM_CID_DEVICE_SERVICES = 0x00000010
     65 
     66 # The following command types are defined for the MBIM command message.
     67 COMMAND_TYPE_QUERY = 0
     68 COMMAND_TYPE_SET = 1
     69 
     70 # The following UUID values are defined for the device service identifiers.
     71 UUID_BASIC_CONNECT = uuid.UUID('A289CC33-BCBB-8B4F-B6B0-133EC2AAE6DF')
     72 
     73 # The following UUID values are defined for the MBIM_CONTEXT_TYPES which are
     74 # used in the |context_type| field of information structures.
     75 MBIM_CONTEXT_TYPE_NONE = uuid.UUID('B43F758C-A560-4B46-B35E-C5869641FB54')
     76 MBIM_CONTEXT_TYPE_INTERNET = uuid.UUID('7E5E2A7E-4E6F-7272-736B-656E7E5E2A7E')
     77 
     78 # NTB formats
     79 NTB_FORMAT_16 = 0
     80 NTB_FORMAT_32 = 1
     81 
     82 # MBIM Device Caps Cellular classes
     83 CELLULAR_CLASS_MASK_GSM = 0x01
     84 CELLULAR_CLASS_MASK_CDMA = 0x02
     85 
     86 # MBIM CTRL Caps
     87 CTRL_CAPS_MASK_NONE = 0x0000
     88 CTRL_CAPS_MASK_REG_MANUAL = 0x0001
     89 CTRL_CAPS_MASK_HW_RADIO_SWITCH = 0x0002
     90 CTRL_CAPS_MASK_CDMA_MOBILE_IP = 0x0004
     91 CTRL_CAPS_MASK_CDMA_SIMPLE_IP = 0x0008
     92 CTRL_CAPS_MASK_MULTI_CARRIER = 0x0010
     93