1 /* 2 * Copyright (C) 2017 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 package com.android.server.usb.descriptors; 17 18 // import com.android.server.usb.descriptors.report.ReportCanvas; 19 20 /** 21 * @hide 22 * A USB Interface Association Descriptor. 23 * found this one here: http://www.usb.org/developers/docs/whitepapers/iadclasscode_r10.pdf 24 * also: https://msdn.microsoft.com/en-us/library/windows/hardware/ff540054(v=vs.85).aspx 25 */ 26 public final class UsbInterfaceAssoc extends UsbDescriptor { 27 private static final String TAG = "UsbInterfaceAssoc"; 28 29 private byte mFirstInterface; 30 private byte mInterfaceCount; 31 private byte mFunctionClass; 32 private byte mFunctionSubClass; 33 private byte mFunctionProtocol; 34 private byte mFunction; 35 UsbInterfaceAssoc(int length, byte type)36 public UsbInterfaceAssoc(int length, byte type) { 37 super(length, type); 38 } 39 getFirstInterface()40 public byte getFirstInterface() { 41 return mFirstInterface; 42 } 43 getInterfaceCount()44 public byte getInterfaceCount() { 45 return mInterfaceCount; 46 } 47 getFunctionClass()48 public byte getFunctionClass() { 49 return mFunctionClass; 50 } 51 getFunctionSubClass()52 public byte getFunctionSubClass() { 53 return mFunctionSubClass; 54 } 55 getFunctionProtocol()56 public byte getFunctionProtocol() { 57 return mFunctionProtocol; 58 } 59 getFunction()60 public byte getFunction() { 61 return mFunction; 62 } 63 64 @Override parseRawDescriptors(ByteStream stream)65 public int parseRawDescriptors(ByteStream stream) { 66 mFirstInterface = stream.getByte(); 67 mInterfaceCount = stream.getByte(); 68 mFunctionClass = stream.getByte(); 69 mFunctionSubClass = stream.getByte(); 70 mFunctionProtocol = stream.getByte(); 71 mFunction = stream.getByte(); 72 73 return mLength; 74 } 75 76 // TODO - Report fields 77 // @Override 78 // public void report(ReportCanvas canvas) { 79 // super.report(canvas); 80 // 81 // } 82 } 83