1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.usb;
import android.service.ServiceProtoEnums;
/**
* Contains constants for the USB protocol.
* These constants correspond to definitions in linux/usb/ch9.h in the linux kernel.
*/
public final class UsbConstants {
/**
* Bitmask used for extracting the {@link UsbEndpoint} direction from its address field.
* @see UsbEndpoint#getAddress
* @see UsbEndpoint#getDirection
* @see #USB_DIR_OUT
* @see #USB_DIR_IN
*
*/
public static final int USB_ENDPOINT_DIR_MASK = 0x80;
/**
* Used to signify direction of data for a {@link UsbEndpoint} is OUT (host to device)
* @see UsbEndpoint#getDirection
*/
public static final int USB_DIR_OUT = ServiceProtoEnums.USB_ENDPOINT_DIR_OUT; // 0
/**
* Used to signify direction of data for a {@link UsbEndpoint} is IN (device to host)
* @see UsbEndpoint#getDirection
*/
public static final int USB_DIR_IN = ServiceProtoEnums.USB_ENDPOINT_DIR_IN; // 0x80
/**
* Bitmask used for extracting the {@link UsbEndpoint} number its address field.
* @see UsbEndpoint#getAddress
* @see UsbEndpoint#getEndpointNumber
*/
public static final int USB_ENDPOINT_NUMBER_MASK = 0x0f;
/**
* Bitmask used for extracting the {@link UsbEndpoint} type from its address field.
* @see UsbEndpoint#getAddress
* @see UsbEndpoint#getType
* @see #USB_ENDPOINT_XFER_CONTROL
* @see #USB_ENDPOINT_XFER_ISOC
* @see #USB_ENDPOINT_XFER_BULK
* @see #USB_ENDPOINT_XFER_INT
*/
public static final int USB_ENDPOINT_XFERTYPE_MASK = 0x03;
/**
* Control endpoint type (endpoint zero)
* @see UsbEndpoint#getType
*/
public static final int USB_ENDPOINT_XFER_CONTROL =
ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_CONTROL; // 0
/**
* Isochronous endpoint type (currently not supported)
* @see UsbEndpoint#getType
*/
public static final int USB_ENDPOINT_XFER_ISOC =
ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_ISOC; // 1
/**
* Bulk endpoint type
* @see UsbEndpoint#getType
*/
public static final int USB_ENDPOINT_XFER_BULK =
ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_BULK; // 2
/**
* Interrupt endpoint type
* @see UsbEndpoint#getType
*/
public static final int USB_ENDPOINT_XFER_INT =
ServiceProtoEnums.USB_ENDPOINT_TYPE_XFER_INT; // 3
/**
* Bitmask used for encoding the request type for a control request on endpoint zero.
*/
public static final int USB_TYPE_MASK = (0x03 << 5);
/**
* Used to specify that an endpoint zero control request is a standard request.
*/
public static final int USB_TYPE_STANDARD = (0x00 << 5);
/**
* Used to specify that an endpoint zero control request is a class specific request.
*/
public static final int USB_TYPE_CLASS = (0x01 << 5);
/**
* Used to specify that an endpoint zero control request is a vendor specific request.
*/
public static final int USB_TYPE_VENDOR = (0x02 << 5);
/**
* Reserved endpoint zero control request type (currently unused).
*/
public static final int USB_TYPE_RESERVED = (0x03 << 5);
/**
* USB class indicating that the class is determined on a per-interface basis.
*/
public static final int USB_CLASS_PER_INTERFACE = 0;
/**
* USB class for audio devices.
*/
public static final int USB_CLASS_AUDIO = 1;
/**
* USB class for communication devices.
*/
public static final int USB_CLASS_COMM = 2;
/**
* USB class for human interface devices (for example, mice and keyboards).
*/
public static final int USB_CLASS_HID = 3;
/**
* USB class for physical devices.
*/
public static final int USB_CLASS_PHYSICA = 5;
/**
* USB class for still image devices (digital cameras).
*/
public static final int USB_CLASS_STILL_IMAGE = 6;
/**
* USB class for printers.
*/
public static final int USB_CLASS_PRINTER = 7;
/**
* USB class for mass storage devices.
*/
public static final int USB_CLASS_MASS_STORAGE = 8;
/**
* USB class for USB hubs.
*/
public static final int USB_CLASS_HUB = 9;
/**
* USB class for CDC devices (communications device class).
*/
public static final int USB_CLASS_CDC_DATA = 0x0a;
/**
* USB class for content smart card devices.
*/
public static final int USB_CLASS_CSCID = 0x0b;
/**
* USB class for content security devices.
*/
public static final int USB_CLASS_CONTENT_SEC = 0x0d;
/**
* USB class for video devices.
*/
public static final int USB_CLASS_VIDEO = 0x0e;
/**
* USB class for wireless controller devices.
*/
public static final int USB_CLASS_WIRELESS_CONTROLLER = 0xe0;
/**
* USB class for wireless miscellaneous devices.
*/
public static final int USB_CLASS_MISC = 0xef;
/**
* Application specific USB class.
*/
public static final int USB_CLASS_APP_SPEC = 0xfe;
/**
* Vendor specific USB class.
*/
public static final int USB_CLASS_VENDOR_SPEC = 0xff;
/**
* Boot subclass for HID devices.
*/
public static final int USB_INTERFACE_SUBCLASS_BOOT = 1;
/**
* Vendor specific USB subclass.
*/
public static final int USB_SUBCLASS_VENDOR_SPEC = 0xff;
}
|