USB VTS: Add VtsHalUsbGadgetV2_0HostTest
Add VTS test for usb gadget hal aidl v2.0
Bug: 218791946
Test: atest VtsHalUsbGadgetV2_0HostTest
Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: Ic0968da6604b170d17565e3ace1c2aed1640aba8
diff --git a/usb/gadget/aidl/host/Android.bp b/usb/gadget/aidl/host/Android.bp
new file mode 100644
index 0000000..fae3b52
--- /dev/null
+++ b/usb/gadget/aidl/host/Android.bp
@@ -0,0 +1,36 @@
+// Copyright (C) 2022 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 {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+java_test_host {
+ name: "VtsHalUsbGadgetV2_0HostTest",
+ libs: [
+ "compatibility-host-util",
+ "tradefed",
+ ],
+
+ static_libs: [
+ "platform-test-annotations-host",
+ ],
+
+ srcs: ["src/**/*.java"],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+}
diff --git a/usb/gadget/aidl/host/AndroidTest.xml b/usb/gadget/aidl/host/AndroidTest.xml
new file mode 100644
index 0000000..41380f0
--- /dev/null
+++ b/usb/gadget/aidl/host/AndroidTest.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 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.
+-->
+<configuration description="Config for VtsHalUsbGadgetV2_0Host test cases">
+ <option name="config-descriptor:metadata" key="plan" value="vts-staging-default" />
+ <option name="config-descriptor:metadata" key="plan" value="vts-hal-host" />
+ <option name="config-descriptor:metadata" key="plan" value="vts-hal" />
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
+
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest">
+ <option name="jar" value="VtsHalUsbGadgetV2_0HostTest.jar" />
+ </test>
+</configuration>
diff --git a/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/VtsHalUsbGadgetV2_0HostTest.java b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/VtsHalUsbGadgetV2_0HostTest.java
new file mode 100644
index 0000000..5745c3f
--- /dev/null
+++ b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/VtsHalUsbGadgetV2_0HostTest.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright (C) 2022 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.tests.usbgadget;
+
+import com.android.tests.usbgadget.libusb.ConfigDescriptor;
+import com.android.tests.usbgadget.libusb.DeviceDescriptor;
+import com.android.tests.usbgadget.libusb.IUsbNative;
+import com.android.tests.usbgadget.libusb.Interface;
+import com.android.tests.usbgadget.libusb.InterfaceDescriptor;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.invoker.TestInformation;
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+import com.android.tradefed.testtype.junit4.BeforeClassWithInfo;
+import com.google.common.base.Strings;
+import com.sun.jna.Native;
+import com.sun.jna.Pointer;
+import com.sun.jna.ptr.PointerByReference;
+import java.util.Arrays;
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/** A host-side test for USB Gadget HAL */
+@RunWith(DeviceJUnit4ClassRunner.class)
+public final class VtsHalUsbGadgetV2_0HostTest extends BaseHostJUnit4Test {
+ public static final String TAG = VtsHalUsbGadgetV2_0HostTest.class.getSimpleName();
+
+ private static final String HAL_SERVICE = "android.hardware.usb.gadget-service";
+ private static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
+ private static final long CONN_TIMEOUT = 5000;
+ private static final int UNKNOWN_SPEED = -1;
+
+ private static boolean mHasService;
+ private static IUsbNative mUsb;
+ private static Pointer mContext;
+
+ private ITestDevice mDevice;
+ private boolean mReconnected = false;
+
+ @Before
+ public void setUp() {
+ mDevice = getDevice();
+ }
+
+ @BeforeClassWithInfo
+ public static void beforeClassWithDevice(TestInformation testInfo) throws Exception {
+ String serviceFound =
+ testInfo.getDevice()
+ .executeShellCommand(String.format("ps -A | grep \"%s\"", HAL_SERVICE))
+ .trim();
+ mHasService = !Strings.isNullOrEmpty(serviceFound) && serviceFound.contains(HAL_SERVICE);
+
+ if (mHasService) {
+ mUsb = (IUsbNative) Native.loadLibrary("usb-1.0", IUsbNative.class);
+ PointerByReference context = new PointerByReference();
+ mUsb.libusb_init(context);
+ mContext = context.getValue();
+ }
+ }
+
+ private static boolean checkProtocol(int usbClass, int usbSubClass, int usbProtocol) {
+ PointerByReference list = new PointerByReference();
+ int count = mUsb.libusb_get_device_list(mContext, list);
+ Pointer[] devices = list.getValue().getPointerArray(0, count);
+ for (Pointer device : devices) {
+ DeviceDescriptor[] devDescriptors = new DeviceDescriptor[1];
+ mUsb.libusb_get_device_descriptor(device, devDescriptors);
+ for (int j = 0; j < devDescriptors[0].bNumConfigurations; j++) {
+ PointerByReference configRef = new PointerByReference();
+ int success = mUsb.libusb_get_config_descriptor(device, j, configRef);
+ ConfigDescriptor config = new ConfigDescriptor(configRef.getValue());
+ List<Interface> interfaces =
+ Arrays.asList(config.interfaces.toArray(config.bNumInterfaces));
+ for (Interface interface_ : interfaces) {
+ List<InterfaceDescriptor> descriptors =
+ Arrays.asList(interface_.altsetting.toArray(interface_.num_altsetting));
+ for (InterfaceDescriptor d : descriptors) {
+ if (Byte.toUnsignedInt(d.bInterfaceClass) == usbClass
+ && Byte.toUnsignedInt(d.bInterfaceSubClass) == usbSubClass
+ && Byte.toUnsignedInt(d.bInterfaceProtocol) == usbProtocol) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /** Check for ADB */
+ @Test
+ public void testAndroidUSB() throws Exception {
+ Assume.assumeTrue(
+ String.format("The device doesn't have service %s", HAL_SERVICE), mHasService);
+ Assert.assertTrue("ADB not present", checkProtocol(255, 66, 1));
+ }
+
+ /**
+ * Check for MTP.
+ *
+ * <p>Enables mtp and checks the host to see if mtp interface is present. MTP:
+ * https://en.wikipedia.org/wiki/Media_Transfer_Protocol.
+ */
+ @Test
+ public void testMtp() throws Exception {
+ Assume.assumeTrue(
+ String.format("The device doesn't have service %s", HAL_SERVICE), mHasService);
+ getDevice().executeShellCommand("svc usb setFunctions mtp true");
+ Thread.sleep(CONN_TIMEOUT);
+ Assert.assertTrue("MTP not present", checkProtocol(6, 1, 1));
+ }
+
+ /**
+ * Check for PTP.
+ *
+ * <p>Enables ptp and checks the host to see if ptp interface is present. PTP:
+ * https://en.wikipedia.org/wiki/Picture_Transfer_Protocol.
+ */
+ @Test
+ public void testPtp() throws Exception {
+ Assume.assumeTrue(
+ String.format("The device doesn't have service %s", HAL_SERVICE), mHasService);
+ getDevice().executeShellCommand("svc usb setFunctions ptp true");
+ Thread.sleep(CONN_TIMEOUT);
+ Assert.assertTrue("PTP not present", checkProtocol(6, 1, 1));
+ }
+
+ /**
+ * Check for MIDI.
+ *
+ * <p>Enables midi and checks the host to see if midi interface is present. MIDI:
+ * https://en.wikipedia.org/wiki/MIDI.
+ */
+ @Test
+ public void testMIDI() throws Exception {
+ Assume.assumeFalse("Skip test: MIDI support is not required for automotive",
+ getDevice().hasFeature(FEATURE_AUTOMOTIVE));
+ Assume.assumeTrue(
+ String.format("The device doesn't have service %s", HAL_SERVICE), mHasService);
+ getDevice().executeShellCommand("svc usb setFunctions midi true");
+ Thread.sleep(CONN_TIMEOUT);
+ Assert.assertTrue("MIDI not present", checkProtocol(1, 3, 0));
+ }
+
+ /**
+ * Check for NCM.
+ *
+ * <p>Enable ncm and check the host to see if ncm interface is present.
+ * For NCM interface definition, you can find more information on
+ * https://www.usb.org/.
+ */
+ @Test
+ public void testAndroidNcm() throws Exception {
+ Assume.assumeTrue(
+ String.format("The device doesn't have service %s", HAL_SERVICE), mHasService);
+ Assert.assertNotNull("Target device does not exist", mDevice);
+
+ String deviceSerialNumber = mDevice.getSerialNumber();
+
+ CLog.i("testAndroidNcm on device [%s]", deviceSerialNumber);
+
+ mDevice.executeShellCommand("svc usb setFunctions ncm");
+ Thread.sleep(CONN_TIMEOUT);
+ Assert.assertTrue("NCM not present", checkProtocol(2, 13, 0));
+ }
+
+ /**
+ * Check for USB connection speed.
+ *
+ * <p>Gets the command result from USB Gadget Hal v1.2. If success,
+ * it will get the USB speed except unknown.
+ */
+ @Test
+ public void testGetUsbSpeed() throws Exception {
+ Assume.assumeTrue(
+ String.format("The device doesn't have service %s", HAL_SERVICE), mHasService);
+ Assert.assertNotNull("Target device does not exist", mDevice);
+
+ String deviceSerialNumber = mDevice.getSerialNumber();
+
+ CLog.i("testGetUsbSpeed on device [%s]", deviceSerialNumber);
+
+ String output = mDevice.executeShellCommand("svc usb getUsbSpeed");
+ int speed = Integer.parseInt(output.trim());
+
+ Assert.assertTrue("There is no USB enumeration", speed != UNKNOWN_SPEED);
+ }
+
+ /**
+ * Check for USB resetUsbGadget function.
+ *
+ * <p>This command will reset USB Gadget.
+ */
+ @Test
+ public void testResetUsbGadget() throws Exception {
+ Assume.assumeTrue(
+ String.format("The device doesn't have service %s", HAL_SERVICE), mHasService);
+ Assert.assertNotNull("Target device does not exist", mDevice);
+
+ String deviceSerialNumber = mDevice.getSerialNumber();
+
+ CLog.i("testResetUsbGadget on device [%s]", deviceSerialNumber);
+
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ mDevice.waitForDeviceNotAvailable(CONN_TIMEOUT);
+ Thread.sleep(300);
+ mDevice.waitForDeviceAvailable(CONN_TIMEOUT);
+ mReconnected = true;
+ } catch (DeviceNotAvailableException dnae) {
+ CLog.e("Device is not available");
+ } catch (InterruptedException ie) {
+ CLog.w("Thread.sleep interrupted");
+ }
+ }
+ }).start();
+
+ Thread.sleep(100);
+ String cmd = "svc usb resetUsbGadget";
+ CLog.i("Invoke shell command [" + cmd + "]");
+ long startTime = System.currentTimeMillis();
+ mDevice.executeShellCommand("svc usb resetUsbGadget");
+ while (!mReconnected && System.currentTimeMillis() - startTime < CONN_TIMEOUT) {
+ Thread.sleep(100);
+ }
+
+ Assert.assertTrue("usb not reconnect", mReconnected);
+ }
+}
diff --git a/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/ConfigDescriptor.java b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/ConfigDescriptor.java
new file mode 100644
index 0000000..a2c58c9
--- /dev/null
+++ b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/ConfigDescriptor.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2022 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.tests.usbgadget.libusb;
+
+import com.google.common.collect.ImmutableList;
+import com.sun.jna.Pointer;
+import com.sun.jna.Structure;
+import java.util.List;
+
+public class ConfigDescriptor extends Structure {
+ public static class ByReference extends ConfigDescriptor implements Structure.ByReference {}
+
+ public ConfigDescriptor() {}
+
+ public ConfigDescriptor(Pointer p) {
+ super(p);
+ read();
+ }
+
+ @Override
+ protected List<String> getFieldOrder() {
+ return ImmutableList.of("bLength", "bDescriptorType", "wTotalLength", "bNumInterfaces",
+ "bConfigurationValue", "iConfiguration", "bmAttributes", "bMaxPower", "interfaces",
+ "extra", "extra_length");
+ }
+
+ public byte bLength;
+ public byte bDescriptorType;
+ public short wTotalLength;
+ public byte bNumInterfaces;
+ public byte bConfigurationValue;
+ public byte iConfiguration;
+ public byte bmAttributes;
+ public byte bMaxPower;
+ public Interface.ByReference interfaces;
+ public Pointer extra;
+ public int extra_length;
+}
diff --git a/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/DeviceDescriptor.java b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/DeviceDescriptor.java
new file mode 100644
index 0000000..1903288
--- /dev/null
+++ b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/DeviceDescriptor.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2022 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.tests.usbgadget.libusb;
+
+import com.google.common.collect.ImmutableList;
+import com.sun.jna.Pointer;
+import com.sun.jna.Structure;
+import java.util.List;
+
+public class DeviceDescriptor extends Structure {
+ public static class ByReference extends DeviceDescriptor implements Structure.ByReference {}
+
+ public DeviceDescriptor() {}
+
+ public DeviceDescriptor(Pointer p) {
+ super(p);
+ read();
+ }
+
+ @Override
+ protected List<String> getFieldOrder() {
+ return ImmutableList.of("bLength", "bDescriptorType", "bcdUSB", "bDeviceClass",
+ "bDeviceSubClass", "bDeviceProtocol", "bMaxPacketSize0", "idVendor", "idProduct",
+ "bcdDevice", "iManufacturer", "iProduct", "iSerialNumber", "bNumConfigurations");
+ }
+
+ public byte bLength;
+ public byte bDescriptorType;
+ public short bcdUSB;
+ public byte bDeviceClass;
+ public byte bDeviceSubClass;
+ public byte bDeviceProtocol;
+ public byte bMaxPacketSize0;
+ public short idVendor;
+ public short idProduct;
+ public short bcdDevice;
+ public byte iManufacturer;
+ public byte iProduct;
+ public byte iSerialNumber;
+ public byte bNumConfigurations;
+}
diff --git a/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/IUsbNative.java b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/IUsbNative.java
new file mode 100644
index 0000000..c5c1780
--- /dev/null
+++ b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/IUsbNative.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2022 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.tests.usbgadget.libusb;
+
+import com.sun.jna.Library;
+import com.sun.jna.Pointer;
+import com.sun.jna.ptr.PointerByReference;
+
+/** JNA adapter for <a href="https://libusb.info">libusb</a>. */
+public interface IUsbNative extends Library {
+ /**
+ * Initialize libusb, must be called before calling any other function.
+ *
+ * @param context output location for context pointer
+ * @return 0 on success, or an error code
+ */
+ int libusb_init(PointerByReference context);
+
+ /**
+ * Deinitialize libusb.
+ *
+ * @param ctx context to deinitialize
+ */
+ void libusb_exit(Pointer ctx);
+
+ /**
+ * Returns a list of USB devices currently attached to the system.
+ *
+ * @param ctx context to operate on
+ * @param list output location for a list of devices
+ * @return number of devices, or an error code
+ */
+ int libusb_get_device_list(Pointer ctx, PointerByReference list);
+
+ /**
+ * Get the USB device descriptor for a given device.
+ *
+ * @param dev device
+ * @param desc output location for the descriptor data
+ * @return 0 on success, or an error code
+ */
+ int libusb_get_device_descriptor(Pointer dev, DeviceDescriptor[] desc);
+
+ /**
+ * Get a USB configuration descriptor based on its index.
+ *
+ * @param dev device
+ * @param config_index config index
+ * @param config a USB configuration descriptor pointer
+ * @return 0 on success, or an error code
+ */
+ int libusb_get_config_descriptor(Pointer dev, int config_index, PointerByReference config);
+}
diff --git a/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/Interface.java b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/Interface.java
new file mode 100644
index 0000000..a3d3ef1
--- /dev/null
+++ b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/Interface.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2022 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.tests.usbgadget.libusb;
+
+import com.google.common.collect.ImmutableList;
+import com.sun.jna.Pointer;
+import com.sun.jna.Structure;
+import java.util.List;
+
+public class Interface extends Structure {
+ public static class ByReference extends Interface implements Structure.ByReference {}
+
+ public Interface() {}
+
+ public Interface(Pointer p) {
+ super(p);
+ read();
+ }
+
+ public Interface[] toArray(int size) {
+ return (Interface[]) super.toArray(new Interface[size]);
+ }
+
+ @Override
+ protected List<String> getFieldOrder() {
+ return ImmutableList.of("altsetting", "num_altsetting");
+ }
+
+ public InterfaceDescriptor.ByReference altsetting;
+ public int num_altsetting;
+}
diff --git a/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/InterfaceDescriptor.java b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/InterfaceDescriptor.java
new file mode 100644
index 0000000..574e0d1
--- /dev/null
+++ b/usb/gadget/aidl/host/src/com/android/usb/gadget/vts/libusb/InterfaceDescriptor.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2022 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.tests.usbgadget.libusb;
+
+import com.google.common.collect.ImmutableList;
+import com.sun.jna.Pointer;
+import com.sun.jna.Structure;
+import java.util.List;
+
+public class InterfaceDescriptor extends Structure {
+ public static class ByReference extends InterfaceDescriptor implements Structure.ByReference {}
+
+ public InterfaceDescriptor() {}
+
+ public InterfaceDescriptor(Pointer p) {
+ super(p);
+ read();
+ }
+
+ public InterfaceDescriptor[] toArray(int size) {
+ return (InterfaceDescriptor[]) super.toArray(size);
+ }
+
+ @Override
+ protected List<String> getFieldOrder() {
+ return ImmutableList.of("bLength", "bDescriptorType", "bInterfaceNumber",
+ "bAlternateSetting", "bNumEndpoints", "bInterfaceClass", "bInterfaceSubClass",
+ "bInterfaceProtocol", "iInterface", "endpoint", "extra", "extra_length");
+ }
+
+ public byte bLength;
+ public byte bDescriptorType;
+ public byte bInterfaceNumber;
+ public byte bAlternateSetting;
+ public byte bNumEndpoints;
+ public byte bInterfaceClass;
+ public byte bInterfaceSubClass;
+ public byte bInterfaceProtocol;
+ public byte iInterface;
+ public Pointer endpoint;
+ public Pointer extra;
+ public int extra_length;
+}