UsbConstants.java revision c4308f01c965571dc2354107c3574df113e397ee
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.usb;
18
19/**
20 * Contains constants for the USB protocol.
21 * These constants correspond to definitions in linux/usb/ch9.h in the linux kernel.
22 */
23public final class UsbConstants {
24
25    public static final int USB_ENDPOINT_DIR_MASK = 0x80;
26    public static final int USB_DIR_OUT = 0;
27    public static final int USB_DIR_IN = 0x80;
28
29    public static final int USB_TYPE_MASK = (0x03 << 5);
30    public static final int USB_TYPE_STANDARD = (0x00 << 5);
31    public static final int USB_TYPE_CLASS = (0x01 << 5);
32    public static final int USB_TYPE_VENDOR = (0x02 << 5);
33    public static final int USB_TYPE_RESERVED = (0x03 << 5);
34
35    public static final int USB_ENDPOINT_NUMBER_MASK = 0x0f;
36
37    // flags for endpoint attributes
38    public static final int USB_ENDPOINT_XFERTYPE_MASK = 0x03;
39    public static final int USB_ENDPOINT_XFER_CONTROL = 0;
40    public static final int USB_ENDPOINT_XFER_ISOC = 1;
41    public static final int USB_ENDPOINT_XFER_BULK = 2;
42    public static final int USB_ENDPOINT_XFER_INT = 3;
43
44    // USB classes
45    public static final int USB_CLASS_PER_INTERFACE = 0;
46    public static final int USB_CLASS_AUDIO = 1;
47    public static final int USB_CLASS_COMM = 2;
48    public static final int USB_CLASS_HID = 3;
49    public static final int USB_CLASS_PHYSICA = 5;
50    public static final int USB_CLASS_STILL_IMAGE = 6;
51    public static final int USB_CLASS_PRINTER = 7;
52    public static final int USB_CLASS_MASS_STORAGE = 8;
53    public static final int USB_CLASS_HUB = 9;
54    public static final int USB_CLASS_CDC_DATA = 0x0a;
55    public static final int USB_CLASS_CSCID = 0x0b;
56    public static final int USB_CLASS_CONTENT_SEC = 0x0d;
57    public static final int USB_CLASS_VIDEO = 0x0e;
58    public static final int USB_CLASS_WIRELESS_CONTROLLER = 0xe0;
59    public static final int USB_CLASS_MISC = 0xef;
60    public static final int USB_CLASS_APP_SPEC = 0xfe;
61    public static final int USB_CLASS_VENDOR_SPEC = 0xff;
62
63    // USB subclasses
64    public static final int USB_INTERFACE_SUBCLASS_BOOT = 1;    // for HID class
65    public static final int USB_SUBCLASS_VENDOR_SPEC = 0xff;
66}