Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/manual.js"></script>
These tests require a USB device to be connected.
const kGetDescriptorRequest = 0x06;
const kDeviceDescriptorType = 0x01;
const kDeviceDescriptorLength = 18;
manual_usb_test(async (t, device) => {
t.add_cleanup(async () => {
await device.close();
// This test exercises the behavior that the device remains open when it
// is reset. If the device changes its properties too drastically when
// reset it may appear to disconnect instead.
await device.reset();
// Read the device descriptor in order to validate that communication
// with the device is still possible after a reset.
const result = await device.controlTransferIn({
requestType: 'standard',
recipient: 'device',
request: kGetDescriptorRequest,
value: kDeviceDescriptorType << 8,
index: 0,
}, kDeviceDescriptorLength);
assert_equals(result.status, 'ok', 'transfer status');
assert_equals(, kDeviceDescriptorLength, 'transfer length');
}, 'reset() does not disconnect the device');