File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ use std::process::Command;
99use std:: time:: Duration ;
1010
1111use opentitanlib:: test_utils:: init:: InitializeTest ;
12+ use opentitanlib:: transport:: Capability ;
1213use opentitanlib:: uart:: console:: UartConsole ;
1314
1415use usb:: { UsbDeviceHandle , UsbOpts , port_path_string} ;
@@ -76,6 +77,16 @@ fn main() -> Result<()> {
7677 opts. init . init_logging ( ) ;
7778 let transport = opts. init . init_target ( ) ?;
7879
80+ transport
81+ . capabilities ( ) ?
82+ . request ( Capability :: USB )
83+ . ok ( )
84+ . context ( "This transport does not support USB" ) ?;
85+
86+ // Certain backend such as QEMU will not enumerate USB device until
87+ // we request the USB context.
88+ let _usb_context = transport. usb ( ) . context ( "Cannot get USB context" ) ?;
89+
7990 // Wait until test is running.
8091 let uart = transport. uart ( "console" ) ?;
8192 UartConsole :: wait_for ( & * uart, r"Running [^\r\n]*" , opts. timeout ) ?;
You can’t perform that action at this time.
0 commit comments