diff options
Diffstat (limited to 'services/usb/java')
11 files changed, 434 insertions, 66 deletions
diff --git a/services/usb/java/com/android/server/usb/descriptors/UsbACEndpoint.java b/services/usb/java/com/android/server/usb/descriptors/UsbACEndpoint.java index 0535d717222e..ff7f3934086c 100644 --- a/services/usb/java/com/android/server/usb/descriptors/UsbACEndpoint.java +++ b/services/usb/java/com/android/server/usb/descriptors/UsbACEndpoint.java @@ -52,6 +52,7 @@ abstract class UsbACEndpoint extends UsbDescriptor { int length, byte type) { UsbInterfaceDescriptor interfaceDesc = parser.getCurInterface(); int subClass = interfaceDesc.getUsbSubclass(); + // TODO shouldn't this switch on subtype? switch (subClass) { case AUDIO_AUDIOCONTROL: if (UsbDescriptorParser.DEBUG) { diff --git a/services/usb/java/com/android/server/usb/descriptors/UsbDescriptorParser.java b/services/usb/java/com/android/server/usb/descriptors/UsbDescriptorParser.java index 8e7babb40fc0..b230e4bbf8a2 100644 --- a/services/usb/java/com/android/server/usb/descriptors/UsbDescriptorParser.java +++ b/services/usb/java/com/android/server/usb/descriptors/UsbDescriptorParser.java @@ -26,7 +26,7 @@ import java.util.ArrayList; */ public final class UsbDescriptorParser { private static final String TAG = "UsbDescriptorParser"; - public static final boolean DEBUG = true; + public static final boolean DEBUG = false; private final String mDeviceAddr; @@ -43,6 +43,11 @@ public final class UsbDescriptorParser { // Obtained from the first AudioClass Header descriptor. private int mACInterfacesSpec = UsbDeviceDescriptor.USBSPEC_1_0; + // The VideoClass spec implemented by the VideoClass Interfaces + // This may well be different than the overall USB Spec. + // Obtained from the first VidieoClass Header descriptor. + private int mVCInterfacesSpec = UsbDeviceDescriptor.USBSPEC_1_0; + /** * Connect this parser to an existing set of already parsed descriptors. * This is useful for reporting. @@ -90,6 +95,14 @@ public final class UsbDescriptorParser { return mACInterfacesSpec; } + public void setVCInterfaceSpec(int spec) { + mVCInterfacesSpec = spec; + } + + public int getVCInterfaceSpec() { + return mVCInterfacesSpec; + } + private class UsbDescriptorsStreamFormatException extends Exception { String mMessage; UsbDescriptorsStreamFormatException(String message) { @@ -186,19 +199,20 @@ public final class UsbDescriptorParser { break; case UsbDescriptor.CLASSID_VIDEO: - Log.d(TAG, " UsbDescriptor.CLASSID_VIDEO subType:0x" - + Integer.toHexString(stream.getByte())); + if (DEBUG) { + Log.d(TAG, " UsbDescriptor.CLASSID_VIDEO"); + } descriptor = UsbVCInterface.allocDescriptor(this, stream, length, type); break; case UsbDescriptor.CLASSID_AUDIOVIDEO: - Log.d(TAG, " UsbDescriptor.CLASSID_AUDIOVIDEO subType:0x" - + Integer.toHexString(stream.getByte())); + if (DEBUG) { + Log.d(TAG, " UsbDescriptor.CLASSID_AUDIOVIDEO"); + } break; default: - Log.d(TAG, " Unparsed Class-specific Interface:0x" - + Integer.toHexString(mCurInterfaceDescriptor.getUsbClass())); + Log.w(TAG, " Unparsed Class-specific"); break; } } @@ -206,23 +220,32 @@ public final class UsbDescriptorParser { case UsbDescriptor.DESCRIPTORTYPE_CLASSSPECIFIC_ENDPOINT: if (mCurInterfaceDescriptor != null) { - switch (mCurInterfaceDescriptor.getUsbClass()) { + int subClass = mCurInterfaceDescriptor.getUsbClass(); + switch (subClass) { case UsbDescriptor.CLASSID_AUDIO: descriptor = UsbACEndpoint.allocDescriptor(this, length, type); break; - case UsbDescriptor.CLASSID_VIDEO: - Log.d(TAG, "UsbDescriptor.CLASSID_VIDEO subType:0x" - + Integer.toHexString(stream.getByte())); - descriptor = UsbVCEndpoint.allocDescriptor(this, length, type); + + case UsbDescriptor.CLASSID_VIDEO: { + Byte subtype = stream.getByte(); + if (DEBUG) { + Log.d(TAG, "UsbDescriptor.CLASSID_VIDEO type:0x" + + Integer.toHexString(type)); + } + descriptor = UsbVCEndpoint.allocDescriptor(this, length, type, subtype); + } break; case UsbDescriptor.CLASSID_AUDIOVIDEO: - Log.d(TAG, "UsbDescriptor.CLASSID_AUDIOVIDEO subType:0x" - + Integer.toHexString(stream.getByte())); + if (DEBUG) { + Log.d(TAG, "UsbDescriptor.CLASSID_AUDIOVIDEO type:0x" + + Integer.toHexString(type)); + } break; + default: - Log.d(TAG, " Unparsed Class-specific Endpoint:0x" - + Integer.toHexString(mCurInterfaceDescriptor.getUsbClass())); + Log.w(TAG, " Unparsed Class-specific Endpoint:0x" + + Integer.toHexString(subClass)); break; } } @@ -555,6 +578,30 @@ public final class UsbDescriptorParser { /** * @hide */ + public boolean hasVideoCapture() { + for (UsbDescriptor descriptor : mDescriptors) { + if (descriptor instanceof UsbVCInputTerminal) { + return true; + } + } + return false; + } + + /** + * @hide + */ + public boolean hasVideoPlayback() { + for (UsbDescriptor descriptor : mDescriptors) { + if (descriptor instanceof UsbVCOutputTerminal) { + return true; + } + } + return false; + } + + /** + * @hide + */ public boolean hasHIDInterface() { ArrayList<UsbDescriptor> descriptors = getInterfaceDescriptorsForClass(UsbDescriptor.CLASSID_HID); diff --git a/services/usb/java/com/android/server/usb/descriptors/UsbDeviceDescriptor.java b/services/usb/java/com/android/server/usb/descriptors/UsbDeviceDescriptor.java index 973924379f5a..b1cbbafb9ccd 100644 --- a/services/usb/java/com/android/server/usb/descriptors/UsbDeviceDescriptor.java +++ b/services/usb/java/com/android/server/usb/descriptors/UsbDeviceDescriptor.java @@ -160,7 +160,8 @@ public final class UsbDeviceDescriptor extends UsbDescriptor { return new UsbDevice.Builder(parser.getDeviceAddr(), mVendorID, mProductID, mDevClass, mDevSubClass, mProtocol, mfgName, prodName, versionString, configs, serialStr, parser.hasAudioPlayback(), parser.hasAudioCapture(), - parser.hasMIDIInterface()); + parser.hasMIDIInterface(), + parser.hasVideoPlayback(), parser.hasVideoCapture()); } @Override diff --git a/services/usb/java/com/android/server/usb/descriptors/UsbVCEndpoint.java b/services/usb/java/com/android/server/usb/descriptors/UsbVCEndpoint.java index 39fbc0d50b87..f9acecee6bcf 100644 --- a/services/usb/java/com/android/server/usb/descriptors/UsbVCEndpoint.java +++ b/services/usb/java/com/android/server/usb/descriptors/UsbVCEndpoint.java @@ -20,41 +20,54 @@ import android.util.Log; /** * @hide * A video class-specific Endpoint - * see + * see USB_Video_Class_1.1.pdf - 3.10 VideoStreaming Endpoint Descriptors */ abstract class UsbVCEndpoint extends UsbDescriptor { private static final String TAG = "UsbVCEndpoint"; - UsbVCEndpoint(int length, byte type, int subclass) { + + public static final byte VCEP_UNDEFINED = 0x00; + public static final byte VCEP_GENERAL = 0x01; + public static final byte VCEP_ENDPOINT = 0x02; + public static final byte VCEP_INTERRUPT = 0x03; + + UsbVCEndpoint(int length, byte type) { super(length, type); - // mSubclass = subclass; } public static UsbDescriptor allocDescriptor(UsbDescriptorParser parser, - int length, byte type) { + int length, byte type, byte subtype) { UsbInterfaceDescriptor interfaceDesc = parser.getCurInterface(); - int subClass = interfaceDesc.getUsbSubclass(); - switch (subClass) { -// case AUDIO_AUDIOCONTROL: -// if (UsbDescriptorParser.DEBUG) { -// Log.i(TAG, "---> AUDIO_AUDIOCONTROL"); -// } -// return new UsbACAudioControlEndpoint(length, type, subClass); -// -// case AUDIO_AUDIOSTREAMING: -// if (UsbDescriptorParser.DEBUG) { -// Log.i(TAG, "---> AUDIO_AUDIOSTREAMING"); -// } -// return new UsbACAudioStreamEndpoint(length, type, subClass); -// -// case AUDIO_MIDISTREAMING: -// if (UsbDescriptorParser.DEBUG) { -// Log.i(TAG, "---> AUDIO_MIDISTREAMING"); -// } -// return new UsbACMidiEndpoint(length, type, subClass); + + // TODO - create classes for each specific subtype + // (don't need it to answer if this device supports video + switch (subtype) { + case VCEP_UNDEFINED: + if (UsbDescriptorParser.DEBUG) { + Log.d(TAG, "---> VCEP_UNDEFINED"); + } + return null; + + case VCEP_GENERAL: + if (UsbDescriptorParser.DEBUG) { + Log.d(TAG, "---> VCEP_GENERAL"); + } + return null; + + case VCEP_ENDPOINT: + if (UsbDescriptorParser.DEBUG) { + Log.d(TAG, "---> VCEP_ENDPOINT"); + } + return null; + + case VCEP_INTERRUPT: + if (UsbDescriptorParser.DEBUG) { + Log.d(TAG, "---> VCEP_INTERRUPT"); + } + return null; default: - Log.w(TAG, "Unknown Video Class Endpoint id:0x" + Integer.toHexString(subClass)); + Log.w(TAG, "Unknown Video Class Endpoint id:0x" + Integer.toHexString(subtype)); return null; } } diff --git a/services/usb/java/com/android/server/usb/descriptors/UsbVCHeader.java b/services/usb/java/com/android/server/usb/descriptors/UsbVCHeader.java new file mode 100644 index 000000000000..3fc42241b550 --- /dev/null +++ b/services/usb/java/com/android/server/usb/descriptors/UsbVCHeader.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2019 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 com.android.server.usb.descriptors; + +import android.util.Log; + +import com.android.server.usb.descriptors.report.ReportCanvas; + +/** + * @hide + * A video class-specific Interface Header. + * see USB_Video_Class_1.1.pdf section 3.9.2 - Class-Specific VS Interface Descriptors + */ +public final class UsbVCHeader extends UsbVCHeaderInterface { + private static final String TAG = "UsbVCHeader"; + + // TODO Add data members for this descriptor's data + + public UsbVCHeader(int length, byte type, byte subtype, int spec) { + super(length, type, subtype, spec); + } + + @Override + public int parseRawDescriptors(ByteStream stream) { + if (UsbDescriptorParser.DEBUG) { + Log.d(TAG, " ---> parseRawDescriptors()"); + } + // TODO parse data members for this descriptor's data + return super.parseRawDescriptors(stream); + } + + @Override + public void report(ReportCanvas canvas) { + super.report(canvas); + // TODO add reporting specific to this descriptor + } +} diff --git a/services/usb/java/com/android/server/usb/descriptors/UsbVCHeaderInterface.java b/services/usb/java/com/android/server/usb/descriptors/UsbVCHeaderInterface.java new file mode 100644 index 000000000000..372509105ac3 --- /dev/null +++ b/services/usb/java/com/android/server/usb/descriptors/UsbVCHeaderInterface.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2019 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 com.android.server.usb.descriptors; + +import com.android.server.usb.descriptors.report.ReportCanvas; + +/** + * @hide + * A video class-specific Interface Header super class. + * see USB_Video_Class_1.1.pdf section 3.9.2 - Class-Specific VS Interface Descriptors + */ +public abstract class UsbVCHeaderInterface extends UsbVCInterface { + private static final String TAG = "UsbVCHeaderInterface"; + + protected int mVDCRelease; // Video Device Class Specification Release (BCD). + protected int mTotalLength; // Total number of bytes returned for the class-specific + // VideoControl interface descriptor. Includes the combined length + // of this descriptor header and all Unit and Terminal descriptors. + + public UsbVCHeaderInterface( + int length, byte type, byte subtype, int vdcRelease) { + super(length, type, subtype); + mVDCRelease = vdcRelease; + } + + public int getVDCRelease() { + return mVDCRelease; + } + + public int getTotalLength() { + return mTotalLength; + } + + @Override + public void report(ReportCanvas canvas) { + super.report(canvas); + + canvas.openList(); + canvas.writeListItem("Release: " + ReportCanvas.getBCDString(getVDCRelease())); + canvas.writeListItem("Total Length: " + getTotalLength()); + canvas.closeList(); + } +} diff --git a/services/usb/java/com/android/server/usb/descriptors/UsbVCInputTerminal.java b/services/usb/java/com/android/server/usb/descriptors/UsbVCInputTerminal.java new file mode 100644 index 000000000000..df637950899b --- /dev/null +++ b/services/usb/java/com/android/server/usb/descriptors/UsbVCInputTerminal.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 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 com.android.server.usb.descriptors; + +import android.util.Log; + +import com.android.server.usb.descriptors.report.ReportCanvas; + +/** + * @hide + * A video class-specific Input terminal interface. + * see USB_Video_Class_1.1.pdf section 3.7.2.1 Input Terminal Descriptor + */ +public final class UsbVCInputTerminal extends UsbVCInterface { + private static final String TAG = "UsbVCInputTerminal"; + + // TODO Define members to hold the data from this descriptor + public UsbVCInputTerminal(int length, byte type, byte subtype) { + super(length, type, subtype); + } + + @Override + public int parseRawDescriptors(ByteStream stream) { + // TODO Parse the data from this descriptor + if (UsbDescriptorParser.DEBUG) { + Log.d(TAG, " ---> parseRawDescriptors()"); + } + return super.parseRawDescriptors(stream); + } + + @Override + public void report(ReportCanvas canvas) { + // TODO Add reporting specific to this descriptor + super.report(canvas); + } +}; diff --git a/services/usb/java/com/android/server/usb/descriptors/UsbVCInterface.java b/services/usb/java/com/android/server/usb/descriptors/UsbVCInterface.java index c9eb1ec36eb1..46263dde5564 100644 --- a/services/usb/java/com/android/server/usb/descriptors/UsbVCInterface.java +++ b/services/usb/java/com/android/server/usb/descriptors/UsbVCInterface.java @@ -29,20 +29,17 @@ public abstract class UsbVCInterface extends UsbDescriptor { public static final byte VCI_UNDEFINED = 0x00; public static final byte VCI_VEADER = 0x01; public static final byte VCI_INPUT_TERMINAL = 0x02; - public static final byte VCI_VOUTPUT_TERMINAL = 0x03; + public static final byte VCI_OUTPUT_TERMINAL = 0x03; public static final byte VCI_SELECTOR_UNIT = 0x04; - public static final byte VCI_VROCESSING_UNIT = 0x05; - public static final byte VCI_VEXTENSION_UNIT = 0x06; + public static final byte VCI_PROCESSING_UNIT = 0x05; + public static final byte VCI_EXTENSION_UNIT = 0x06; - // See “Universal Serial Bus Device Class Definition for Video + // See “Universal Serial Bus Device Class Definition for Video protected final byte mSubtype; // 2:1 HEADER descriptor subtype - protected final int mSubclass; // from the mSubclass member of the - // "enclosing" Interface Descriptor - public UsbVCInterface(int length, byte type, byte subtype, int subclass) { + public UsbVCInterface(int length, byte type, byte subtype) { super(length, type); mSubtype = subtype; - mSubclass = subclass; } /** @@ -52,12 +49,10 @@ public abstract class UsbVCInterface extends UsbDescriptor { int length, byte type) { byte subtype = stream.getByte(); UsbInterfaceDescriptor interfaceDesc = parser.getCurInterface(); - int subClass = interfaceDesc.getUsbSubclass(); if (UsbDescriptorParser.DEBUG) { - Log.d(TAG, " Video Class-specific Interface subClass:0x" - + Integer.toHexString(subClass)); + Log.d(TAG, " Video Class-specific Interface subtype: " + subtype); } - switch (subClass) { + switch (subtype) { // TODO - Create descriptor classes and parse these... case VCI_UNDEFINED: if (UsbDescriptorParser.DEBUG) { @@ -66,44 +61,51 @@ public abstract class UsbVCInterface extends UsbDescriptor { break; case VCI_VEADER: + { if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " ---> VCI_VEADER"); } - break; + int vcInterfaceSpec = stream.unpackUsbShort(); + parser.setVCInterfaceSpec(vcInterfaceSpec); + if (UsbDescriptorParser.DEBUG) { + Log.d(TAG, " vcInterfaceSpec:0x" + Integer.toHexString(vcInterfaceSpec)); + } + return new UsbVCHeader(length, type, subtype, vcInterfaceSpec); + } case VCI_INPUT_TERMINAL: if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " ---> VCI_INPUT_TERMINAL"); } - break; + return new UsbVCInputTerminal(length, type, subtype); - case VCI_VOUTPUT_TERMINAL: + case VCI_OUTPUT_TERMINAL: if (UsbDescriptorParser.DEBUG) { - Log.d(TAG, " ---> VCI_VOUTPUT_TERMINAL"); + Log.d(TAG, " ---> VCI_OUTPUT_TERMINAL"); } - break; + return new UsbVCOutputTerminal(length, type, subtype); case VCI_SELECTOR_UNIT: if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " ---> VCI_SELECTOR_UNIT"); } - break; + return new UsbVCSelectorUnit(length, type, subtype); - case VCI_VROCESSING_UNIT: + case VCI_PROCESSING_UNIT: if (UsbDescriptorParser.DEBUG) { - Log.d(TAG, " ---> VCI_VROCESSING_UNIT"); + Log.d(TAG, " ---> VCI_PROCESSING_UNIT"); } - break; + return new UsbVCProcessingUnit(length, type, subtype); - case VCI_VEXTENSION_UNIT: + case VCI_EXTENSION_UNIT: if (UsbDescriptorParser.DEBUG) { - Log.d(TAG, " ---> VCI_VEXTENSION_UNIT"); + Log.d(TAG, " ---> VCI_EXTENSION_UNIT"); } break; default: - Log.w(TAG, "Unknown Video Class Interface Subclass: 0x" - + Integer.toHexString(subClass)); + Log.w(TAG, "Unknown Video Class Interface subtype: 0x" + + Integer.toHexString(subtype)); return null; } diff --git a/services/usb/java/com/android/server/usb/descriptors/UsbVCOutputTerminal.java b/services/usb/java/com/android/server/usb/descriptors/UsbVCOutputTerminal.java new file mode 100644 index 000000000000..4aa8ca22cc4e --- /dev/null +++ b/services/usb/java/com/android/server/usb/descriptors/UsbVCOutputTerminal.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 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 com.android.server.usb.descriptors; + +import android.util.Log; + +import com.android.server.usb.descriptors.report.ReportCanvas; + +/** + * @hide + * A video class-specific Output Terminal Descriptor. + * see USB_Video_Class_1.1.pdf section 3.7.2.2 Output Terminal Descriptor + */ +public final class UsbVCOutputTerminal extends UsbVCInterface { + private static final String TAG = "UsbVCOutputTerminal"; + + // TODO Add members for the data in this descriptor + public UsbVCOutputTerminal(int length, byte type, byte subtype) { + super(length, type, subtype); + } + + @Override + public int parseRawDescriptors(ByteStream stream) { + // TODO Parse the data in this descriptor + if (UsbDescriptorParser.DEBUG) { + Log.d(TAG, " ---> parseRawDescriptors()"); + } + return super.parseRawDescriptors(stream); + } + + @Override + public void report(ReportCanvas canvas) { + super.report(canvas); + // TODO Add reporting specific to this descriptor + } +}; diff --git a/services/usb/java/com/android/server/usb/descriptors/UsbVCProcessingUnit.java b/services/usb/java/com/android/server/usb/descriptors/UsbVCProcessingUnit.java new file mode 100644 index 000000000000..5ce842e82598 --- /dev/null +++ b/services/usb/java/com/android/server/usb/descriptors/UsbVCProcessingUnit.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2019 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 com.android.server.usb.descriptors; + +import android.util.Log; + +import com.android.server.usb.descriptors.report.ReportCanvas; + +/** + * @hide + * An video class-specific Processing Unit Interface. + * see USB_Video_Class_1.1.pdf section Table 3-8 Processing Unit Descriptor + */ +public final class UsbVCProcessingUnit extends UsbVCInterface { + private static final String TAG = "UsbVCProcessingUnit"; + + // TODO Add data members for this descriptor + + public UsbVCProcessingUnit(int length, byte type, byte subtype) { + super(length, type, subtype); + } + + @Override + public int parseRawDescriptors(ByteStream stream) { + // TODO Parse this descriptor + if (UsbDescriptorParser.DEBUG) { + Log.d(TAG, " ---> parseRawDescriptors()"); + } + return super.parseRawDescriptors(stream); + } + + @Override + public void report(ReportCanvas canvas) { + super.report(canvas); + // TODO Add reporting specific to this descriptor + } +}; diff --git a/services/usb/java/com/android/server/usb/descriptors/UsbVCSelectorUnit.java b/services/usb/java/com/android/server/usb/descriptors/UsbVCSelectorUnit.java new file mode 100644 index 000000000000..8e9b0d886389 --- /dev/null +++ b/services/usb/java/com/android/server/usb/descriptors/UsbVCSelectorUnit.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2019 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 com.android.server.usb.descriptors; + +import android.util.Log; + +import com.android.server.usb.descriptors.report.ReportCanvas; + +/** + * @hide + * An video class-specific Selector Unit Descriptor + * see USB_Video_Class_1.1.pdf section 3.7.2.4 + */ +public final class UsbVCSelectorUnit extends UsbVCInterface { + private static final String TAG = "UsbVCSelectorUnit"; + + // TODO Add data members for this descriptor + + public UsbVCSelectorUnit(int length, byte type, byte subtype) { + super(length, type, subtype); + } + + @Override + public int parseRawDescriptors(ByteStream stream) { + // TODO Parse this descriptor + if (UsbDescriptorParser.DEBUG) { + Log.d(TAG, " ---> parseRawDescriptors()"); + } + return super.parseRawDescriptors(stream); + } + + @Override + public void report(ReportCanvas canvas) { + super.report(canvas); + // TODO Add reporting specific to this descriptor + } +}; |