From 768b609c77e84ffdc4c028ebae426d07bec704a4 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 25 Jan 2019 19:39:51 +0100 Subject: [PATCH] demo: Factor-out opening the USB device into f_init() --- demo/USB_Demo.ttcn | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/demo/USB_Demo.ttcn b/demo/USB_Demo.ttcn index 1c5317c..1c3f10b 100644 --- a/demo/USB_Demo.ttcn +++ b/demo/USB_Demo.ttcn @@ -14,6 +14,23 @@ modulepar { hexstring mp_product_id := '0017'H; } +private function f_init() runs on test_CT { + map(self:USB, system:USB); + + var USB_result res; + USB.send(ts_USB_open_vid_pid(hex2int(mp_vendor_id), hex2int(mp_product_id), + device_hdl := 42, req_hdl := 23)); + alt { + [] USB.receive(tr_USB_result(req_hdl := 24, device_hdl := 42)) -> value res { + log("Received ", res); + } + [] USB.receive { + testcase.stop("Couldn't open requested USB device"); + } + } +} + + testcase TC_selftest() runs on test_CT { /* const octetstring raw := '12011001FF11FF088A131700780000000101'O;