From 3a95681ad35265c083cff5e6b46694caa9fe6b2a Mon Sep 17 00:00:00 2001 From: wu Date: Tue, 1 Nov 2022 20:34:56 -0700 Subject: [PATCH] modify request direction for API test Signed-off-by: wu --- .../main/js/test/UsbDevicePipeJsunit.test.js | 20 +++++++++---------- .../js/test/UsbDevicePipeJsunitEx.test.js | 2 +- .../js/test/UsbDevicePipeJsunit_A.test.js | 18 ++++++++--------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js index aecb26197..f56e02341 100644 --- a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js +++ b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js @@ -77,7 +77,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { if (endpoint.direction == usb.USB_REQUEST_DIR_TO_DEVICE) { testParam.maxOutSize = endpoint.maxPacketSize; testParam.outEndpoint = endpoint; - } else if (endpoint.direction == (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)) { + } else if (endpoint.direction == usb.USB_REQUEST_DIR_FROM_DEVICE) { testParam.maxInSize = endpoint.maxPacketSize; testParam.inEndpoint = endpoint } @@ -437,7 +437,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(6, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(6, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0540 GetDescriptor') }) @@ -461,7 +461,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(0, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(0, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0550 GetStatus') }) @@ -485,7 +485,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(8, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(8, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0560 GetConfiguration') }) @@ -509,7 +509,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(10, usb.USB_REQUEST_TARGET_INTERFACE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(10, usb.USB_REQUEST_TARGET_INTERFACE, (usb.USB_REQUEST_DIR_FROM_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), 0, 1) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0570 GetInterface') }) @@ -533,7 +533,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(1, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(1, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_TO_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0580 ClearFeature') }) @@ -557,7 +557,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_INTERFACE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_INTERFACE, (usb.USB_REQUEST_DIR_FROM_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0590 ClearFeature') }) @@ -581,7 +581,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_ENDPOINT, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_ENDPOINT, (usb.USB_REQUEST_DIR_TO_DEVICE) | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_ENDPOINT & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0600 ClearFeature') }) @@ -605,7 +605,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE) | (usb.USB_REQUEST_TYPE_VENDOR << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0610 ClearFeature') }) @@ -629,7 +629,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE) | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0620 ClearFeature') }) diff --git a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js index 344e96d58..cb5c3fb42 100644 --- a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js +++ b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js @@ -77,7 +77,7 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () { if (endpoint.direction == usb.USB_REQUEST_DIR_TO_DEVICE) { testParam.outEndpoint = endpoint; testParam.maxOutSize = endpoint.maxPacketSize; - } else if (endpoint.direction == (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)) { + } else if (endpoint.direction == usb.USB_REQUEST_DIR_FROM_DEVICE) { testParam.inEndpoint = endpoint testParam.maxInSize = endpoint.maxPacketSize; } diff --git a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js index ca03d2c48..77b4dc026 100644 --- a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js +++ b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js @@ -452,7 +452,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { } var timeout = 5000; - var controlParam = getTransferParam(6, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(6, (usb.USB_REQUEST_DIR_FROM_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0540 GetDescriptor') }) @@ -476,7 +476,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { } var timeout = 5000; - var controlParam = getTransferParam(0, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(0, (usb.USB_REQUEST_DIR_FROM_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0550 GetStatus') }) @@ -500,7 +500,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { } var timeout = 5000; - var controlParam = getTransferParam(8, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(8, (usb.USB_REQUEST_DIR_FROM_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0560 GetConfiguration') }) @@ -524,7 +524,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { } var timeout = 5000; - var controlParam = getTransferParam(10, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(10, (usb.USB_REQUEST_DIR_FROM_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), 0, 1) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0570 GetInterface') }) @@ -548,7 +548,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { } var timeout = 5000; - var controlParam = getTransferParam(1, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(1, (usb.USB_REQUEST_DIR_TO_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0580 ClearFeature') }) @@ -572,7 +572,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_FROM_DEVICE) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0590 ClearFeature') }) @@ -596,7 +596,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE) | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_ENDPOINT & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0600 ClearFeature') }) @@ -620,7 +620,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE) | (usb.USB_REQUEST_TYPE_VENDOR << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0610 ClearFeature') }) @@ -644,7 +644,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE) | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0620 ClearFeature') }) -- GitLab