@Test
public void getAlternateSetting() throws Exception {
UsbDeviceConnection usbDeviceConnection = mockConnectionWithRawDescriptors(new byte[] {
18, 1, 0, 2, 0, 0, 0, 64, -38, 11, 56, 40, 0, 1, 1, 2, 3, 1, // Device Descriptor
9, 2, 34, 0, 2, 1, 4, -128, -6, // Configuration Descriptor
9, 4, 0, 0, 1, -1, -1, -1, 5, // Interface Descriptor for interface 0 with alternate setting 0
9, 4, 0, 1, 1, -1, -1, -1, 5, // Interface Descriptor for interface 0 with alternate setting 1
7, 5, -127, 2, 0, 2, 0, // Endpoint Descriptor
9, 4, 1, 0, 0, -1, -1, -1, 5 // Interface Descriptor for interface 1 with alternate setting 0
});
// Interface 0 has alternate settings {0, 1}
UsbInterface i0 = mockInterface(0);
assertThat(AlternateUsbInterface.forUsbInterface(usbDeviceConnection, i0),
equalTo(asList(new AlternateUsbInterface(i0, 0), new AlternateUsbInterface(i0, 1))));
// Interface 1 has alternate settings {0}
UsbInterface i1 = mockInterface(1);
assertThat(AlternateUsbInterface.forUsbInterface(usbDeviceConnection, i1),
equalTo(singletonList(new AlternateUsbInterface(i1, 0))));
}
AlternateUsbInterfaceTest.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:AndroidDvbDriver
作者:
评论列表
文章目录